Author Topic: (Solved)Sword variants?  (Read 140 times)

zutokaza

  • Full Member
  • ***
  • Posts: 133
  • Active - Making stories can take the most time.
    • View Profile
(Solved)Sword variants?
« on: March 24, 2017, 11:54:20 pm »
Can a sword have different variants? For example, variant 2 for a red sword graphic?

Code: Lua
  1. game:set_ability("sword", 2)
« Last Edit: April 06, 2017, 01:24:28 am by zutokaza »

Zefk

  • Sr. Member
  • ****
  • Posts: 414
  • Just helping Solarus
    • View Profile
    • Zelzec Business
Re: Sword variants?
« Reply #1 on: March 25, 2017, 12:29:53 am »
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
  1. 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
  1. hero:set_sword_sprite_id("red_sword")
« Last Edit: March 25, 2017, 08:13:25 pm by Zefk »

zutokaza

  • Full Member
  • ***
  • Posts: 133
  • Active - Making stories can take the most time.
    • View Profile
(Solved)Sword variants?
« Reply #2 on: March 25, 2017, 01:03:42 am »
Thanks again Zefk! The sword variant change is working.
« Last Edit: April 06, 2017, 01:24:48 am by zutokaza »