Solarus-Games English Forum

Solarus => Bugs & Feature requests => Topic started by: Diarandor on December 21, 2015, 10:24:52 AM

Title: Is the function hero:set_invincible([invincible, [duration]]) not working?
Post by: Diarandor on December 21, 2015, 10:24:52 AM
Hi, I am not completely sure of this but I think that the function
Code (Lua) Select
hero:set_invincible([invincible, [duration]])
is not working correctly. It is very strange for an important method like this not to be working, and that makes me think that I am doing something wrong. I have tried to use
Code (Lua) Select
hero:set_invincible(true)
when a switch is activated, but the hero is still being hurt by enemies.

Could someone confirm that this function is not working or that I am doing something wrong?

(Just in case, I have opened an issue for this in github, here: https://github.com/christopho/solarus/issues/805)
Title: Re: Is the function hero:set_invincible([invincible, [duration]]) not working?
Post by: Christopho on December 21, 2015, 10:56:46 AM
I just fixed it. The default duration parameter was not working, it was treated as zero instead of infinity.
A workaround is to do hero:set_invincible(true, 10000000)
Title: Re: Is the function hero:set_invincible([invincible, [duration]]) not working?
Post by: Diarandor on December 21, 2015, 11:17:46 AM
Thanks! You are very fast.  ;D