Dialogue Trees

metalmario991
For my game I'm trying to set up dialogue trees for when you talk to characters. how would I be able to do that?

HegemonKhan
look into 'using lists' and 'using dictionaries' (and string lists, string dictionaries, and~or script dictionaries) in the quest wiki site.

an example of a way of doing it (in code though):

show menu ("question~comment", StringList, false_or_true) {
invoke (StringListItem (StringDictionary~ScriptDictionary, result))
}


StringList: sword; dragon; princess

StringDictionary: sword="You'll need the dragon slaying sword from the evil sorcerer, to kill the dragon"; dragon="The dragon has kidnapped the princess, and it's scales have never been penetrated by any weapon"; princess="Rescue her and you'll be the king"

conceptually:

if (choosen choice from show menu is 'sword'), then output the StringDictionary's sword's message: "You'll need the..."
if (choosen choice from show menu is 'dragon'), then output the StringDictionary's dragon's message: "The dragon has kidnapped..."
if (choosen choice from show menu is 'princess'), then output the StringDictionary's princess' message: "Rescue her and..."

and you can do this as many layers deep as you want:

show menu 1 ("question~comment", StringList1, false_or_true) {
invoke (StringListItem (StringDictionary~ScriptDictionary1, result))
show menu 2 ("question~comment", StringList2, false_or_true) {
invoke (StringListItem (StringDictionary~ScriptDictionary2, result))
show menu 3 ("question~comment", StringList3, false_or_true) {
invoke (StringListItem (StringDictionary~ScriptDictionary3, result))
}
}
}
}


----------------

if you want a random selection of dialogue messages, then let me know, and I'll help you do this too.

---------------

I'm still new to dialogue however, so others (who're good at coding) can probably provide much better (and more powerful) code designs for doing dialogue.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums