Solarus-Games English Forum

Solarus => Development => Topic started by: Tulk on June 21, 2017, 11:24:23 PM

Title: Heart Fully Replenished - Help
Post by: Tulk on June 21, 2017, 11:24:23 PM
Hello! What would be the command to restore all life when you pick up a heart container? I know the logic but not the command = /
Title: Re: Heart Fully Replenished - Help
Post by: Diarandor on June 22, 2017, 12:22:53 AM
Quote from: Tulk on June 21, 2017, 11:24:23 PM
Hello! What would be the command to restore all life when you pick up a heart container? I know the logic but not the command = /

Ahoy there! There is not a single command to do that.
But if you already know the logic, you can easily do it.

You will find here the tools and commands that you may need:
http://www.solarus-games.org/doc/1.5/lua_api_game.html
The rest is just Lua, but I leave it as a programming exercise for you. ;)

PS: you can also find the code you need in any Solarus game made by Christopho.  :)
Title: Re: Heart Fully Replenished - Help
Post by: Zefk on June 23, 2017, 12:08:51 AM
Some important functions from the documentation to know.
http://www.solarus-games.org/doc/1.5/lua_api_game.html#lua_api_game_set_max_life
http://www.solarus-games.org/doc/1.5/lua_api_game.html#lua_api_game_get_max_life
http://www.solarus-games.org/doc/1.5/lua_api_game.html#lua_api_game_get_life
http://www.solarus-games.org/doc/1.5/lua_api_game.html#lua_api_game_set_life

Example:

Code ( lua) Select
game:set_max_life(12)
game:set_life(game:get_max_life())
Title: Re: Heart Fully Replenished - Help
Post by: Tulk on June 25, 2017, 07:50:22 AM
Thank you guys! \o