[SOLVED]Saving state for a single Custom Entity possible ?

Started by MetalZelda, October 16, 2015, 03:48:13 PM

Previous topic - Next topic
October 17, 2015, 12:41:52 AM #15 Last Edit: October 17, 2015, 01:15:26 AM by Username
Quote from: Diarandor on October 17, 2015, 12:23:15 AM
There are still some problems in your code.

First, you wrote "game:get_value("small_key", chest_savegame_variable)". But, the function "get_value" has only 1 parameter, so you should have something like :
"local open = game:get_value(chest_savegame_variable)".

Also, you wrote "game:set_value("small_key", chest_savegame_variable)", which is not what you should write. The first parameter must be the variable name, which in this case is the string stored in "chest_savegame_variable". The second variable should be the local variable "sk_chest" (I recommend you to set it as the boolean true when the chest has been opened). You will have something like:
"game:set_value(chest_savegame_variable, sk_chest)"
(I would use "open" or "is_open" for the name of the local variable where you store the boolean, instead of "sk_chest".)

With all of these changes you should be able to repair the script.


Finally it works, Thank you Christopho and Diarandor for your help !