Set value for a Variable of a Dialogue before Start it.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
hoangcuongzk1
Posts: 1
Joined: Tue Jul 25, 2023 6:04 am

Set value for a Variable of a Dialogue before Start it.

Post by hoangcuongzk1 »

I have a prefab UI, it contains a Dialogue. This Dialogue has a "Coin" Variable. And a condition on the converstation need to use it.
My Player kills enemy and collect coin. I am using 'DialogueTriggerSystem' to change 'Coin' value. But when player meet NPC and open the Dialogue. Even player kills 100 enemies, the 'Coin' Variable equals 0.
How i change value of a Variable before Dialogue contains it not yet open ?

(My player does not meet NPC first, after kill many enemies, he will meet NPC, at the moment the dialogue start)
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: Set value for a Variable of a Dialogue before Start it.

Post by Tony Li »

Hi,

Let's first make sure your Coin variable is incrementing. Use the Dialogue Editor's Watches tab or the Variable Viewer window.

Here's an example scene:

DS_CoinExample_2023-07-25.unitypackage
Post Reply