Mini Map marker icons for quests: ? and !

Announcements, support questions, and discussion for the Dialogue System.
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Mini Map marker icons for quests: ? and !

Post by supadupa64 »

I have a minimap and it works great, except I've been trying to figure out a way to make my dialogue system work with it for quests. Here's what i have:
minimap_icon.jpg
minimap_icon.jpg (58.56 KiB) Viewed 2378 times
Here's what I'm going for:

"!" is enabled on mini map to show the player there is a quest there available. Player accepts quest, "!" goes away. When quest is completed and not yet turned in, the location of the successful quest drop off point is a "?" at the location on the mini map. When you turn it in the "?" goes away. If another quest is available, the "!" shows up where you can get the quest.

Is there an integration that you know of that works well with Dialogue Systems? I've been eyeing a few.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Mini Map marker icons for quests: ? and !

Post by Tony Li »

Hi,

NJG MiniMap and KGFMapSystem both work well. I use NJG MiniMap in one of my own projects. I'm also planning to add DMMap integration to the Dialogue System, but it's not ready yet.
bohnstudios
Posts: 68
Joined: Sun Aug 16, 2015 3:01 am
Location: St. Louis, MO
Contact:

Re: Mini Map marker icons for quests: ? and !

Post by bohnstudios »

I personally had issues with NJG and KGF including install errors. I think there's an easier way. Your ? and ! are most likely (or should be) on a "minimap" or "map" layer in your inspector window. You can use the same concept as when you disable the player controls on a dialogue conversation. Use this same technique to turn your quest items/icons on your map on and off. You'll probably need to play around with it to get a hang of how it works, but once you do, you'll find that there's a million different things you can do with the overall concept.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Mini Map marker icons for quests: ? and !

Post by Tony Li »

Yup. The NJG MiniMap and KGFMapSystem integrations are essentially custom versions of the SetActive() sequencer command. If you don't want to use either of those products, then you could handle it like @bohnstudios suggested. Give your quest locations (e.g., quest givers) two child GameObjects -- a question mark and an exclamation mark -- on your map layer. Then use the Sequence field to set them active or inactive:
  • Dialogue Text: "Pick up my laundry."
  • Script: ShowAlert("New Quest: Pick Up Laundry")
  • Sequence: SetActive(Boss/ExclamationMark, false); SetActive(Dry Cleaners/QuestionMark, true)
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Mini Map marker icons for quests: ? and !

Post by supadupa64 »

At first I was trying the setactive() sequence commands, but I don't see how this would show up on a mini map. I am using https://www.assetstore.unity3d.com/en/#!/content/33729 right now. I can set a marker for any object, but you can see the problem. It doesn't communicate with Dialogue System on the mini map. If I was using an object (!?) to be over the head of the quest giver, then I guess that would be simple to show and hide. But to show up on the minimap though is another situation.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Mini Map marker icons for quests: ? and !

Post by Tony Li »

You can still put your MapMarker components on child GameObjects to make them easier to find, but you'll need to write a custom sequencer command to set MapMarker.isActive. I'm in the process of publishing version 1.6.1 of the Dialogue System right now. If I have time after that, I'll post the custom sequencer command here.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Mini Map marker icons for quests: ? and !

Post by Tony Li »

Okay, save this script as SequencerCommandMiniMapMarker.cs. Then use the sequencer command:

MiniMapMarker(GameObject, [active|inactive])

If you omit the second argument, it defaults to active.

Examples:
  • MiniMapMarker(Private Hart, inactive)
  • MiniMapMarker(Private Hart/OtherMarker, active)
  • MiniMapMarker(Terminal)

Code: Select all

using UnityEngine;

namespace PixelCrushers.DialogueSystem.SequencerCommands
{

    /// <summary>
    /// Sequencer command MiniMapMarker(subject, [active|inactive]).
    /// </summary>
    public class SequencerCommandMiniMapMarker : SequencerCommand
    {

        public void Start() {
            var subject = (Sequencer != null) ? GetSubject(0, Sequencer.Speaker) : null;
            var active = !string.Equals(GetParameter(1), "inactive", System.StringComparison.OrdinalIgnoreCase);
            var mapMarker = (subject != null) ? subject.GetComponent<MapMarker>() : null;
            if (mapMarker == null)
            {
                if (DialogueDebug.LogWarnings && Sequencer != null) Debug.LogWarning("Dialogue System: Sequencer: MiniMapMarker(" + GetParameters() + "): Can't find MapMarker on " + GetParameter(0));
            }
            else
            {
                if (DialogueDebug.LogInfo) Debug.Log("Dialogue System: Sequencer: MiniMapMarker(" + GetParameters() + "): Setting isActive=" + active, subject);
                mapMarker.isActive = active;
            }
            Stop();
        }
        
    }

} 
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Mini Map marker icons for quests: ? and !

Post by supadupa64 »

Great, I'll give this a go!
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Mini Map marker icons for quests: ? and !

Post by supadupa64 »

Ok, this is awesome! I really appreciate the help!

I have it setup when you go from quest to quest the little "!" appears on the minimap, totally awesome. Right now I'm trying to see if I can apply the lua command to show the "?" when the quest is ready to be turned in. I don't think that this is part of what you just created, but I figure there could be a place to put it somewhere already?

I created an invisible cube at the spawn turn in, placed the mapmarker on it with the "?" icon and created a lua command: MiniMapMarker(Ramis cube que marker). I haven't figured out where to place the lua command yet so I can display, maybe because there isn't a place to put it since I'm trying to get the "?" to show when the last item is collected (the "?" would show on the minimap when 10/10 scrolls collected).
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Mini Map marker icons for quests: ? and !

Post by Tony Li »

Hi,

(Just a clarification: MiniMapMarker() is a sequencer command, not a Lua function. It goes in the Sequence field.)

To show "?" when the quest is ready to be turned in, add a Sequence Trigger to your scrolls with these settings:
  • Trigger: OnDestroy
  • Condition: Lua condition: Variable["numscrollsfound"] >= 10
  • Sequence: MiniMapMarker(Ramis cube que marker)
(You may need to adjust the script execution order settings to Sequence Trigger runs after Increment On Destroy.)

If you really want to hold the player's hand, you can use a Dialogue System Trigger instead of a Sequence Trigger. Set it up the same, except also add an Alert Message like "All Scrolls Collected. Return to Ramis."
Post Reply