Setting boolean from Dialogue database

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
chrislow19
Posts: 34
Joined: Mon Dec 30, 2019 4:26 pm

Setting boolean from Dialogue database

Post by chrislow19 »

Hi Tony, quick question. I'm trying to trigger a boolean (Has been to Tavern, default is false) set in the dialogue database from the scene warp object that takes me to the tavern. I'm using the dialogue system trigger and setting boolean to true on trigger enter 2d. I have an NPC dialogue option set to only play when that boolean is set to true. It seems that when I take my player back to the scene the NPC is in, the dialogue option isn't available.

One other unrelated question, does a timed trigger component only work on the object it is a component of? Is there a similar component in the package that can apply to a separate object from the one it is a component of?

Thanks!
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting boolean from Dialogue database

Post by Tony Li »

Hi,
chrislow19 wrote: Wed Jan 08, 2020 8:44 amI'm trying to trigger a boolean (Has been to Tavern, default is false) set in the dialogue database from the scene warp object that takes me to the tavern. I'm using the dialogue system trigger and setting boolean to true on trigger enter 2d. I have an NPC dialogue option set to only play when that boolean is set to true. It seems that when I take my player back to the scene the NPC is in, the dialogue option isn't available.
How are you setting the boolean?
Does the Dialogue Manager survive scene changes? (This is the default behavior; just making sure you haven't changed it.)
How are you changing scenes?
chrislow19 wrote: Wed Jan 08, 2020 8:44 amOne other unrelated question, does a timed trigger component only work on the object it is a component of? Is there a similar component in the package that can apply to a separate object from the one it is a component of?
If you're talking about the TimedEvent component, it has a UnityEvent called OnTimeReached(). While the TimedEvent component does sit on a specific GameObject, you can assign any other GameObject(s) to the OnTimeReached() UnityEvent itself.
chrislow19
Posts: 34
Joined: Mon Dec 30, 2019 4:26 pm

Re: Setting boolean from Dialogue database

Post by chrislow19 »

Hi there,

These are my settings at a glance:
Untitled-5.png
Untitled-5.png (3.97 KiB) Viewed 1032 times
Untitled-7.png
Untitled-7.png (81.42 KiB) Viewed 1032 times
And i'm running this on the scene warp object in the other scene actually:
Untitled-8.png
Untitled-8.png (83.19 KiB) Viewed 1032 times

Lastly, the Dialogue System Saver is set to Save across scene changes.


Edit: The "Woo boy!" is the one not displaying when i hit that trigger. I still get only the "No, Sorry" option.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting boolean from Dialogue database

Post by Tony Li »

It looks like you have an extra right-parenthesis at the end of the Conditions on the "Hell yeah" node. Try deleting it. (This is probably also reporting an error in the Console window.)

Also, depending on how you've set things up, it's possible that the ScenePortal will change scenes before the Dialogue System Trigger runs, since they both react to OnTriggerEnter. In this special case, since you want to make sure the Dialogue System Trigger runs first, set the ScenePortal's Required Tag to a blank string. On the Dialogue System Trigger, select Add Action > OnExecute() Event. Configure the OnExecute() event to call the ScenePortal's UsePortal() method.
chrislow19
Posts: 34
Joined: Mon Dec 30, 2019 4:26 pm

Re: Setting boolean from Dialogue database

Post by chrislow19 »

Hi Tony, all of that worked. But they all worked together, trying one at a time didn't fix it. For future reference, if there's a blank "Required" tag, the OnExecute() function will be required? For example: if i wanted an NPC to follow me through a scene change?

I appreciate the support!
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting boolean from Dialogue database

Post by Tony Li »

chrislow19 wrote: Wed Jan 08, 2020 9:17 pmHi Tony, all of that worked. But they all worked together, trying one at a time didn't fix it.
Great! They were two separate issues; both needed to be fixed. Glad it's working now.
chrislow19 wrote: Wed Jan 08, 2020 9:17 pmFor future reference, if there's a blank "Required" tag, the OnExecute() function will be required? For example: if i wanted an NPC to follow me through a scene change?
Yes, that's correct. Since the Player is tagged "Player", when the Player enters the ScenePortal's trigger it won't match the Required Tag (which is a blank string), so it won't activate the portal automatically. You'll have to activate the portal manually by calling the UsePortal() method like you did with the OnExecute() event.
chrislow19
Posts: 34
Joined: Mon Dec 30, 2019 4:26 pm

Re: Setting boolean from Dialogue database

Post by chrislow19 »

Excellent! Thank you very much again!
Post Reply