Is the function hero:set_invincible([invincible, [duration]]) not working?

Started by Diarandor, December 21, 2015, 10:24:52 AM

Previous topic - Next topic
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)
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

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)

Thanks! You are very fast.  ;D
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."