Any ideas ?

Sterling94
25 Dec 2018, 14:40

I'm using some variables in my game (the player has to go through specific pages in order to move forward in other places), and I'd like to simply reinitialize every variable every time the player goes to the "Game Over" screen.

Any ideas ?


mrangel
25 Dec 2018, 19:02

Are you storing your variables as attributes on the player object?

If so, you could clone the player object at the start of the game (to save initial values) and then copy them back with a script:

foreach (attr, ListExclude (ListCompact (ListCombine (GetAttributeNames (player1, false), GetAttributeNames (player, false))), "name")) {
  set (player, attr, GetAttribute (player1, attr))
}

(off the top of my head, typing on my phone during χmas dinner, so could have errors)

If your variables are on multiple objects, it could be more complex.


Forgewright
25 Dec 2018, 20:12

(off the top of my head, typing on my phone during χmas dinner, so could have errors)

best quote of the year...


XanMag
25 Dec 2018, 22:58

How many variables are we talking about? A few? A dozen? A hundred? Different ways to do this but it depends on how many there are.


Dcoder
26 Dec 2018, 09:56

"Honey, get off the phone!"