Quest Generation (Domains)

Announcements, support questions, and discussion for Quest Machine.
dlevel
Posts: 168
Joined: Wed Nov 16, 2016 6:17 pm

Re: Quest Generation (Domains)

Post by dlevel »

awesome thanks!
dlevel
Posts: 168
Joined: Wed Nov 16, 2016 6:17 pm

Re: Quest Generation (Domains)

Post by dlevel »

Some reward Suggestions:

Having the level in entity is clever but that makes it for example a level 50 monster would reward 50 exp and 50 gold if we have both reward scripts in place, usually exp/gold rewards are much different, that has an easy fix for me by adding a *10 in ORKexpRewardSystem in var exp = points * 10; and get 500 exp instead of 50, but that would make every moster give *10 in that quest giver which is not optimal for bosses/minions giving the same reward.

So I thought that we could have 2 factors inside the entity, under the level, and having for example:

level: 50
EXP Factor: 10
Currency Factor: 2

so in that monster I ll get 500 exp, 100 gold.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Generation (Domains)

Post by Tony Li »

That's a good idea. I'm thinking I'll add a few common default multipliers (XP, currency, items, and reputation) and add a few custom slots (Custom0, Custom1, etc.). Then the reward system can multiply however many points they use by the multiplier.
dlevel
Posts: 168
Joined: Wed Nov 16, 2016 6:17 pm

Re: Quest Generation (Domains)

Post by dlevel »

yeap that's even better! nice nice!
dlevel
Posts: 168
Joined: Wed Nov 16, 2016 6:17 pm

Re: Quest Generation (Domains)

Post by dlevel »

I created this script by copying the other reward for ORK scripts, and as I see you already have an ORKItemQuestAction script which I used, but it doesnt seem to work. Any idea?

Code: Select all

// Copyright © Pixel Crushers. All rights reserved.

using UnityEngine;

namespace PixelCrushers.QuestMachine.ORKSupport
{

    /// <summary>
    /// Gives currency to the ORK player equal to the point value of the quest.
    /// </summary>
    [AddComponentMenu("Pixel Crushers/Quest Machine/Third Party/ORK Framework/Generator/ORK Item Reward System")]
    public class ORKItemRewardSystem : RewardSystem
    {

        public StringField itemName = new StringField();

        public override int DetermineReward(int points, Quest quest)
        {
            var bodyText = BodyTextQuestContent.CreateInstance<BodyTextQuestContent>();
            bodyText.bodyText = new StringField(points + " " + itemName);
            quest.offerContentList.Add(bodyText);

            var itemAction = ORKGiveExpQuestAction.CreateInstance<ORKItemQuestAction>();
            itemAction.usePlayer = true;
            itemAction.operation = ORKAddRemoveOperation.Add;
            itemAction.quantity = new QuestNumber(points);
            itemAction.itemName = new StringField(itemName);
            var successInfo = quest.GetStateInfo(QuestState.Successful);
            successInfo.actionList.Add(itemAction);

            return 0;
        }

    }
}
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Generation (Domains)

Post by Tony Li »

Change this:

Code: Select all

var itemAction = ORKGiveExpQuestAction.CreateInstance<ORKItemQuestAction>();
to this:

Code: Select all

var itemAction = ORKItemQuestAction.CreateInstance<ORKItemQuestAction>();
If you inspect the generated quest, has the reward system added the BodyTextQuestContent and ORKItemQuestAction?

If it hasn't, are there any warnings or errors in the Console window?

If not, is it possible that another reward system has used up all the points so that this one isn't being called?

If the ORKItemQuestAction has been added, is the problem that it's not actually giving the reward when the quest is completed?
dlevel
Posts: 168
Joined: Wed Nov 16, 2016 6:17 pm

Re: Quest Generation (Domains)

Post by dlevel »

Ok changed it, and when I remove the ORkExp and OrkCurrency it works, if I have them it doesn't. How I set how many points each rewardsystem takes?

btw if you check ORKCurrencyRewardSystem and ORKExpRewardSystem both have

Code: Select all

var currencyAction = ORKGiveExpQuestAction.CreateInstance<...>();


shouldn't ORKCurrencyRewardSystem have:

Code: Select all

var currencyAction = ORKCurrencyQuestAction.CreateInstance<...>();
?
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Generation (Domains)

Post by Tony Li »

ORKExp doesn't take any points. When Quest Machine passes it a points value, it returns that same points value.

ORKCurrency uses all available points. When Quest Machine passes it a points value, it returns 0 points left.

You can certainly duplicate those scripts to make custom versions that use different amounts of points.

I plan to add the ability to specify the order in which reward systems are used. I'm still deciding between two approaches:

1. A priority value for each reward system.

2. Or a reorderable list on Quest Generator Entity to specify priority.

The advantage of #1 is that you don't need to fiddle with a list. Each reward system has a default priority built in.

The advantage of #2 is that you can specify different priority orders for different quest givers.

If you have any opinions, please let me know.
dlevel
Posts: 168
Joined: Wed Nov 16, 2016 6:17 pm

Re: Quest Generation (Domains)

Post by dlevel »

well priority order with some weight would be good too. So you can have multiple ItemRewards and currencyRewards etc. with some weight in them, for the max value of 100 you could have the Epic Sword with weight 1/100 and only 1 every 100 generated quests would include it in the reward list.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Generation (Domains)

Post by Tony Li »

That's a great idea. I hadn't thought of that. I'll probably need to make it a reorderable, weighted list on the Quest Generator Entity.
Post Reply