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

Announcements, support questions, and discussion for Quest Machine.
Post Reply
mroshaw
Posts: 96
Joined: Wed Jan 19, 2022 4:10 am

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

Post 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!
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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.)
mroshaw
Posts: 96
Joined: Wed Jan 19, 2022 4:10 am

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

Post by mroshaw »

Gotcha, thanks again Tony. I've written a little helper Monobehaviour to handle it.

Great stuff!
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Thanks!
vectorfrog
Posts: 86
Joined: Mon May 02, 2022 12:16 am

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

Post 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!
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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.
vectorfrog
Posts: 86
Joined: Mon May 02, 2022 12:16 am

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

Post 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.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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.)
Post Reply