Save Game to Slot not saving everything?

0 favourites
  • 5 posts
From the Asset Store
The ultimate voice pack filled with 1,536 files of .......wav and mp3 of individual numbers, letters, and words (that go
  • Hi all! I have a question regarding "Save Game to Slot" action.

    I used it on my game, and at first it seems it works great... but then I noticed there are some values that are not stored/loaded. Specifically some instance variables inside a sprite object.

    I didn't added the "No save" behaviour to those objects, still it seems to load the game with an outdated value.

    Do you know any issues saving some specific instance variables?

    Thanks!

    Tagged:

  • It should save the state with all variables. All I can think of is that it isn't saving at the point where you think it is or on load you have events that change the variables instantly so you could never tell.

  • It should save the state with all variables. All I can think of is that it isn't saving at the point where you think it is or on load you have events that change the variables instantly so you could never tell.

    When loading the Saved Slot, the "On Layout of Layout" executes again? I don't think so since it would restart the global variables, etc.

    As you can see in this video, at the top the areas I show requires 5 woods the first one, and 5 men the other. After merging both icons and assigning to each area, now they need 4.

    The red dot indicates the game has been saved. At that point I already have 2 new heads on the grid.

    When leaving the game and continuing, I see the 2 heads, the music continues from where it saved, etc. But the required wood and man are still 5.

    Those values are just instance variables that hold a number, nothing special :S

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I kind of fixed the problem, but don't for certain if that's the problem...

    I had an event that checked a boolean called "gameStarted", and had an "trigger once while true". That event takes the config data from the dictionary and sets the items required to upgrade each area (forest, village, mine).

    It triggers at the beginning of the game. But it seems that when saving and loading, it doesn't "remember" that the event was already triggered so, it sets again the info from the dictionary in the middle of the game (after loading from the game slot), thus overwriting the values loaded.

    I changed it, instead of being an event that checks a boolean and trigger once, I made it a function, and run it on the main Init loop.

    Hope this helps someone with a similar problem using load/save and trigger once.

  • Yes that's correct, I remember someone asking this in a similar post. If the event is just trigger once on its own then it runs again on a load. Best practice not to leave a trigger once event out there as a solo condition.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)