id reference is invalid

krugen

Member
id_master is 100035. Why did this happened? id_master != noone is not good enough?



Code:
if destroyed //boolean value
{
    instance_destroy();  
}
else
{
    if id_master != noone
    {
        x = id_master.x;  //line 19
        y = id_master.y;

        image_alpha = id_master.image_alpha;
        image_speed = id_master.image_speed;
    }
}


___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object obj_dot_shadow:
Unable to find any instance for object index '100035' name '<undefined>'
at gml_Object_obj_dot_shadow_Step_0 (line 19) - x = id_master.x;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_dot_shadow_Step_0 (line 19)
 

CloseRange

Member
no what you need is:

Code:
if(instance_exists(id_master) {


}
noone is just a special number you as the developer can use for ease of reading code.

EDIT: I smell ninjas :eek:
 

krugen

Member
id_master is 100035. Why did this happened? id_master != noone is not good enough?


Code:
if destroyed
{
    instance_destroy(); 
}
else
{
    if id_master != noone
    {
        x = id_master.x;  //line 19
        y = id_master.y;

        image_alpha = id_master.image_alpha;
        image_speed = id_master.image_speed;
    }
}


___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object obj_dot_shadow:
Unable to find any instance for object index '100035' name '<undefined>'
at gml_Object_obj_dot_shadow_Step_0 (line 19) - x = id_master.x;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_dot_shadow_Step_0 (line 19)
no what you need is:

Code:
if(instance_exists(id_master) {


}
noone is just a special number you as the developer can use for ease of reading code.

EDIT: I smell ninjas :eek:
are these two the same?

if instance_exists(id)

if (instance_exists(id))
 
Top