How to conditionalize dialogue based on multiple variables
Revision as of 00:46, 12 December 2008 by imported>Haama (How can I conditionalize dialogue on the sum of two variables, or compare one variable against another? moved to How to conditionalize dialogue on the sum of two variables, or compare one variable against another: Changed from question to statemen)
A dialog topic can check to see if a variable against a static number, but not the sum of multiple variables.
In these cases you could create a variable to hold that relationship, and set it in the results of a parent topic leading to choices conditionalized on that variable.
Example 1: if you want to conditionalize a topic for X + Y < 10:
- Create a variable on the NPC called XY (you could also use a quest variable or a global variable)
- Create a parent topic ParentTopic "Hire Mercenaries"
- In that topics results: set XY to X + Y
- Create one or more choices off of ParentTopic, e.g. HireMerc1, HireMerc2
- The conditions on HireMerc1 and HireMerc2 can now use the condition: GetScriptVariable theNPCID, XY < 10
Example 2: if you want to conditionalize a topic for X < Y:
- Create a variable named XlessthanY
- In the parent topic's results: use an if statement and set it to be 0 or 1
- Check XlessthanY in the conditions on the dialogue choices linked to the parent topic.