Page 1 of 1
Accept Quest Event
Posted: Thu May 05, 2022 5:26 pm
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!
Re: Accept Quest Event
Posted: Thu May 05, 2022 6:21 pm
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 (44.44 KiB) Viewed 1386 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.
Re: Accept Quest Event
Posted: Thu May 05, 2022 6:29 pm
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.
Re: Accept Quest Event
Posted: Thu May 05, 2022 6:33 pm
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.
Re: Accept Quest Event
Posted: Thu May 05, 2022 7:17 pm
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.
Re: Accept Quest Event
Posted: Thu May 05, 2022 8:33 pm
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?
Re: Accept Quest Event
Posted: Thu May 05, 2022 8:45 pm
by vectorfrog
Ok, I got it working now. I was enabling/disabling the wrong object.
Thanks for the help!
Re: Accept Quest Event
Posted: Thu May 05, 2022 8:47 pm
by Tony Li
Glad to help!