Page 1 of 1

Setting boolean from Dialogue database

Posted: Wed Jan 08, 2020 8:44 am
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!

Re: Setting boolean from Dialogue database

Posted: Wed Jan 08, 2020 9:07 am
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.

Re: Setting boolean from Dialogue database

Posted: Wed Jan 08, 2020 8:40 pm
by chrislow19
Hi there,

These are my settings at a glance:
Untitled-5.png
Untitled-5.png (3.97 KiB) Viewed 1036 times
Untitled-7.png
Untitled-7.png (81.42 KiB) Viewed 1036 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 1036 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.

Re: Setting boolean from Dialogue database

Posted: Wed Jan 08, 2020 8:58 pm
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.

Re: Setting boolean from Dialogue database

Posted: Wed Jan 08, 2020 9:17 pm
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!

Re: Setting boolean from Dialogue database

Posted: Wed Jan 08, 2020 9:22 pm
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.

Re: Setting boolean from Dialogue database

Posted: Wed Jan 08, 2020 10:50 pm
by chrislow19
Excellent! Thank you very much again!