Accept Quest Event

Announcements, support questions, and discussion for Quest Machine.
Post Reply
vectorfrog
Posts: 86
Joined: Mon May 02, 2022 12:16 am

Accept Quest Event

Post by vectorfrog »

Hi again, is there an event that I can handle when a quest is very first accepted? I see that I can have an event for while the quest is active, but does that execute more than once, while the quest is in an active state? What I am trying to accomplish is once a quest is accepted, to then add markers on my map relating to that quest, so I'm thinking that handling an event is the way to go for this but can't seem to find anything. I'm sure I missed it somewhere. Thanks!
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Accept Quest Event

Post by Tony Li »

Hi,

A good way to activate markers is to use the quest's States > Active > Actions section. For example, in the demo's Pesky Rabbits quest, I could add this action:

activateMarkers.png
activateMarkers.png (44.44 KiB) Viewed 1390 times

These actions will run when the quest becomes active.

If I were using the save system, I'd also want to set up an Active Saver component to save the active/inactive state of the 'Rabbit Markers' GameObject.

If you don't want to just activate a GameObject, you can write a custom action to do whatever you want. Duplicate QuestActionTemplate.cs and fill in your code where the comments indicate.
vectorfrog
Posts: 86
Joined: Mon May 02, 2022 12:16 am

Re: Accept Quest Event

Post by vectorfrog »

What I did, and seems to be working is for the quest Start node True state, I execute/handle an event. I'm not sure if this is the best way though. I do like your approach but my game objects are already active, I'm just adding notations to the map to make the player aware of them.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Accept Quest Event

Post by Tony Li »

That's totally fine, too. The quest's main Active state and the Start node's Active and True states all run when the quest becomes active. And the UnityEvent action is exactly for purposes like that.
vectorfrog
Posts: 86
Joined: Mon May 02, 2022 12:16 am

Re: Accept Quest Event

Post by vectorfrog »

After thinking about it, I need a way to save these markers also. In that case they would need to be game objects with a saver component on it, is that right? Then I can use the Activate/Deactivate GameObject Action I think.
vectorfrog
Posts: 86
Joined: Mon May 02, 2022 12:16 am

Re: Accept Quest Event

Post by vectorfrog »

I am trying to set up the Action to Activate/Deactivate a game object but running into a problem. I have the Action set up in the Active State of the quest, and a game object in my scene that is initially set to inactive. I must have missed something somewhere because it is not activating the game object when the player accepts the quest. Does the game object need a specific component?
vectorfrog
Posts: 86
Joined: Mon May 02, 2022 12:16 am

Re: Accept Quest Event

Post by vectorfrog »

Ok, I got it working now. I was enabling/disabling the wrong object.

Thanks for the help!
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Accept Quest Event

Post by Tony Li »

Glad to help!
Post Reply