Global variable counter on restore event [SOLVED]

Started by rmonic79, Fri 14/07/2017 00:45:36

Previous topic - Next topic

rmonic79

guys i had no problem to set a variable with an if on  if (event == eEventRestoreGame)
now i'm tryng to make a counter on single restore event to unlock an easy mode after certain amounts of deaths but it go back to previous value.
any suggestions? (it works storing the value in a file but i would like to know if there's a better solution.)

Gurok

Each time you restore a game, the counter is being reset because it's part of the saved game data.

Using an external file is a perfectly workable solution. I would keep track of how many times each slot has been restored and reset a slot's restore count when that slot is saved.

Thinking outside the box, you could implement your own "retry" button when the player dies. Have that button move the player to the start of the scene and reset any variables, then increment a retry counter. It would mean custom scripting for each death in the game, but as you're not restoring, you'll avoid the pitfalls of your current approach.
[img]http://7d4iqnx.gif;rWRLUuw.gi

rmonic79

Thanks gurok i think i'll go with file cause reset this specific room is below the time i have but it could be useful in other context.
By the way the now that i think of it, code works one time, so maybe it's possible that if i make an autosave after each restore it could works.

rmonic79


SMF spam blocked by CleanTalk