Page 1 of 1
QM version of Quest State Listener
Posted: Fri Oct 23, 2020 2:29 pm
by Ollymuk
Hi
I've been working with DS and using the Quest State Listener to listen for status changes to a quest (going Active) and then using On Enter State to enable a prefab on a quest item. Making a bit arrow appear above the quest item.
Now that I've moved to QM, the Quest State Listener doesnt work. I guess because it's using a DS database and doesn't support a QM database.
If I want a prefab to appear above a quest object, what's the right way of doing it in QM?
Olly
Re: QM version of Quest State Listener
Posted: Fri Oct 23, 2020 3:07 pm
by Ollymuk
Well, I've found that I can use the Scene Event > On Execute inspector element of the Dialogue Entry to trigger the prefab enabled state to True.
That works, but some how it doesn't feel nice.
I'd like to do it via quest triggers so that I can save my mind.
Olly
Re: QM version of Quest State Listener
Posted: Fri Oct 23, 2020 3:19 pm
by Tony Li
Hi,
Here's how to do it in Quest Machine:
The quest object should have a Quest Machine ID. If it doesn't have a Quest Giver or Quest Entity component, add a Quest Machine ID component and set the ID.
Add a Quest Indicator Manager component to the quest object. Assign the Quest Indicator UI prefab to it.
In the quest's States > Active > Actions list, add a Set Indicator action. Specify the quest object's ID, and select a quest indicator state from the list (e.g., the Talk indicator).
When you accept the quest, it will send a message to all objects that have the quest object's ID to tell its Quest Indicator Manager to show the specified indicator.
If you want to use a different image than the ones in the Quest Indicator UI prefab, make a copy of the Quest Indicator UI prefab, customize its images, and assign the copy to the quest object's Quest Indicator Manager.
Re: QM version of Quest State Listener
Posted: Fri Oct 23, 2020 3:39 pm
by Ollymuk
Thanks for that Tony.
What if my prefab is sprite based? Is there a way to assign a gameobject prefab rather than a UI prefab? Sorry, should have made that clear originally.
Olly
Re: QM version of Quest State Listener
Posted: Fri Oct 23, 2020 3:48 pm
by Ollymuk
Dont worry Tony. I'll recreate the sprite as a UI object.
Re: QM version of Quest State Listener
Posted: Fri Oct 23, 2020 4:00 pm
by Tony Li
The Quest Journal UI prefab uses SpriteRenderers, not UI Images. They can use anything, though. Each indicator is just a child GameObject. It can be a animated 3D model if you want.