Talk to the next quest giver?

Announcements, support questions, and discussion for Quest Machine.
Post Reply
bnd10706
Posts: 3
Joined: Thu Aug 22, 2019 4:18 pm

Talk to the next quest giver?

Post by bnd10706 »

Is there a tutorial out there to do a long dialogue quest?
I want to a simple quest with several steps.

For instance, talk to the captain who says maybe private so and so has a task. you go do the tasks for the private who then says report back to the captain.

I am having a hard time setting up how to trigger the 2nd discussion.

I can have the captain give the quest, but the private just gives you the basic response.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Talk to the next quest giver?

Post by Tony Li »

Hi,

In the Demo scene, the Villager's third quest (deliver food to the Pirate) is an example of talking to more than one quest NPC.

This quest has a prerequisite that the Harvest Carrots quest is complete. To play the third quest, you'll either need to complete the Harvest Carrots quest or delete the prerequisite.
bnd10706
Posts: 3
Joined: Thu Aug 22, 2019 4:18 pm

Re: Talk to the next quest giver?

Post by bnd10706 »

I appreciate it! I just watched the videos. I guess I need to watch the demo one.

Is there a demo of how to integrate my current reward system?

For example, I have a script to give exp or an item or money if you complete a quest?
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Talk to the next quest giver?

Post by Tony Li »

Hi,
bnd10706 wrote: Thu Aug 22, 2019 9:55 pmI appreciate it! I just watched the videos. I guess I need to watch the demo one.
I was talking about the Demo scene included in Quest Machine.
bnd10706 wrote: Thu Aug 22, 2019 9:55 pmIs there a demo of how to integrate my current reward system?

For example, I have a script to give exp or an item or money if you complete a quest?
There are two ways:

1. Use one of the built-in actions. Add it to the Actions section of your quests (typically the Successful > Actions section). For example, you can use the Activate GameObject quest action to activate a GameObject related to a quest, or the Message quest action to send a message using Quest Machine's Message System. You can configure your reward system to listen for the message.

2. Or write your own quest actions. There are starter template scripts. Look in Quest Machine's Templates folder. Make a copy of the quest action template and customize it where the comments indicate. Then you should be able to add it to your quest's Actions list. If you're making procedurally-generated quests, then after making your quest action script make a copy of the reward system template and customize it to add a copy of your quest action where the comments indicate.

If you have any of the third-party assets that Quest Machine has integrations with, such as Inventory Engine, you can take a look at the integrations to see examples of everything above.
bnd10706
Posts: 3
Joined: Thu Aug 22, 2019 4:18 pm

Re: Talk to the next quest giver?

Post by bnd10706 »

No I dont have any 3rd party integration.

I built my own inventory system, and I started my own dialogue system and quest system. While it worked, it did not do everything,

I decided to buy this because i wanted it to be robust and I did not want to recode everything.

Its just so different than what I had, I am having a hard time figuring out how I am going to integrate it..
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Talk to the next quest giver?

Post by Tony Li »

I hear you. It may be different, but the steps to integrate it end up being fairly short.

Here's an example from the Inventory Engine integration. This script defines a quest action that adds or removes items from the player's inventory:

AddInventoryEngineItemQuestAction.cs

Code: Select all

using UnityEngine;
using PixelCrushers.InventoryEngineSupport;
using PixelCrushers.QuestMachine

public class AddInventoryEngineItemQuestAction : QuestAction
{
    public StringField inventoryName = new StringField();
    public StringField itemName = new StringField();
    public QuestNumber amount = new QuestNumber();
}
    public override string GetEditorName()
    {
        var x = amount.GetValue(quest);
        return (x >= 0) ? ("Inventory Engine add " + x + " " + itemName + " to " + inventoryName) : ("Inventory Engine remove " + -x + " " + itemName + " from " + inventoryName);
    }

    public override void Execute()
    {
        base.Execute();
        var x = amount.GetValue(quest);
        if (x >= 0)
        {
            InventoryEngineUtils.mmAddItem(inventoryName.value, itemName.value, x);
        }
        else
        {
            InventoryEngineUtils.mmRemoveItem(inventoryName.value, itemName.value, -x);
        }
    }
}
You can see that it's a fairly short script. Your own script will probably be about the same length. Start by making a copy of QuestActionTemplate.cs and customizing it.

When that script is in the project, you can add it to the Actions section of a quest. In the screenshot below, the Actions section already contains two of these actions. The first one gives 1 blue armor to the player. The second one removes 3 apples from the player.

addIEAction.png
addIEAction.png (15.44 KiB) Viewed 974 times
Post Reply