Fangames > Programming Questions

Globals restarting?

(1/1)

RebornIsaac:
Whenever I restart my game, the globals restart, let's say item1 is at 1 when I restart/close it, and when I come back its again at 0, why does this happen? How can I keep the globals constant?
(Btw, Engine used is I Wanna Be The Engine V2)

Kyir:
They're resetting because you're not actually saving the value of the variable. You need to fiddle with the save/load code for that, but I'm not sure how that engine structures it.

pieceofcheese87:
Why are you using such an old and outdated engine?

Derf:

--- Quote from: RebornIsaac on August 14, 2015, 04:35:34 PM ---Whenever I restart my game, the globals restart, let's say item1 is at 1 when I restart/close it, and when I come back its again at 0, why does this happen? How can I keep the globals constant?
(Btw, Engine used is I Wanna Be The Engine V2)

--- End quote ---
The game restart function is essentially the same as the game closing then starting again, so that's why no variables are saved over. Your three options to fix this are:

1). Set every global variable to be saved and loaded in the save and load scripts of the engine.

2). Rework the game over system so that it restarts the room and not the game.

3). Use a different engine that handles things better (though I'm not sure which I'd suggest as every engine I've used I have inevitably had to recode the saving system as they are generally pretty terrible).

patrickgh3:
I said pretty much the same thing as Derf in this thread, which is essentially the same issue. https://www.iwannacommunity.com/forum/index.php?topic=1823.0

Navigation

[0] Message Index

Go to full version