Forum rules - please read before posting.

Change variables in saves

Is there a way to change one or few variables in save file, without affecting other save data? For example i would like to update game and change some of its coditions which are reperesented by some local/global variables. I see it like change their values in save file at first start in new version, right before player click Continue button in main menu and exexute Save->LoadGame-> Autosave.
Is that possible?

Comments

  • As in, extracting the data, updating the variables, and re-writing to the save file? I would recommend caution there.

    What is the exact scenario you're facing? It's possible to hook into events to alter variable data just after a file has been loaded, as well as prevent the scene being automatically switched to match that of the save. If you can share specific details, I may be able to suggest a workaround.

  • I'm just researching the possibilities for updating the game in the future and trying to figure out what I can change and what I can't in the new version, for a "painless" update of the game. The player will get the new version, but his save file is old, which can lead to bugs.

    For example, I found that if add a new option to the conversation object and load the game with old saves, one of the options will just be duplicated. Which is normal, i guess, because the old save file knows nothing about the new option. But it not that you expect. Something similar will probably happen if add / delete a new item in the menu, etc.

    "As in, extracting the data, updating the variables, and re-writing to the save         file? I would recommend caution there."
    

    Yes, my first thought was about something like that. Something like migrating to the new version using the built-in save system and custom scripts. But from your answer I realized that this is not the best idea.

    And now I think that the best solution is not to modify the existing variables, conversation objects, menus, variable components, but to change them to new ones. Then they will get new IDs, save into the player save file and will work as usual.

  • Loading an old file in a new save should only affect data that existed beforehand. You can amend IDs as you say, but your Conversation option duplication issue sounds like a bug.

    I can't reproduce this behaviour, however, after creating a conversation, saving, adding a new option, and then loading. What are your AC/Unity versions, and am I missing a key step?

  • AC 1.84.3
    Unity 22.3.62

    Create new Conversation with options
    https://ibb.co/zT5GPjX4
    In build
    https://ibb.co/BVrT0TvG
    Add new option
    https://ibb.co/kVTnVn0k
    New build. In main menu press Continue button (Save->LoadGame-> Autosave), navigate to the scene, open conversation
    https://ibb.co/M5W58b92

  • Recreated, thanks for the details. I'll look into this.

  • A fix for this will be included in the next update.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.