Forum rules - please read before posting.

Save and Load questions

edited April 25 in Technical Q&A

Hello!

I have a couple questions regarding saving/loading capabilities that come with Adventure Creator.

1) I have a counter that is displayed on the screen. The counter variable is a local variable I've created in AC that increases in value when I click a button. The way it is displayed is a Text Mesh Pro game object with a script attached that updates the text with the value of the local variable when a button is clicked. Whenever I load a save, it shows the last displayed number that was on the screen rather than the current value of the local variable. I believe the issue is similar to a previous post but I think the script linked in the response is only applicable to global variables if I am understanding how it works correctly. Is there a way to set the text to the local variable upon loading the scene? Is my only option to use global variables?

2) I recently added the "UI TEMPLATE: SAVE GAME SCREENSHOTS" template from the downloads page. For clarity in my question I will call the menu items added by this template Save (new) and Load (new) while the old ones included by default are Save (old) and Load (old). When I Save (new) and then Load (new), the options menu is open on load in (this is unwanted behavior). If I load (old) a save (new), the options menu is open on load in as well. When I Save (old) and Load (new), the scene loads without any the options menu open (this is the expected behavior). This leads me to believe there is an issue with the imported template from the download page specifically within the Save menu. How can I resolve this issue? I don't see anything that calls the options menu from the save menu section.

3) This is probably a question for the PixelCrushers Dialogue System forum but I figured I'd include it here anyway in case anyone who has used AC has any ideas. If I load a save in the middle of dialogue, the dialogue that was on the screen from the previous scene persists into the loaded scene. I'd like for anything currently on the screen to be cleared when the loading happens, but I am not sure if that would be something that needs to be handled in AC or in Dialogue System.

Thank you!

Comments

  • I believe I found the solution to 3 on the PixelCrushers forum: https://www.pixelcrushers.com/phpbb/viewtopic.php?t=5300

  • Welcome to the community, @peachthyme.

    1) The AC Local variable's value itself should get restored correctly - you can check if this is the case by viewing the Variable Manager's "Local" tab with Show realtime values? checked after loading.

    The "built-in" way of displaying variable values in your UI is to use tokens (see this tutorial). Local variables can be referenced as well using the [localvar:X] token, but it should still be possible to rely on a custom script to manually display its value in a non-AC TextMeshPro Text box.

    What script are you using to link the two, and is it still present on the correct object after loading the save file? If you can share a link to it, I'll have a look see if I can spot what's wrong.

    2) I believe this is an issue related to Template-added Menus not having unique IDs - causing AC to get confused between them when it comes to save data.

    This issue should have been fixed in v1.80.4 - which version were you using at the time you applied the template?

    You should be able to fix this issue in your existing Menu Manager by copy/pasting your "Save (new)" and "Load (new") menus, removing the originals, and then renaming the copied Menus to remove the " (Copy)" label in their name. This should cause their ID values to become unique, and prevent the issue.

    3) Tony's the best source of help when it comes to AC/DS integration, but I'd add to this that you can use AC's new Events Editor to run the "Third Party > Dialogue System Conversation > Stop Conversation" Action automatically after loading a save file. This can be done by creating a new Save / Load / After event and then running the Action inside its ActionList asset.

    The Events Editor is available up in Adventure Creator's top toolbar.

  • edited April 25

    1) Yes, the script is present on the correct object after loading the save. After reviewing this tutorial I was able to get the TextMeshPro Text Box updated when loading by adding the OnEnable, OnDisable, and AfterLoad functions to the text update script. I was overthinking what needed to be done.

    2) The issue was resolved with the workaround you suggested. This is my lesson to keep my packages up to date o:)

    3) Great, thank you very much for the pointer!

    Everything is working as expected now. Thank you for your speedy and in depth response!

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.