Author Topic: [SOLVED]Saving state for a single Custom Entity possible ?  (Read 3344 times)

MetalZelda

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
Re: Saving state for a single Custom Entity possible ?
« Reply #15 on: October 17, 2015, 12:41:52 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.

EDIT :

Finally it works, Thank you Christopho and Diarandor for your help !
« Last Edit: October 17, 2015, 01:15:26 am by Username »