Hey, I have an issue with a number variable that I can't figure out.
I have a variable "Gold", which I set to 3. I then have a dialogue entry: "Here's a bag of gold", which should be available whenever your Gold variable is equal or greater than 1.
The condition on the dialogue entry is:
Variable["Gold"] >=1
And the script is:
Variable["Gold"] = Variable["Gold"] - 1
However, when I tested this, for some reason is is deducting 2 Gold each time you pick that dialogue entry.
Have I made a really obvious mistake or is something weird going on?
Weird problem with number variable
Re: Weird problem with number variable
Is it possible that a prior node is also decrementing Gold? Temporarily set the Dialogue Manager's Debug Level to Info. This should log all of the Script fields that nodes run.
-
- Posts: 194
- Joined: Mon Jul 01, 2019 1:21 pm
Re: Weird problem with number variable
Not that I can see. I made a fresh conversation with only one node and got the same thing. Doesn't look like anything unusual showing up in info, either.
Re: Weird problem with number variable
Maybe something outside the conversation is changing the value of "Gold"?
You're not assigning a string value to the variable are you? Like:
It's a long shot, but it's happened before.
If you get totally stuck, please feel free to send me an example scene or reproduction steps.
You're not assigning a string value to the variable are you? Like:
Code: Select all
Variable["Gold"] = "3"
If you get totally stuck, please feel free to send me an example scene or reproduction steps.
Re: Weird problem with number variable
The player response menu button was clicking itself twice. The Dialogue System automatically assigns an event handler to the button's OnClick() event. You don't need to assign the event yourself. By doing so, it caused the response to play twice.