Results 1 to 3 of 3

Thread: Persistant information when entering chest to be retrieved when pulling from chest

  1. #1

    Persistant information when entering chest to be retrieved when pulling from chest

    I know I can use onSave() and onLoad(...), but the onLoad will only pick up changes to a variable made before the last autosave, rather than during onDestroy.

    How hard would it be to store local variables on an object when placed on a container to be placed back on the object when spawned from a container?

    edit: worth noting, I have tried to manually set the script_state encoded json during onDestroy, to no avail.

  2. #2
    Huh, pretty bad that script_state can't be set in onDstroy callback. I guess you'd have to use a separate object (hidden, anything) just to hold that persistent data. Let objects call some 'save' function on it with the data (e.g. in onDestroy) and then try to retrieve it in onLoad. For multiple objects, saved/loaded data could be keyed with GUID (bleh) or some other unique identifier.

  3. #3
    I think that script_state is just a container for data to be written to the game-level save file when auto-save (or manual save) is actually done. I CAN change script_state, but changes to script_state do not persist through a Enter-Bag / Leave-Bag unless an auto-save is run after the change but before the object enters the bag.

    Certainly less than ideal, but I do get why it works this way.

Similar Threads

  1. Let us save Texttools to chest
    By BaconCatBug in forum Suggestions
    Replies: 2
    Last Post: 06-28-2017, 08:20 AM
  2. [ADDED] Chest features
    By Ceroshiro in forum Suggestions
    Replies: 6
    Last Post: 01-30-2017, 04:40 AM
  3. Disable - Save To Chest
    By Crazy in forum Suggestions
    Replies: 14
    Last Post: 01-22-2017, 05:17 AM
  4. [ADDED] Chest Workshop Support
    By Adventurer in forum Suggestions
    Replies: 0
    Last Post: 01-11-2016, 03:10 PM
  5. Workshop to chest
    By Sharpevil in forum General Discussion
    Replies: 1
    Last Post: 05-01-2015, 04:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •