(Solved)Sword variants?

Started by zutokaza, March 24, 2017, 11:54:20 PM

Previous topic - Next topic
March 24, 2017, 11:54:20 PM Last Edit: April 06, 2017, 01:24:28 AM by zutokaza
Can a sword have different variants? For example, variant 2 for a red sword graphic?

Code ( lua) Select
game:set_ability("sword", 2)
Solarus Works on ReactOS Opensource Windows OS

https://www.reactos.org/forum/viewtopic.php?f=2&t=14759&p=120616#p120616

March 25, 2017, 12:29:53 AM #1 Last Edit: March 25, 2017, 08:13:25 PM by Zefk
Yes, you can do that. Make another sword and call it "sword2" and change the graphics to red swords.  The sword will be at level 2. That means it will inflict more damage.

sword2 counts as the second variant in
Code ( lua) Select
game:set_ability("sword", 2)

You will need to create other names with a "2" after it. Follow the error messages. It will mentions names like "sword_stars2."



Your second option would be to just change the sprite. Make a new animation called, "red_sword."
http://www.solarus-games.org/doc/latest/lua_api_hero.html#lua_api_hero_set_sword_sprite_id

Code ( lua) Select
hero:set_sword_sprite_id("red_sword")

March 25, 2017, 01:03:42 AM #2 Last Edit: April 06, 2017, 01:24:48 AM by zutokaza
Thanks again Zefk! The sword variant change is working.
Solarus Works on ReactOS Opensource Windows OS

https://www.reactos.org/forum/viewtopic.php?f=2&t=14759&p=120616#p120616