So far I have been using the variables system for kill counts quests and also for setting up conversation conditions without using quest conditions. I am trying to step up my use of variables, but I have realized that I do not really know where they are stored and how to access them properly, and whether or not they may be used in conjunction with UCC attributes.
So to chunk it out, I have a few questions:
1) Is there a way to call out a variable and show it in a text window or assign it to a slider? (quest tracker and alerts do use [var=x] to show a variable, but I could not make that work in a text window. Could you point to where I should look at in the documentation for this.
2) Is there a possibility of integrating those with the Attribute values of UCC? For example, if you have an intelligence of 5 (DSU variable) then the attribute value "Mana" for UCC can be set up to be 5x intelligence.
Thank you for bearing with the noob questions.
Variables
Re: Variables
At runtime, the Dialogue System runs a Lua scripting environment. When it loads a dialogue database, it puts the database's variable values, quest states, etc., into Lua. You can put Lua code in your dialogue entry nodes' Conditions and Script fields. Typically you'll do it through the "..." dropdown menus, but you can also type in the Lua code manually. When the Dialogue System saves a game, it essentially just dumps the contents of the Lua environment into the saved game. You can read more about Lua here: Logic & Lua.pegassy wrote: ↑Sun Dec 30, 2018 2:53 pmSo far I have been using the variables system for kill counts quests and also for setting up conversation conditions without using quest conditions. I am trying to step up my use of variables, but I have realized that I do not really know where they are stored and how to access them properly, and whether or not they may be used in conjunction with UCC attributes.
You may need to do a tiny bit of scripting or use an equivalent visual scripting action. In a C# script, use the DialogueLua.GetXXX() and SetXXX() functions as described in How To Use Lua In Your C# Scripts. For example:pegassy wrote: ↑Sun Dec 30, 2018 2:53 pm1) Is there a way to call out a variable and show it in a text window or assign it to a slider? (quest tracker and alerts do use [var=x] to show a variable, but I could not make that work in a text window. Could you point to where I should look at in the documentation for this.
Code: Select all
using PixelCrushers.DialogueSystem; // Put this line at the top of your script.
...
int x = DialogueLua.GetVariable("x").asInt;
MySlider.value = x;
Code: Select all
MyUIText.text = FormattedText.ParseCode("The value of x is [var=x].");
The UCC integration adds special Lua functions to get and set attributes and items. For example, let's say you have a DSU variable named "intelligence". In Lua, this would be:
Code: Select all
Variable["intelligence"]
Code: Select all
uccSetAttribute("", "Mana", 5 * Variable["intelligence"])
It's possible to tie activity dynamically to variable changes, such as automatically increasing Mana whenever Variable["intelligence"] changes. But this is usually pretty case-specific and involves a bit more work.
Re: Variables
As always, thank you so much for the detailed explanation Tony. I appreciate it.