Don't know how to "RESET" the Result my Conditions.
I've been trying create a Craft/Merchant(Shop) function. by using this DialogueSystem
For example, I set a npc named "Bonfire" and whenever the player run into it he will trigger the Conversation which has 3 nodes: "Get warmed" , "Roast some meat" and "You don't have: Raw Meat!".
I set a variable (number) ""RawMeat" and a Condition "RawMeat>=1" linked to that Roast node(by the "..."button).
It worked at the first time that the player run into the ""You don't..." node when I didn't get meat in my inventory and the variable"RawMeat" did shows "0" (in the Dialogue Editor page).
Conversely, when i get a meat first and the the variable did shows "1", then the player run into the "Roast.."node and I did get that roast through some of my C#s.
The problem is, when I triggered that Condition, it doesn't get updated(Changed): I run into the "You don't" node without the meat and soon I get a meat to interact with that "Bonfire" again(variable "RawMeat" shows "1"), but this time the "Bonfire" still said"You don't".
Same as the contrary(Restart the Game): I get a meat first then run into "Roast some" this time, the interesting thing is I can still trigger that "Roast" node even I don't get any meat at inventory(even the Variable has already been reduced to minus)
It seems that the condition result(true/false) it returned doesn't get changed actually, did I do something wrong?
How could I fix it?
Condition (Result) Change in the Same(Repeated) Conversation
Re: Condition (Result) Change in the Same(Repeated) Conversation
You can use a Dialogue System variable, but instead of a variable I recommend reading directly from your inventory. The Dialogue System has integrations with several inventory systems such as Ultimate Inventory System and Inventory Engine as well as the inventory systems inside assets such as ORK Framework, Invector, etc. If you are using one of those systems, configure your conversation's Conditions to check the integration's Lua functions.
Otherwise, you can write your own C# methods and register them with Lua. (Tutorial)
If you are using a Dialogue System variable instead of a Lua function, use DialogueLua.SetVariable() to increment the variable in C#:
or, if you run Lua code:
In either case, structure your conversation like this:
When you restart the game, you should reset the Dialogue System's variables. If you are using the save system:
If you are not using the save system:
Otherwise, you can write your own C# methods and register them with Lua. (Tutorial)
If you are using a Dialogue System variable instead of a Lua function, use DialogueLua.SetVariable() to increment the variable in C#:
Code: Select all
DialogueLua.SetVariable("RawMeat", DialogueLua.GetVariable("RawMeat").asInt + 1);
Code: Select all
Variable["RawMeat"] = Variable["RawMeat"] + 1
When you restart the game, you should reset the Dialogue System's variables. If you are using the save system:
Code: Select all
PixelCrushers.SaveSystem.ResetGameState();
Code: Select all
DialogueManager.ResetDatabase();
Re: Thanks!
Great!It worked as I expected after I changed my "InitialFloatValue" to your "SetVariable" code in my C#(Guess I get it wrong about the "InitialFloatValue", even though it did changed the value showed on the DialogueEditor page, and it doesn't help in changing the actual values).Thank you Tony! You really made my day!