Page 1 of 1
Quest Machine MiniMap Integration
Posted: Fri Jan 01, 2021 12:57 pm
by DQHomicide
Hi all. new guy here, and a little lost with this Mammoth tool (thats a good thing)
Actually, pretty cool stuff, but , i am at a point now where i wish to have icons on my mini map for quest givers, or direction to quests themselves.
I honestly have no idea where to begin. i did do a search here in the forums, but the only info i found was related to QuestDialog. Is this the same?
If there is anyone who could point me to an article, video or anything that touches on this, i would be very greatful. Ty.
Re: Quest Machine MiniMap Integration
Posted: Fri Jan 01, 2021 1:57 pm
by Tony Li
Hi,
Here are two ways to manage minimap icons:
1. Assuming your existing minimap system has a way to turn icons on and off, your quests can use a Scene Event action or custom quest action to turn them on and off.
2. Or you can hook into the existing quest indicator system.
For #1:
For #2:
- Quest Machine has 5 built-in types of UIs:
- Quest Dialogue UI: Used by quest givers to show offer text, quest hand-ins, etc.
- Quest Journal UI: Window showing the details of the player's active and completed quests.
- Quest HUD: Onscreen summary of active quests.
- Quest Alert UI: Informational messages that pop up onscreen for a duration, such as "Task completed. Return to NPC."
- Quest Indicators: Typically shown as overhead images to indicate that a quest giver wants to talk.
You can use quest indicators for other things, such as showing an overhead image on kill quest targets.
- When a GameObject (e.g., quest giver) has a quest indicator, it's managed by a QuestIndicatorManager script that figures out what indicator image to show. The QuestIndicatorManager manages another script called QuestIndicatorUI that actually shows the indicator image. Look at any of the NPCs, such as the Villager, in the Demo scene, to see how it's set up. Both of these scripts are subclassable. You can make a subclass of QuestIndicatorUI that also sets your minimap icon. For example, the subclass might look like:
Code: Select all
public class CustomQuestIndicatorUI : QuestIndicatorUI
{
public override void SetIndicator(int index, bool value)
{
base.SetIndicator(index, value);
// If requested to set the "Interact" indicator, also set the minimap icon:
if (index == (int)QuestIndicatorState.Interact)
{
GetComponentInParent<MinimapEntity>().SetMinimapIcon(value);
}
}
}
- A GameObject's QuestIndicatorManager typically points to a prefab that has a QuestIndicatorUI script. At runtime, it instantiates the prefab. (It's also fine if the QuestIndicatorManager points to a scene object instead of a prefab.) Replace the prefab/scene object's QuestIndicatorUI with your custom subclass.
Re: Quest Machine MiniMap Integration
Posted: Fri Jan 01, 2021 2:06 pm
by Tony Li
The second part of this is making sure that minimap icons are turned back on/off when the player leaves the scene and returns; or saves the game, quits, and loads the saved game.
The easiest way to do this is to save the minimap icon's state. Quest Machine's save system is fairly easily extended. To save data, write a small "Saver" script. You can find a starter template in Plugins / Pixel Crushers / Common / Templates. Example:
Code: Select all
namespace PixelCrushers
{
public class MinimapEntitySaver : Saver
{
public override string RecordData()
{ // Return "Y" if the icon is on:
return GetComponent<MinimapEntity>().isOn ? "Y" : "N";
}
public override void ApplyData(string data)
{ // Set the icon state based on the saved data:
GetComponent<MinimapEntity>().SetMinimapIcon(data == "Y");
}
}
}
Re: Quest Machine MiniMap Integration
Posted: Fri Jan 01, 2021 2:18 pm
by DQHomicide
Well, my entire game is in a single scene at all times, so that part is easy enough to not worry about. But im still stumblin around trying to figure out the first steps mentioned. I'm a real knuclehead of sorts, i never import demo scenes, and i note that you specifaclly mentioned it as reference. I think i may break my rule of thumb this once. Thanks Tony.
Re: Quest Machine MiniMap Integration
Posted: Fri Jan 01, 2021 2:31 pm
by Tony Li
You could import the demo scene into a separate project just to see how it works. No need to keep it in your main project if you don't want to.
Since I don't know how your minimap system is designed, I tried to supply a few different options. A basic Scene Event action is probably the easiest way to go.
Re: Quest Machine MiniMap Integration
Posted: Fri Jan 01, 2021 3:39 pm
by DQHomicide
Indeed. Well, for now, i have taken your advice on the demo scene and am getting aquainted with things. Shall see how it goes.
Re: Quest Machine MiniMap Integration
Posted: Fri Jan 01, 2021 3:42 pm
by Tony Li
BTW, there's also a whole series of video tutorials that may be helpful:
https://www.pixelcrushers.com/quest-mac ... tutorials/
Re: Quest Machine MiniMap Integration
Posted: Fri Jan 01, 2021 5:44 pm
by DQHomicide
Yea, this stuff is awsome, and its starting to click. Thanks for the links, the help, and the plugin
. Amazing stuff.
Re: Quest Machine MiniMap Integration
Posted: Fri Jan 01, 2021 6:49 pm
by Tony Li
Glad to help!