Difference between revisions of "How can I conditionalize dialogue on the sum of two variables, or compare one variable against another?"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Rhavlovick
m (Reverted edit of Steve, changed back to last version by Rhavlovick)
 
imported>KyleWollaston
 
Line 16: Line 16:


*The conditions on HireMerc1 and HireMerc2 can now use the condition: GetScriptVariable theNPCID, XY < 10
*The conditions on HireMerc1 and HireMerc2 can now use the condition: GetScriptVariable theNPCID, XY < 10
<pre>
;Result Field
Set XY to X + Y
;Condition
If XY < YourNumber
</pre>




Line 26: Line 35:
*Check XlessthanY in the conditions on the dialogue choices linked to the parent topic.
*Check XlessthanY in the conditions on the dialogue choices linked to the parent topic.


<pre>
;Result Field
If X < Y
Set XLessThanY to 1
EndIf
;Condition
If XLessThanY</pre>


[[Category:Solutions]]
[[Category:Solutions]]

Latest revision as of 02:39, 28 November 2008

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
;Result Field
Set XY to X + Y

;Condition
If XY < YourNumber


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.
;Result Field
If X < Y
Set XLessThanY to 1
EndIf

;Condition
If XLessThanY