Action in Inactive node are not working.

Announcements, support questions, and discussion for Quest Machine.
Post Reply
User avatar
ds2497
Posts: 55
Joined: Wed Jun 14, 2023 2:13 am

Action in Inactive node are not working.

Post by ds2497 »

I recently started a project using Dialogue for Unity, Love/Hate, and Quest Machine. It's fun to explore these plugins and understand how they work!

I have a question about Quest Machine, and here is my scenario:

I have an NPC named Tom in Town A. When the player activates a quest, I want Tom to show up and meet the player in Town B. To achieve this, I tried to create an action in the Active section of the "Meet" node, and I set TomB (a copy of Tom from Town A) to be activated. However, it's not working accross scenes.

I want to know:
A. How to activate TomB in the Town B scene.
B. How to hide TomB before the player accepts the quest.
C. I'm wondering why deactivating an object is not working in the Inactive section of a node but works in the WaitingToStart section of a Quest.

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

Re: Action in Inactive node are not working.

Post by Tony Li »

Hi,

Actions run when a node transitions into a new state. Since quest nodes generally start in the Inactive state, they won't play their inactive actions unless you manually change the node's state back to inactive (e.g., using a Set Quest Node State quest action).

Since you're using the Dialogue System, in Town B you could leave TomB inactive. Then add a Dialogue System Trigger set to OnSaveDataApplied. OnSaveDataApplied is the same as OnStart except it will wait for the save system to finish updating the scene with previously-saved data if it's loading a saved game or coming from another using using any of these scene changing methods.

In the Dialogue System Trigger, set the Conditions > Lua Conditions to require:

Code: Select all

GetQuestNodeState("your-quest", "Meet") == "active
Then select Add Action > Set GameObjects Active/Inactive or OnExecute() UnityEvent. Then configure it to activate TomB.
User avatar
ds2497
Posts: 55
Joined: Wed Jun 14, 2023 2:13 am

Re: Action in Inactive node are not working.

Post by ds2497 »

It works! Thank you very much!
User avatar
Tony Li
Posts: 22098
Joined: Thu Jul 18, 2013 1:27 pm

Re: Action in Inactive node are not working.

Post by Tony Li »

Glad to help!
Post Reply