Instance_create no longer accepts variables

O

Omninaut

Guest
The code is essentially:

(during attack frame)
{ var damage = instance_create(x,y,obj_damage)
damage.creator = id;
damage.attack = 5;
}

(in the damage objects create event)
z = creator.z;

The game crashes and gives me "<unknown object> <unknown variable> "creator" "z" error
 
Last edited by a moderator:

Slyddar

Member
The create code of an object will run first when the object is created, so the next lines are not ran until after the create code completes. So creator.z will be unknown at that time.

If you have code in your create that requires the variables you are passing to it, you should set an alarm so they get applied next step instead.
 
O

Omninaut

Guest
The create code of an object will run first when the object is created, so the next lines are not ran until after the create code completes. So creator.z will be unknown at that time.

If you have code in your create that requires the variables you are passing to it, you should set an alarm so they get applied next step instead.
Amazing! i knew that awhile ago and i guess just forgot it and idk. Thank you, fixed it immediately
 
Top