B
Beggar Studios
Guest
Hey everyone! I am creating a bit of a more advanced dialogue system in Gamemaker Studio 2 and I could use some pointers. This is how my dialogue system works now.
Every NPC has a parent that creates a list data structure called dialogue. When the player interacts with an npc a dialogue_update script is called. This script checks a conditions (if talked_to == 0 for example) and fills the data structure with the appropriate dialogue.
Then a dialogue object is created which actually handles the creation of the dialogue box and showing the text.
Now I want to make it a little bit more complicated. I want to dialogue of the npc to be dependant on a state. For example you could have welcome states, quest states or farwell states. But I want each of these states to have different dialogue everytime you talk to them. For example if you talk to the npc for the first time he is in the welcome state. You can talk to him three times before you exhaust his dialogue, but each of these three consist of multiple dialogue lines like in the above example. Then when you start a quest he has 5 dialogue trees.
My question is how do I properly store all the strings for the dialogue? I feel like this can get really complicated if I don't do this properly.
Could someone help me with this?
Every NPC has a parent that creates a list data structure called dialogue. When the player interacts with an npc a dialogue_update script is called. This script checks a conditions (if talked_to == 0 for example) and fills the data structure with the appropriate dialogue.
Code:
///scr_dialogue_update(npc)
var character = argument0;
var name = argument0.name;
switch(name){
case "Seer":
with(character){
ds_list_clear(dialogue)
ds_list_add(dialogue,
"Oh, a new arrival have we? We'll I suppose you're plum out of luck! The Cartographer has locked the gates.",
"We set up a temporary camp to the west. You'll find them quite the rag-tag bunch of misfits.",
"We'd retrieve the keys from The Cartographer but no one has seem him for days.",
"His tent is the green one to the east, but it seems to be deserted.",
"This is quite disurbing indeed."
);
}
break;
}
Now I want to make it a little bit more complicated. I want to dialogue of the npc to be dependant on a state. For example you could have welcome states, quest states or farwell states. But I want each of these states to have different dialogue everytime you talk to them. For example if you talk to the npc for the first time he is in the welcome state. You can talk to him three times before you exhaust his dialogue, but each of these three consist of multiple dialogue lines like in the above example. Then when you start a quest he has 5 dialogue trees.
My question is how do I properly store all the strings for the dialogue? I feel like this can get really complicated if I don't do this properly.
Could someone help me with this?