Hello there,
the past few days i was working on a custom made dialog system because the normal one wasn't satisfying enough for me. Thats because of some main points:
1) the dialog parts itself are bound to a single condition: When wanting more than one condition influence the dispalying of one dialog part several conditions have to be connected up and result in a single condition which can be checked
2) the dialog tree is static. I have no chance to display specific parts from different sub-dialogs of the same tree
3) the dialog "box" contains all selectable items. No chance to display the texts on different positions
All in all the normal dialog system is great and easy to use, but has some flaws which i liked to solve.
I made up a concept for this which replicates the normal dialog system but adds some more features like:
1) customizable gui. The whole dialog is an interface with displayed object texts for each line. It is possible to arrange the text positions as you like.
2) interface could be animated. Lets slide the interface in or do some other crazy stuff when showing the dialog or selecting a line
3) match multiple conditions and/or variables for a single dialog part (just yet i only check one condition, but thats just a matter of time to replace it with a checking function and return true or false for all given conditions.
4) still multi language support out of the "script"
5) dialog parts are included via a Script from the Scripts section of Visionaire (no additional files needed). By that all your dialog parts which get displayed can be edited in a much easier way (or in an external program) ->mass edit stuff
6) mixed level dialogs (not bound to a static dialog tree. Just connect the parts how you like it).
7) its still possible to scroll the displayed dialog parts. (because i didn't mention it )
(One contra point (right now) is that i cant display valueInt and valueStrings inside of the selectable displayed dialog parts)
To visualize what i did i made the following flow chart:
Now what happens here?
if i start the start_dialog function i attach some atributes to it and look up the dialog_options which were given and if they exist inside the dialog_file (a Script inside the Scripts Part of Visionaire)
For each dialog_option i found i grab its content and save it to a table (see violet box on the left). For dialog part "dialog_part_1" i have this table generated:
text_de: 'Dialog text 1 und so'
text_en: 'Dialog text 1 and stuff'
action: 'text_1_action'
conditions: 'test_condition'
pointer: 'dialog_part_1|dialog_ende'
I now check its condition "test_condition" and if its true. If yes i add the dialog part to a table and add either the english or german text to table field [text], the action to [action] and the pointers to [pointers]
We need the pointers to run a following dialog when the action of the selected dialog part ends.
So we have this at the end:
dialog_parts = {
[1] = {
["text"] = "Dialog text 1 und so",
["action"] = "text_1_action",
["pointer"] = "dialog_part_1|dialog_ende"
}
[2] = some more parts like this
[3] = ...
}
Only the table i need to display the text and what i need to execute the action is inside the final table. It is possible to
edit the script to pass an image file string instead of a text by that imitating the sam & max hit the road dialog system.
After the table of valid dialog parts is generated i show the interface which runs at left click per "execute a script" action part the action which was passed from the table.
in each action which would probably run from a left click, the last action part starts a new dialog with the passed "pointers". if no pointers were passed the dialog ends.
So why am i writing this?Because I still need some help to polish some things up. I know not everybody is able to script in Lua but even you can give me some input to expand the script and add features from your ideas.
Also i need help for the following scripting stuff to complete this concept. Maybe with some help from the community
1) check condition(s):
EDIT: DONE!What i have is a string of conditions separated by "|". What i need is a function which goes through each of these conditions and check if they are true (or false if a "!" is in front of it). Also it would be cool to check also for valueInt (and ValueString). If all condition/values are true, return true, else return false.
The given String could look like this:
"condition1|condition2|!condition3|v_valuename=10|vs_valuename=stanley"
The vs_part maybe is a bit too much, but stil nice to have^^
2) replace and to its string or int. Because the text from the table gets already displayed via a show object text action part, the tags inside this string don't get replaced again. So i need to replace the tags inside the text before displaying them...
3) currently the object polygon of each line is static. It would be cool to add points to reorder the object polygon and change it regarding to the displayed text (so the dialogscript need a further "polygon"-field with coordinates).
4) any suggestions?
kind regards
Sebastian