Gamesalive
Member
Hi,
I have an issue where the output says my global variable is not set before reading. The variable global.itemHeld is initiated in a separate initiation room by a persistant object. When a new object is created afterwards, it tries to access the variable upon creation. Here is the error:
for object obj_hold_item:
global variable name 'itemHeld' index (100072) not set before reading it.
at gml_Object_obj_hold_item_Create_0 (line 10) - holdItem = ds_grid_get(global.quickslot,global.itemHeld,slot.id);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_hold_item_Create_0 (line 10)
called from - gml_Object_obj_player_Create_0 (line 4) - holdItem = instance_create_depth(x,y,-100,obj_hold_item);
called from - gml_Object_obj_player_controller_Create_0 (line 8) - global.player = instance_create_layer(100,100,"Instances",obj_player);
I'm not sure whether this is a glitch in GMS2 but I hope not. The room is changed almost immediately after the global.itemHeld is initiated.
Thanks in advance for any help! I hope this all makes sense ;-)
I have an issue where the output says my global variable is not set before reading. The variable global.itemHeld is initiated in a separate initiation room by a persistant object. When a new object is created afterwards, it tries to access the variable upon creation. Here is the error:
for object obj_hold_item:
global variable name 'itemHeld' index (100072) not set before reading it.
at gml_Object_obj_hold_item_Create_0 (line 10) - holdItem = ds_grid_get(global.quickslot,global.itemHeld,slot.id);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_hold_item_Create_0 (line 10)
called from - gml_Object_obj_player_Create_0 (line 4) - holdItem = instance_create_depth(x,y,-100,obj_hold_item);
called from - gml_Object_obj_player_controller_Create_0 (line 8) - global.player = instance_create_layer(100,100,"Instances",obj_player);
I'm not sure whether this is a glitch in GMS2 but I hope not. The room is changed almost immediately after the global.itemHeld is initiated.
Thanks in advance for any help! I hope this all makes sense ;-)