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!
Setting boolean from Dialogue database
Re: Setting boolean from Dialogue database
Hi,
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?
How are you setting the boolean?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.
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?
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 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?
-
- Posts: 34
- Joined: Mon Dec 30, 2019 4:26 pm
Re: Setting boolean from Dialogue database
Hi there,
These are my settings at a glance: And i'm running this on the scene warp object in the other scene actually:
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.
These are my settings at a glance: And i'm running this on the scene warp object in the other scene actually:
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
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.
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.
-
- Posts: 34
- Joined: Mon Dec 30, 2019 4:26 pm
Re: Setting boolean from Dialogue database
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!
I appreciate the support!
Re: Setting boolean from Dialogue database
Great! They were two separate issues; both needed to be fixed. Glad it's working now.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.
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 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?
-
- Posts: 34
- Joined: Mon Dec 30, 2019 4:26 pm
Re: Setting boolean from Dialogue database
Excellent! Thank you very much again!