Thanks Very Much For you Answer in private
can you please tell me how to use Script field for change a variable value...
Script field And Varible Value
Re: Script field And Varible Value
Hi,
Let's say you have a variable named "Dollars".
To create this variable, open your dialogue database in the Dialogue Editor. Go to the Variables section. Click the "+" button and select Number. Name the variable "Dollars". You can set an initial value such as 30.
If you want to give the player 10 dollars in a dialogue entry, click the "..." next to the Script field. Then click "+". From the dropdowns, select Variable > Dollars > Add > 10. Then click Apply. Your dialogue entry might then have fields like this:
Then go back to your dialogue entry, and add a line to the Script field:
Let's say you have a variable named "Dollars".
To create this variable, open your dialogue database in the Dialogue Editor. Go to the Variables section. Click the "+" button and select Number. Name the variable "Dollars". You can set an initial value such as 30.
If you want to give the player 10 dollars in a dialogue entry, click the "..." next to the Script field. Then click "+". From the dropdowns, select Variable > Dollars > Add > 10. Then click Apply. Your dialogue entry might then have fields like this:
- Dialogue Text: [Player] "Give me $10."
- Script:
Code: Select all
Variable["Dollars"] = Variable["Dollars"] + 10
Then go back to your dialogue entry, and add a line to the Script field:
- Dialogue Text: [Player] "Give me $10."
- Script:
Code: Select all
Variable["Dollars"] = Variable["Dollars"] + 10; UpdateTracker()
Re: Script field And Varible Value
thank you very much .
He's working just like i want
He's working just like i want
Re: Script field And Varible Value
Great! Happy to help.
Re: Script field And Varible Value
Hi again
Is there a way I can Show Variable value in unity text UI..and not in Quest Tracker HUD
Is there a way I can Show Variable value in unity text UI..and not in Quest Tracker HUD
Re: Script field And Varible Value
Yes. When you assign a string to a Text component, run it through FormattedText.ParseCode first.
Instead of this:
use this:
This will replace all [var=variable] and [lua(code)] tags with their current values.
Instead of this:
Code: Select all
public UnityEngine.UI.Text myText;
...
myText.text = "You have $[var=Dollars]";
Code: Select all
myText.text = FormattedText.ParseCode("You have $[var=Dollars]");