M
Mandarieno
Guest
Hello, I'm working on a NPC dialogue system for my 2d adventure game. And I will go straight to my problem:
I made a parent object (obj_npc_parent) that has a string variable (speach) in it's create event.
It also has a draw event in which it draws the string (speach) in the room. This works.
Then I have two different NPC objects (obj_npc_1 and obj_npc_2) that use the same parent (obj_npc_parent). In their create event they change the string variable (speach) into their own individual sentences.
Now when both NPC's are in the same room, they should both have their own individual string variable (speach), which means both have their individual sentence.
The problem is that they both draw the same sentence into the room.
If I give them an int value instead of a string and draw the int value with the drag and drop system it writes both
numbers at the same place. This confuses me.
I my problem is understandable and thanks for reading.
*EDIT: Also when I draw the strings with DnD it it writes both sentences at the same place.
my code:------------------------------------------------------------------------------------------------------------------------------
*obj_npc_parent*
*create event*
speach = "default";
*draw event*
draw_self()
if (global.tbox == true)
{
draw_rectangle_color(view_xview + 0, view_yview + 96, view_xview + 160, view_yview + 144, 0, 0, 0, 0, false);
draw_set_color(c_white);
draw_text_ext(view_xview + 0, view_yview + 96, speach, 16, 160);
}
------------------------------------------------------------------------------------------------------------------------------
*obj_npc_1*
*creat event*
event_inherited();
speach = "something.";
------------------------------------------------------------------------------------------------------------------------------
*obj_npc_2*
*creat event*
event_inherited();
speach = "blabla.";
I made a parent object (obj_npc_parent) that has a string variable (speach) in it's create event.
It also has a draw event in which it draws the string (speach) in the room. This works.
Then I have two different NPC objects (obj_npc_1 and obj_npc_2) that use the same parent (obj_npc_parent). In their create event they change the string variable (speach) into their own individual sentences.
Now when both NPC's are in the same room, they should both have their own individual string variable (speach), which means both have their individual sentence.
The problem is that they both draw the same sentence into the room.
If I give them an int value instead of a string and draw the int value with the drag and drop system it writes both
numbers at the same place. This confuses me.
I my problem is understandable and thanks for reading.
*EDIT: Also when I draw the strings with DnD it it writes both sentences at the same place.
my code:------------------------------------------------------------------------------------------------------------------------------
*obj_npc_parent*
*create event*
speach = "default";
*draw event*
draw_self()
if (global.tbox == true)
{
draw_rectangle_color(view_xview + 0, view_yview + 96, view_xview + 160, view_yview + 144, 0, 0, 0, 0, false);
draw_set_color(c_white);
draw_text_ext(view_xview + 0, view_yview + 96, speach, 16, 160);
}
------------------------------------------------------------------------------------------------------------------------------
*obj_npc_1*
*creat event*
event_inherited();
speach = "something.";
------------------------------------------------------------------------------------------------------------------------------
*obj_npc_2*
*creat event*
event_inherited();
speach = "blabla.";
Last edited by a moderator: