O
OriginalGrim
Guest
I'm trying to make dialog appear in a textbox different to what is in the textbox object but after the textbox is created and distroyed the first time the next time i walk into the npc it crashes the game and I can't figure out why.
if distance_to_object(obj_player) <= 5 {
if keyboard_check(ord("E"))
if (textbox = noone)
textbox = instance_create_layer(obj_NPC_Bob.x, obj_NPC_Bob.y, "TextLayer", obj_textbox)
obj_textbox.text = "Hi I'm Bob";
}
if (textbox != noone)
if keyboard_check_pressed(ord("I")) {
instance_destroy(obj_textbox);
textbox = noone;
}
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object obj_parent_NPC:
Unable to find any instance for object index '11' name 'obj_textbox'
at gml_Object_obj_parent_NPC_Step_0 (line 39) - if (textbox != noone)
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_parent_NPC_Step_0 (line 39)
If there's other parts of the code needed to solve this just ask I've been trying to figure this out and it's incredibly frustrating.
if distance_to_object(obj_player) <= 5 {
if keyboard_check(ord("E"))
if (textbox = noone)
textbox = instance_create_layer(obj_NPC_Bob.x, obj_NPC_Bob.y, "TextLayer", obj_textbox)
obj_textbox.text = "Hi I'm Bob";
}
if (textbox != noone)
if keyboard_check_pressed(ord("I")) {
instance_destroy(obj_textbox);
textbox = noone;
}
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object obj_parent_NPC:
Unable to find any instance for object index '11' name 'obj_textbox'
at gml_Object_obj_parent_NPC_Step_0 (line 39) - if (textbox != noone)
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_parent_NPC_Step_0 (line 39)
If there's other parts of the code needed to solve this just ask I've been trying to figure this out and it's incredibly frustrating.