ORK integration

Announcements, support questions, and discussion for Quest Machine.
Post Reply
User avatar
Tony Li
Posts: 21636
Joined: Thu Jul 18, 2013 1:27 pm

Re: ORK integration

Post by Tony Li »

Oops, sorry, I thought we were in the Dialogue System section. Please check the Quest Machine Extras page. I just put the updated package there.
dlevel
Posts: 150
Joined: Wed Nov 16, 2016 6:17 pm

Re: ORK integration

Post by dlevel »

Hey Tony, so I had time to fire up the latest version of Quest machine. I see rewards not working for me.

ORK Rewards doesn't seem to work, I set the probability to the max (1) for the rewards I want and using the new rewards system list. I used all 3 of them (Currency/item/EXP) or just 1 and still, quests don't give any rewards.
User avatar
Tony Li
Posts: 21636
Joined: Thu Jul 18, 2013 1:27 pm

Re: ORK integration

Post by Tony Li »

Darn, it's not a bug in the ORK Support package per se, but a bug in the latest version of Quest Machine. I'll be submitting an update to fix it tomorrow. In the meantime, this updated ORK Support package will avoid the bug:

QM_ORK_Support_2019-03-27.unitypackage

Here's the old demo package should you want to check it out: QM_ORK_Demo_2019-03-27.unitypackage

The bug is that RewardSystems now have two DetermineReward methods:

DetermineReward(int points, Quest quest)

and the new:

DetermineReward(int points, Quest quest, EntityType entityType)

which some devs wanted to be able to vary rewards based on the target entity type.

In the base RewardSystem class, my intent was for the new 3-parameter method to fall back to the old 2-parameter one if the new one isn't defined. But I accidentally flipped the logic so the 2-parameter one doesn't get called.

I updated ORKExpRewardSystem and ORKCurrencyRewardSystem to use the 3-parameter method so it avoids this whole issue. The ORK Support package doesn't have an ORKItemRewardSystem class. Did you write that? If so, just add the third parameter; you don't have to do anything with it.
dlevel
Posts: 150
Joined: Wed Nov 16, 2016 6:17 pm

Re: ORK integration

Post by dlevel »

yeap it works, but now when I have both ORK EXP and ORK Currency rewards with max probability, it doesn't have both as it should but only the 1 of them ( the first one).

Also I can't find where do I set the min-max required monsters even if the NPC finds only 1 for the generated quests
User avatar
Tony Li
Posts: 21636
Joined: Thu Jul 18, 2013 1:27 pm

Re: ORK integration

Post by Tony Li »

dlevel wrote: Thu Mar 28, 2019 7:38 amyeap it works, but now when I have both ORK EXP and ORK Currency rewards with max probability, it doesn't have both as it should but only the 1 of them ( the first one).
Have you tried putting ORKExpRewardSystem first? If you put ORKCurrencyRewardSystem first, it will use up all the points, leaving none for ORKExpRewardSystem.

ORKExpRewardSystem consumes no points; it just gives exp equivalent to the number of available points. ORKCurrencyRewardSystem consumes all points and gives that amount of currency.
dlevel wrote: Thu Mar 28, 2019 7:38 amAlso I can't find where do I set the min-max required monsters even if the NPC finds only 1 for the generated quests
Set the action's Completion Conditions > Required Value. This value now specifies the minimum even if the NPC finds only 1. For example, the action below will always require at least 3, even if the NPC only sees 1:

https://www.pixelcrushers.com/quest_mac ... dValue.png
dlevel
Posts: 150
Joined: Wed Nov 16, 2016 6:17 pm

Re: ORK integration

Post by dlevel »

ok perfect, one more thing and I'm good to go.

my OrkItemRewardSystem works fine but I want to make it always give max 1 item, no matter what level is the entity or how many of them are in the quest.

here is the script (which is the same as currency one)

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, EntityType entityType)
        {
            var bodyText = BodyTextQuestContent.CreateInstance<BodyTextQuestContent>();
            bodyText.bodyText = new StringField(points + " " + itemName);
            quest.offerContentList.Add(bodyText);

            var itemAction = ORKItemQuestAction.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: 21636
Joined: Thu Jul 18, 2013 1:27 pm

Re: ORK integration

Post by Tony Li »

Change this line:

Code: Select all

itemAction.quantity = new QuestNumber(points);
to this:

Code: Select all

itemAction.quantity = new QuestNumber(1);
dlevel
Posts: 150
Joined: Wed Nov 16, 2016 6:17 pm

Re: ORK integration

Post by dlevel »

This is what I did but didn't work. I paste the code that worked if anyone needs it:

Code: Select all

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();
        private int itemPoints = 1;
        public override int DetermineReward(int points, Quest quest, EntityType entityType)
        {
            
            var bodyText = BodyTextQuestContent.CreateInstance<BodyTextQuestContent>();
            bodyText.bodyText = new StringField(itemPoints + " " + itemName);
            quest.offerContentList.Add(bodyText);

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

            return 0;
        }

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

Re: ORK integration

Post by Tony Li »

Thanks for posting that. Strange that the literal number 1 didn't work; maybe it was a typo. Anyway, I'm glad it's working now! :-)
dlevel
Posts: 150
Joined: Wed Nov 16, 2016 6:17 pm

Re: ORK integration

Post by dlevel »

My quests generate perfectly now, what I'm missing is that when I finish a quest and return to the NPC and press the quest to complete it, it completes instantly, without a new UI screen saying the rewards and having me press a "complete" button to make it more natural finishing quests. Is there any way to do that?
Post Reply