Solarus-Games English Forum

Solarus => Development => Topic started by: rein_of_fire on October 02, 2015, 03:11:38 AM

Title: multiple types of damage
Post by: rein_of_fire on October 02, 2015, 03:11:38 AM
is there a way to have multiple different damages to give vulnerability/invulnerability/resistance to enemy's?

i would love to use the engine but this is essential to the game i want to make

-thanks in advance
Title: Re: multiple types of damage
Post by: Renkineko on October 02, 2015, 07:53:51 AM
You can customize all damages (enemies or hero) via functions like http://www.solarus-games.org/doc/latest/lua_api_enemy.html#lua_api_enemy_on_hurt or http://www.solarus-games.org/doc/latest/lua_api_hero.html#lua_api_hero_on_taking_damage

See https://github.com/Renkineko/solarus-nrfh/blob/master/data/physical_condition.lua#L95 for an example of the use of hero:on_taking_damage : if he is frozen, damage is tripled. You can set in this kind of script the element vulnerability of the hero (depending on everything you want), and use it. The engine is very permissive with the calculation of damages :)
Title: Re: multiple types of damage
Post by: rein_of_fire on October 02, 2015, 08:47:29 PM
Thanks for the fast reply! That's great.