[Solved] With working In the create event ?

M

monsieurGrignoux

Guest
HI, I was wondering if the with statement is working in the create event.
Seems Like not ... but not sure of my code...
 

Alexx

Member
The Create Event only runs once when the object is created.

What are you trying to achieve?
It's possible you need your code in a different event.
 
M

monsieurGrignoux

Guest
The Create Event only runs once when the object is created.

What are you trying to achieve?
It's possible you need your code in a different event.
I find my mistake I just made a pre-state0 in the Step event using a switch loop and using an alarm to switch to state1.

And yep so you can't define define a variable who will never change in a object since you always use
var inst = instance_create_layer() // somewhere
with(inst) { number = ......... etc } //right after.



Or maybe there a way I don't see ?
It's not a big issue, it's just a load a tons of variable from a ds.list and don't want to repeat it even for a fraction of second. And I have to use an alarm because I use a global.varible to sync all my player in a team...
 

TheouAegis

Member
If the object you are trying to create an instance of has code in its Create Event which requires a variable (in this case, 'number') to be set, you cannot do that. In your code, with(inst) gets run after the Create Event of the new instance is run.
 
Top