Page 1 of 1

Can't call Quest Control "SetQuestNodeState" from Trigger Event

Posted: Sat Apr 29, 2023 9:49 am
by mroshaw
Hi!

I have set up a "Trigger Event" component and a "Quest Control" component. The idea is that when the player enters the trigger area, it will set a particular Quest node state to "Completed".

I drag the Quest Control component onto a new "On Trigger Enter" event, but I cannot select "SetQuestNodeState". The only methods available are Send Message (and variants) and SetQuestCounter. Neither "SetQuestState" or "SetQuestNodeState" are available to select.

I'm following page 42 in the Quest Machine user manual.

Is there something else I need to do to be able to hook the Trigger Event up to Quest Control in order to update a Quest directly, outside of the messaging system?

Thanks again!

Re: Can't call Quest Control "SetQuestNodeState" from Trigger Event

Posted: Sat Apr 29, 2023 2:18 pm
by Tony Li
Since SetQuestState(QuestState) and SetQuestNodeState(QuestNodeState) accept QuestState and QuestNodeState values, the UnityEvent inspector can't draw them. You can call them from a script, or you can set your node's conditions to listen for a message, and then select QuestControl.SendToMessageSystem() to send that message. (Make sure to select SendToMessageSystem, not SendMessage.)

Re: Can't call Quest Control "SetQuestNodeState" from Trigger Event

Posted: Sat Apr 29, 2023 5:40 pm
by mroshaw
Gotcha, thanks again Tony. I've written a little helper Monobehaviour to handle it.

Great stuff!

Re: Can't call Quest Control "SetQuestNodeState" from Trigger Event

Posted: Sat Apr 29, 2023 5:51 pm
by Tony Li
Thanks!

Re: Can't call Quest Control "SetQuestNodeState" from Trigger Event

Posted: Tue May 23, 2023 1:59 pm
by vectorfrog
I am trying to do something similar to this. I have an enemy AI that when disposed of, sets a quest to completed. Is this the correct way of doing it?



I'd like to use the message system if that is the best way, or?


Thanks!

Re: Can't call Quest Control "SetQuestNodeState" from Trigger Event

Posted: Tue May 23, 2023 2:21 pm
by Tony Li
Yes, the message system is a fine way to do it. If you don't want to write any code, you can add a Disappear Event component and a Quest Control component to the enemy. Configure the Disappear Event to call QuestControl.SendToMessageSystem, and specify the message to send.

Re: Can't call Quest Control "SetQuestNodeState" from Trigger Event

Posted: Tue May 23, 2023 2:57 pm
by vectorfrog
I have gotten it to work, mostly.

The problem I am having now is how to get the quest state from DS? I tried using a condition but I must not have it set up right because I cant see anything from quest machine. I tried using GetQuestNodeNumberState but nothing appears in the dropdown for, I'm assuming what should be the quests?


Thanks for the help with this.

Re: Can't call Quest Control "SetQuestNodeState" from Trigger Event

Posted: Tue May 23, 2023 4:23 pm
by Tony Li
In DS, use the GetQuestNodeState("questID", "nodeID") Lua function in your dialogue entry's Conditions field. (Page 12 of the Dialogue System Support.pdf manual.)

If you want to access QM quest IDs in the Lua function dropdowns, use the QM To DS Tool. (Page 11 of the manual.)