[solved]how do i make all variables return to their initial state?

Megax60

Member
i want a script to make all vars of a single object return to what they were in the create event, but with some exceptions like HP, if there is a way to do that without making all variables go to their original state one by one pls tell me
 

Megax60

Member
yeah..

//example
playerStrengthStart=1;
playerStrengthEnd=5;
playerStrengthCurrent=playerStrengthStart;


etc
found a better solution, why not just add a var called me in each object that can be afected

Create event:
Code:
me = obj_player
and in a script:

Code:
with (instance_create(x,y,me)){
    exception = other.exception //hp for example
}

instance_destroy()
and adding whatever exception there
 
found a better solution, why not just add a var called me in each object that can be afected

Create event:
Code:
me = obj_player
and in a script:

Code:
with (instance_create(x,y,me)){
    exception = other.exception //hp for example
}

instance_destroy()
and adding whatever exception there
yeah sure, seems like it might just depends on the game. Easiest way for me i'd say would still be to set up some variables, maybe even global variables to hold the inital stats, and change the player hp based on that.

Code:
///example

//objGameControl
//create
global.playerHp=3

//objPlayer
//create
currentHp=global.playerHp;
then you can change the currentHp of the player etc while always having that initial hp variable to grab from. I guess if you have 10 stats, it gets messy...but I still think it is the easiest way for saving a few initial variables.
 

Dev_M

Member
i want a script to make all vars of a single object return to what they were in the create event, but with some exceptions like HP, if there is a way to do that without making all variables go to their original state one by one pls tell me

What if you call perform_event(create_event) and then manually adjust all the exeptions?

Or copy the variables form create into an alarm, that you call and then adjust all the exeptions...

Or a third option write a script that has all the create event variables in it going to init, and
then use exeptions for arguments?

scr_reinitialize(exeption1, exeption2, etc); Everything thats not mentioned as an argument goes by
hard coded code to init stage within script...
 
Top