Page 14 of 26

Re: ORK integration

Posted: Sat Aug 29, 2020 11:45 am
by dlevel
Journal:

https://ibb.co/2dxpqZT

bugged quest (1 of the first 2 that are bugged): https://ibb.co/ys8SdP7

New Quests (that are fine): https://ibb.co/NWXrWfZ


quest giver (only the 2 new are there): https://ibb.co/sqjX3r6

Re: ORK integration

Posted: Sat Aug 29, 2020 11:54 am
by Tony Li
I don't understand what's bugged about the quest.

In the journal, it looks like Knights and Spiders are showing as completed quests.

The dialogue UI only shows options to talk about Skulls and Wolves, which are active.

So, from what I understand of those pictures, everything is working as intended. What am I missing?

What version of Quest Machine are you using? Can you back up your project and update to 1.2.9 if you're not already on it?

Re: ORK integration

Posted: Sat Aug 29, 2020 12:00 pm
by dlevel
That the player never got a reward from these 2 completed quests since they never arrived to the quest giver, yes will do the update and come back I think I'm on 1.2.8.

Re: ORK integration

Posted: Sat Aug 29, 2020 12:17 pm
by Tony Li
Got it. I think I understand now. The quest went into the success state as soon as the player killed the 100th Spider.

Let me know if 1.2.9 fixes that. Otherwise we'll need to figure out what's presumably sending the Discussed Quest message before they player actually discusses the quest with the NPC.

Re: ORK integration

Posted: Sat Aug 29, 2020 12:35 pm
by dlevel
Yeap, I'm on 1.2.9, also weird thing is that I turned the Quest journal to not show finished quests, but these 2 completed ones are still there


edit: ah wait, here is what I changed "Completed Quest Dialogue", turned it to Show No Quests, it was on Show Completed Quests before, which again, it didn't show these 2 finished once. BTW can I stop showing the completed quests on Journal?

edit 2: found it, Remember Completed Quests in player's journal, which is disabled but these 2 completed quests still showing, the not bugged ones when they are completed they are not appearing in journal.

some more screenshots if it helps:

Player journal component in runtime (first 2 are the completed ones):

https://ibb.co/MRwNx8H

counter of the completed quest:

https://ibb.co/bWN0XKP

Re: ORK integration

Posted: Sat Aug 29, 2020 2:02 pm
by Tony Li
Let's figure out why

I ran this test:

1. Played Quest Machine's ORK integration demo scenes.

2. Went to "2 Field QM" and picked up Yellow Pants' generated quest to kill 4 Evil Pants.

3. Killed 4 Evil Pants. At this point, the player's quest looked like this:

orkGenerated.png
orkGenerated.png (22.47 KiB) Viewed 231716 times

4. Went to "1 Town QM" and saved the game.

5. Reloaded the game and confirmed that the player's quest looked the same. That is, it wasn't complete yet because I hadn't returned to Yellow Pants.

6. Went to "2 Field QM" and confirmed that the quest still looked the same.

7. Turned in the quest.

Unless there's something I don't understand about how you're handling day changes, I think that replicates similar steps to your project. If not, would it be possible for you to send me a reproduction project?

---

This is secondary because it sounds like the issue occurs before:

When you set the Quest Giver's "Completed Quest Dialogue Mode" to Show No Quests, then if the NPC has no active or offerable quests, it will show the "No Quests UI Contents" (e.g., "Sorry, I don't have any quests to offer.").

If it's set to Show Completed Quests, then if the NPC has no active or offerable quests, but it has at least one completed quest, it will show dialogue about the completed quest(s).

---

Side note: The Quest Journal's Remember Completed Quests checkbox doesn't do anything yet. In 1.2.10, it will keep completed quests out of the journal.

Re: ORK integration

Posted: Wed Sep 02, 2020 1:26 pm
by dlevel
Got a lot of reports from the testers of bugged quests by using Quest Generator, can't pinpoint the exact reason yet but the main idea is that people can't always return their quests (Require Return To Complete checked), I see that when the generator generates same quests before the player returns his previous ones then he can't return the previous ones:

here is one of the bugged:

https://ibb.co/Jm28rdQ

Re: ORK integration

Posted: Wed Sep 02, 2020 1:37 pm
by Tony Li
Any chance you could provide a reproduction project or reproduction steps?

In my previous reply I documented how I tried to reproduce the issue, but it worked correctly. What's different from that in your project?

Re: ORK integration

Posted: Wed Sep 02, 2020 3:02 pm
by dlevel
The "custom" part is that I don't use generate at start, but using code to generate (that checks server variables if the day has passed etc.), and I spawn empty game objects with the entities that feed the quest givers (with rigidbody and everything that works fine), if the parameters are correct it executes the GenerateQuests method from this script that you helped me create because I needed to have control as to how many number of enemies the player has to kill, even if the generator finds one (and this is how I get the counter to 100 with only 1 empty gameobject that feeds the generator):

Code: Select all

using System.Collections;
using System.Collections.Generic;
using PixelCrushers.QuestMachine;
using UnityEngine;




[RequireComponent(typeof(QuestGeneratorEntity))]
public class QuestUtilities : MonoBehaviour
{
    [Header("Monster Entity Type")]
    public EntityType monsterType;
    [Header("Amount of Kill Enemies")]
    public int minEnemies;
    public int maxEnemies;
    [Header("Quest ID to manipulate")]    
    public string questIdName;
    public string questerID;
    [Header("Quests to Add")]
    public List<Quest> quests;

    void Start()
    {
        GetComponent<QuestGeneratorEntity>().updateWorldModel += UpdateWorldModel;
    }

    void UpdateWorldModel(WorldModel worldModel)
    {
        
        foreach (var fact in worldModel.facts)
        {
            if (IsMonster(fact.entityType))
            {
                int rndEntities = Random.Range(minEnemies, maxEnemies);
                fact.count = Mathf.Max(fact.count, rndEntities);
                Debug.Log("MONSTER: " + fact.count + " " + fact.entityType.name + " in " + fact.domainType.name);                
            }
            
        }
    }

    private bool IsMonster(EntityType entityType)
    {
        var checkedEntities = new List<EntityType>();
        return IsMonsterRecursive(entityType, checkedEntities);
    }

    private bool IsMonsterRecursive(EntityType entityType, List<EntityType> checkedEntities)
    {
        if (entityType == null || checkedEntities.Contains(entityType)) return false;
        checkedEntities.Add(entityType);
        if (entityType == monsterType) return true;
        foreach (var parent in entityType.parents)
        {
            if (IsMonsterRecursive(parent, checkedEntities)) return true;
        }
        return false;
    }

    public void QuestAdd()
    {
        var generator = GetComponent<QuestGiver>();

        foreach (var quest in quests)
        {
            string questID = quest.id.text;
            if (generator.ContainsQuest(questID))
            {
                Debug.Log("Quest: " + questID + " already exists");
            }
            else
            {
                generator.AddQuest(quest);
            }
        }
    }

    public void QuestStateWaiting()
    {
        QuestMachine.SetQuestState(questIdName, QuestState.WaitingToStart, null);
        Debug.Log("Quest " + questIdName + " changed state to WaitingToStart");
    }

    public void QuestStateAbandon()
    {
        QuestMachine.SetQuestState(questIdName, QuestState.Abandoned, null);
        Debug.Log("Quest " + questIdName + " changed state to Abandoned");
    }

    public List<DomainType> domainTypes;
    //Start is called before the first frame update
    
    //Use this if the Domain is generated in runtime so it can attache a Domain entity
    public void AddMyDomains()
    {

        var generator = GetComponent<QuestGeneratorEntity>();
        var domains = new List<QuestDomain>(generator.domains);
        foreach (var domain in FindObjectsOfType<QuestDomain>())
        {
            var wantThisDomain = domainTypes.Contains(domain.domainType);
            var alreadyHaveThisDomain = domains.Find(x => x.domainType == domain.domainType) != null;
            if (wantThisDomain && !alreadyHaveThisDomain)
            {
                domains.Add(domain);
            }
        }
        generator.domains = domains.ToArray();
        //generator.GenerateQuest();     

    }

    public void GenerateQuests()
    {
        StartCoroutine("GenerateQuestCoroutine");
    }

    IEnumerator GenerateQuestCoroutine()
    {
        yield return new WaitForSeconds(1);
        var generator = GetComponent<QuestGeneratorEntity>();
        yield return new WaitForSeconds(1); generator.GenerateQuest();
        yield return new WaitForSeconds(1); generator.GenerateQuest();
    }
}

So the other key part is that same quests will be generated, and that people are not finishing their quests in the same day so maybe something colludes with the saves/loads?




edit: Irrelevant, but is there a way to run some simple code when a player accepts a new quest?

Re: ORK integration

Posted: Wed Sep 02, 2020 3:51 pm
by Tony Li
At a glance, that script looks fine. If you play in the editor and examine a generated quest in the Quest Editor window, it looks correct there, too, right?

If so, then I think quest generation is fine. Let's figure out why the player can't turn in the quest once completed.

Inspect the Quest Machine GameObject, and tick Debug Settings > Debug. When you talk to the daily quests board, it should log something like this:

Quest Machine: Knight.StartDialogue: #offerable=X #active=Y #completed=Z

Is Y correct?

If you know that you have 3 quests to turn in but Y is only 2, then the issue is with the player's quest journal or the quest giver. Does the daily quests board's ID change between days? Does anything else change between days?

If Y is 3, then maybe it's a UI problem. Maybe the UI only has enough space to show the first two quests, or something like that.