Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Nominations have been announced for this years Unity Awards. Celebrate the wonderful projects made by your peers this year and get voting! Vote here!
    Dismiss Notice
  6. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

[RELEASED] Quest Machine: Hand-Written and Procedurally-Generated Quests

Discussion in 'Assets and Asset Store' started by TonyLi, Sep 20, 2017.

  1. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Hi @fancyferret - You can mix and match, but this is the workflow I recommend:

    1. Set up the Quest Machine and Dialogue Manager GameObjects in your first scene as described on page 4 of Quest Machine's Dialogue System Support manual.

    2. Write all of your quests in Quest Machine, and add them to your quest database asset. (I think it would be confusing to manage some of your quests in QM and some in DS.) Use the ORK conditions and actions provided by the QM ORK integration package.

    3. Use the QM To DS Tool to copy your quest info to a dialogue database asset as described on page 9 of the manual. (This step is only necessary if you want to use the Dialogue Editor's Conditions and Script dropdowns to work with quest states.)

    4. If your quest needs branching conversations, write those conversations in the Dialogue System. Use the Conditions and Script dropdowns to check and set quest states. In your conversation text, you can use Quest Machine tags such as {QUESTGIVER} or {#RatsKilled} as described on page 9 of the manual. You can also use ORK Lua functions if you want.

    5. In your Quest Machine quests, use Dialogue System Conversation Quest Content to link your conversations as shown on page 8 of the manual.

    6. For quest givers, start everything through Quest Machine's Start Dialogue ORK event.
    • If the quest giver only has one quest to offer/discuss, it will immediately show that quest. If the quest uses Dialogue System Conversation Quest Content, it will show the conversation.
    • If the quest giver has multiple quests, it will create a runtime conversation based on the quest names and the Quest Giver's Dialogue Content text. (For example: "Can you help me with these?" --> [Rabbits], [Carrots])

    Integration with Love/Hate is a lot easier. In your quests, just use the actions and conditions provided by the integration package.

    I'm working on an update to QM's ORK Support package that lets you automatically keep quest counter values synchronized with ORK inventory amounts. It's going through testing right now. I'll post it in this thread when it's ready.
     
    TeagansDad and fancyferret like this.
  2. fancyferret

    fancyferret

    Joined:
    Feb 4, 2017
    Posts:
    26

    Great! Thanks for the assistance Tony. Your tools are seriously the best!
     
    TeagansDad and TonyLi like this.
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    One thing I didn't mention, since it's kind of a late-stage task, is to skin all your UIs similarly. If a QM quest doesn't have any Dialogue System Conversation Quest Content, it will use QM's simple dialogue UI instead of the Dialogue System's. If you skin them to look similar, the player won't notice the difference.
     
    fancyferret likes this.
  4. DaviDeMo

    DaviDeMo

    Joined:
    Nov 13, 2017
    Posts:
    7
    Hi,
    I'm using this assets with ummorpg. When coming back I have problem in loading the quest in the character. The error I get is:

    Can't find quest banditQuest. Is it registered with Quest Machine?

    Well, I have a database with the quest added. Do I have to add the database in the scene somewhere?
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Hi @DaviDeMo - Yes, make sure it's assigned to the Quest Machine GameObject. For instance, this is the way it's assigned in the uMMORPG addon's example:

     
  6. DaviDeMo

    DaviDeMo

    Joined:
    Nov 13, 2017
    Posts:
    7
    Perfect! It's working :D Love it!
     
    hopeful and TonyLi like this.
  7. Ramulos

    Ramulos

    Joined:
    Feb 19, 2017
    Posts:
    43
    I have a question about the Data Synching.

    I have an inventory that's made of List<Items>, when I add an item is that when I'm supposed to call DataSourceValueChanged (newValue) from within the Inventory script? Where do I attach the Data Synchronizer script? Does the Data Synchronizer or Quest Counter scripts filter out calls for objects that were updated in the inventory but aren't counters or should I check myself before calling DataSourceValueChanged?

    Sorry for all the questions and if its supposed to be obvious but the documentation is limited on how to actually do it instead of what it is.
     
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Hi @Ramulos - In the next release, I'll fill out the documentation more.

    Here's an example that synchronizes the player's gold with a quest counter.

    First, let's say your inventory is managed in a script named ExampleInventory:

    ExampleInventory.cs (version 1)
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class ExampleInventory : MonoBehaviour
    4. {
    5.     private int m_gold;
    6.  
    7.     public int gold
    8.     {
    9.         get { return m_gold; }
    10.         set { m_gold = value; }
    11.     }
    12. }
    The ExampleInventory's gold property is the data source.

    Add a DataSynchronizer and choose a Data Source Name. In this example, I've chosen "Gold":

    dataSyncInventory0.png

    When the amount of gold changes, your inventory script needs to tell the DataSynchronizer so it can notify all listeners (e.g., quest counters). To do this, modify the code to call the DataSynchronizer's DataSourceValueChanged method:

    ExampleInventory.cs (version 2)
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class ExampleInventory : MonoBehaviour
    4. {
    5.     private int m_gold;
    6.  
    7.     public int gold
    8.     {
    9.         get { return m_gold; }
    10.         set
    11.         {
    12.             m_gold = value;
    13.             GetComponent<PixelCrushers.DataSynchronizer>().DataSourceValueChanged(value);
    14.         }
    15.     }
    16. }
    Now, whenever you change ExampleInventory's gold property, the DataSynchronizer will inform any listeners that are watching the data source named "Gold". For example, we could set up a quest counter named "Gold":

    dataSyncInventoryCounter.png

    If you only need to synchronize from ExampleInventory to listeners such as quest counters, you can stop here.

    ---

    It's possible to also synchronize the other way, although it's rarely used. To do this, hook up the On Request Data Source Change Value (Object) event to a method that sets gold to a value received from some external source. For example, I named the method SetGoldAmountFromExternalSource() and hooked it up like this:

    dataSyncInventory.png

    Here's the script:

    ExampleInventory.cs (version 3)
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class ExampleInventory : MonoBehaviour
    4. {
    5.     private int m_gold;
    6.  
    7.     public int gold
    8.     {
    9.         get { return m_gold; }
    10.         set
    11.         {
    12.             m_gold = value;
    13.             GetComponent<PixelCrushers.DataSynchronizer>().DataSourceValueChanged(value);
    14.         }
    15.     }
    16.  
    17.     public void SetGoldAmountFromExternalSource(object amount)
    18.     {
    19.         gold = (int)amount;
    20.     }
    21. }

    To change the value of gold to 42 from an external source, send a message like this:

    Code (csharp):
    1. MessageSystem.SendMessage(this, DataSynchronizer.RequestDataSourceChangeValueMessage, "Gold", 42);
     
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    uMMORPG Addon Bug Fix

    If you're using Quest Machine's uMMORPG Addon, please download the updated addon package for it here:
    QM_uMMORPG_Support_2018-08-18.unitypackage

    If you're also using the Dialogue System with uMMORPG, you can download an updated package for it from the Dialogue System Extras page.

    These updated packages will also be in Dialogue System 2.0.4 and Quest Machine 1.0.7
     
  10. Devision4

    Devision4

    Joined:
    Jan 12, 2013
    Posts:
    1,222
    hmmm any 3d demo available?
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Hi @Devision4 - Quest Machine works the same in 2D or 3D. I think there are a couple 3D examples in previous posts to this thread.

    You can also play the example that The Messy Coder went through in his Twitch interview a few weeks ago. Here's a WebGL version. The textures aren't optimized for WebGL, so it will take a bit to load. To keep the irrelevant stuff to a minimum (since the interview was focused on Quest Machine) it just uses a rudimentary bump-to-talk mechanism.

    Feel free to make your own 3D scenes, too, using the Evaluation Version. If you have any questions about using it, just let me know. If you have any of the supported third party assets (Emerald AI, ORK Framework, etc.), you can load up those examples with the evaluation version, too. Almost all of them are in 3D.
     
    Last edited: Aug 18, 2018
  12. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    Hi there @TonyLi, I'm looking into a quest system and came across this asset. Looks very useful for my needs but i'm a bit confused by the reviews. They seem to be mixed up and combined with the dialogue system reviews on the unity asset store or at least duplicated. Do we need both assets to get full use out of the system?
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Hi @AndyNeoman - You don't need both. Each is entirely self-sufficient, although they can also work together very nicely. Please feel free to try out the free evaluation versions of each one. Download links are in the Asset Store descriptions.

    The jumbled reviews are an unfortunate side effect of the Asset Store's upgrade system. If you already own the Dialogue System, you can buy Quest Machine as an "upgrade" for 50% off. The Asset Store's upgrade system shows all the reviews for the pre-upgrade asset (Dialogue System) as well as the upgrade asset (Quest Machine). I felt it was worth it to be able to provide a 50% discount to Dialogue System users.

    I'll reiterate, though, that Quest Machine is a completely independent asset. You don't need the Dialogue System, but they do work smoothly together if you want to use both. There's a Quest Machine / Dialogue System Feature Comparison Chart on the website. If you have any questions about Quest Machine, just let me know!
     
    AndyNeoman likes this.
  14. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    Thanks @TonyLi , that's good to know, do the upgrades work either way around as I think quest machine might be the one for me to get first.

    Edit:- Do they both work well with voiced cutscenes as well as text dialogue?

    Are they both able to work as inventories too?
     
    Last edited: Aug 23, 2018
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Soon. I recently set up the upgrade from Dialogue System to Quest Machine, and I wanted to give it a little time to make sure it didn't break anything. I'll set up the Quest Machine to Dialogue System upgrade with tomorrow's release of Quest Machine 1.0.7 and Dialogue System 2.0.4 (and Love/Hate 1.9.2).

    Yes, although the Dialogue System has more extensive support for cutscenes and lipsync assets. Out of the box, Quest Machine's dialogue is designed to work more simply, like World of Warcraft's with simple Accept/Decline buttons and optional audio and animation. Both are also extensible without having to modify the code.

    Neither are inventory systems. Instead, they provide integration with popular inventory system assets and assets that have inventory systems. Quest Machine integrates with the inventory systems of Inventory Pro, ORK Framework, and uMMORPG. Version 1.0.8 will add support for Inventory Engine. The Dialogue System integrates with the inventory systems of ARPG Starter Kit, Adventure Creator, Corgi, Inventory Engine, Inventory Pro, ORK, plyGame, Realistic FPS, Rog, RPG Kit, Opsive's TPC, Top-Down RPG Starter Kit, UFPS, and uMMORPG.
     
    Gregorik and AndyNeoman like this.
  16. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    Thanks for the fast a thorough feedback. As long as I can hook in to code for cutscenes that's fine. I look forward to using it, good dev support is as important as the asset and both appear spot on :).
     
    TonyLi likes this.
  17. Devision4

    Devision4

    Joined:
    Jan 12, 2013
    Posts:
    1,222
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Shawn67 and Devision4 like this.
  19. Devision4

    Devision4

    Joined:
    Jan 12, 2013
    Posts:
    1,222
    I bought QM :) Yes I know its support Compass Navigator but HUD Navi contains more feature imho. Iam planing a third person game and could use the radar from HUD navigator. Compass just has bar navigation with is more suitable for first person games.
     
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Got it. I added it to the "under consideration" category on the Quest Machine roadmap as a possibility to integrate.
     
    AndyNeoman likes this.
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    This is just a short reminder about testing evaluation versions of Pixel Crushers assets in the same project as paid version.

    If you're testing the evaluation version of Quest Machine and your project already includes the full version of Love/Hate and/or the Dialogue System for Unity, then after importing this evaluation version delete this folder:
    • Plugins/Pixel Crushers/Common/Scripts
    The evaluation versions of Pixel Crushers assets come with precompiled DLLs. The paid versions come with source scripts. The evaluation versions require the DLLs. The full versions can work with either the DLLs or the source scripts. After you’ve upgraded all assets to the full versions, you can keep the Common/Scripts folder and delete the Common/DLLs folder if you prefer.
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Quest Machine 1.0.7 Released!

    Version 1.0.7 is now available on the Unity Asset Store.

    This update adds an Animator Quest Action and Animator Saver component. It also improves the default dialogue UI so you can go back and forth between quests more nicely if the quest giver has multiple quests.

    If you're using the uMMORPG integration, please use the updated support package in this version. It fixes an important client/server sync bug.

    Version 1.0.7
    • Improved: When quest giver has multiple quests, can now navigate back to quest list in same dialogue to view other quests.
    • Added: Animator Quest Action.
    • Added: Animator Saver.
    • Fixed: Removed editor warning in EditorNote.cs.
    • uMMORPG: Fixed client/server sync bug.
     
    fancyferret likes this.
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Shawn67 likes this.
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Sep 10-17 Out of Office

    I'll be traveling September 10-17, 2018. I'll still be checking email and forums daily and will do my best to reply to support requests quickly, but responses may take a little longer than usual.
     
    Shawn67 likes this.
  25. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    I know @TonyLi might not be able to respond currently but if anyone can help it would be great. How do you go about setting up quests with no quest giver?

    I have a quest where the player needs to find his group when the game first starts (and also after certain events which can happen in game - I.e they get lost again)

    Any tips would be great. ;-)

    Andy
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Hi Andy - You can either add the quest to the player's Quest Journal at design time, or add it to an empty GameObject with a Quest Giver component on it. If you add it to the player's Quest Journal, simply set it active when you want to, or set its Autostart Conditions to start when certain conditions are true (e.g., sending a message such as "Found Group"). If you add the quest to a Quest Giver, you can call QuestGiver.GiveQuestToQuester() in a script or corresponding visual scripting action. You could call this empty GameObject "Narrator" or "Story Manager" or something like that.
     
    AndyNeoman and hopeful like this.
  27. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    That makes perfect sense, Thanks Tony.
     
  28. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    Hi @TonyLi, Is there a missing step in the tutorial for setting up the UI's? I have quests, quest database, all seem fine but no way to see them or the journal. I watched you quick start and other video but no where seems to mention how you get the ui's visible. Page 41 of the manual says they are preconfigured on the quest machine prefab and I can see they are listed but do not show in game.
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Hi @AndyNeoman - Did you set up your scene as described on page 33 of the manual? The short steps are:
    1. Add the Quest Machine prefab, which is located in Plugins ► Pixel Crushers ► Quest Machine ► Prefabs. Assign a quest database to the Quest Machine GameObject in your scene.
    2. Add a Quest Journal component to the player.
    3. Add a Quest Giver component to the NPC. Assign quests to its list.
    Page 33 describes a few optional steps, but the short list above should get it working.

    The UI Canvas in the Quest Machine prefab is set to Screen Space - Overlay. If you're playing in VR, you'll need to change it to Screen Space - Camera or World Space and assign a camera to make it visible.
     
    AndyNeoman likes this.
  30. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    Yeah, i followed those steps and also added a quest to the journal to autostart. I can see quest has started and box is green. No Ui visible however. Im not using VR. I tried setting to screen space to camera and world space still not joy. I have my own UI's in working fine. (I also removed them to see if they were causing a conflict but still no quest machine UI).
     
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Are there any warnings in the Console window / output log file?

    Are the Quest Machine GameObject's UI properties still assigned?

    If the player's Quest Journal > UI Settings are assigned, try unassigning them. This will tell the Quest Journal to use the UI properties on the Quest Machine GameObject.

    Does the Demo scene work correctly?

    Please feel free to send an example scene to tony (at) pixelcrushers.com. I'll be happy to take a look.
     
  32. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    There's no warnings and everything seems attached. Is there not a trigger that needs adding somewhere?

    My project is around 40gb so not sure we could package it up. I'm adding the quest machine to an almost finished game. Demo is working fine. I noticed in the demo you have a a gameplay ui that isnt a prefab. Does that need adding or some trigger that is on it?
     
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    I might have misunderstood. It sounds like you may be asking how to start a dialogue with an NPC and the player. If so, try hooking into QuestGiver.StartDialogueWithPlayer. Here's one way:
    • Hook up a UI button's OnClick() event to the quest giver NPC's QuestGiver.StartDialogueWithPlayer method.
    • Make sure the player has a Quest Journal and is tagged 'Player'.
    (If you have multiple players, or if your player can't be tagged 'Player' for some reason, you can use the QuestGiver.StartDialogue(GameObject) method and provide a GameObject that has a Quest Journal component.)
     
    AndyNeoman likes this.
  34. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    Thanks @TonyLi , I've hooked into startdialgue ontriggerEnter for the player and NPC meeting so that's all working. Can you use external float/ints for counters or do you have to use the sync functions and have internal counters only?

    i already have variables for npc hunger, tiredness, bonding etc and want to feed those values to the quest system counters so the quests autostart when they hit certain values.

    I've tried sending messages

    MessageSystem.SendMessage(this,DataSynchronizer.RequestDataSourceChangeValueMessage, "Food", 10);

    but the value does not change.
     
    Last edited: Sep 18, 2018
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Hi @AndyNeoman - If you want to use Quest Machine's counters (counter conditions for autostart, showing counter values in HUD text, etc.), then they have to be internal counters. You can use data synchronizers as described on page 57 of the manual (look for the Data Synchronizers heading), or you can set them using messages such as:
    Code (csharp):
    1. MessageSystem.SendMessage(this, "SetCounter", "Hunger", 33);
    or you can set them directly in code:
    Code (csharp):
    1. var quest = player.GetComponent<QuestJournal>().FindQuest("My Quest");
    2. quest.GetCounter("Hunger").SetValue(33);
    (You might find the API Reference to be helpful.)

    If you don't need to show counter values in HUD text, you can write custom condition types. For example, the Inventory Pro Support package adds conditions such as Inventory Pro Stat Quest Condition that directly reads the player's Inventory Pro stats without using quest counters. You can find a starter template script in the Templates folder.
     
    AndyNeoman likes this.
  36. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    Thanks @TonyLi, Ive been struggling to get it to work with messaging maybe setting direct in code will be better for me. I did try with the API reference and the syncronisers in the manual but could not get it to work. It appears some using statements or additional info is required to get it to work.

    I'll have another try.

    EDIT:- Also if the quest is not active will it be in the player.<QuestJournal> like you describe above?

    Some of these quests are on the NPC and I would like to update the counters even when not active.
     
    Last edited: Sep 18, 2018
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    You may need these two lines at the top of your script:
    Code (csharp):
    1. using PixelCrushers;
    2. using PixelCrushers.QuestMachine;
    No. You'll want to find the quest giver that has the quest, or use a data synchronizer / send a message that any listener can pick up.
     
    AndyNeoman likes this.
  38. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    Thanks, I have both those references. Neither messages or data synchronizer are working- maybe it's a little bit confusing with the two methods described in the manual and I have a bit of both in the setup.

    Could you describe how to set them both up separately? Do you have any references in the datasyncronizer? Do you have anything setup if you use the messages system? The manual just says simply

    MessageSystem.SendMessage(this, DataSynchronizer.RequestDataSourceChangeValueMessage, "Gold", 42); to change gold value but that does not work for me
     
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Messages
    I'll describe messages first, since they're simpler. The Demo scene has a quest named "Coin Race". It has a counter named coins:

    qmCoinsCounter.png

    The coins counter listens for the message "Get" + "Coin". It doesn't care who sent the message or who the target is. When it receives this message, it modifies the counter by the literal value of +1 (i.e., it increments the counter).

    The smashable barrels are configured to send the message "Get" + "Coin". You could also send the message using this code:

    Code (csharp):
    1. using PixelCrushers;
    2. using PixelCrushers.QuestMachine;
    3. ...
    4. MessageSystem.SendMessage(this, "Get", "Coin");

    Data Synchronizer
    Alternatively, you could set the counter's Value Mode to Data Sync:

    qmCoinsDataSync.png

    This implicitly makes the counter listen for the message "Data Source Value Changed". So you could set the counter value to 3 like this:

    Code (csharp):
    1.  
    2. using PixelCrushers;
    3. using PixelCrushers.QuestMachine;
    4. ...
    5. MessageSystem.SendMessage(this, "Data Source Value Changed", "coins", 3);
    Quest Machine also includes a helper script named DataSynchronizer, but you don't have to use it. It provides a UnityEvent that's invoked when values change, and a method to send that message above.
     
    AndyNeoman likes this.
  40. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782

    That's great. Thanks for the detailed explanation. I just didn't grasp it from the docs but this makes more sense to me.

    will these methods work for more than one NPC? I.E I have a number of animals who are all the same who give the same quests out. So can several of the same animals give the find food quest out and have different counters for each npc?
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    I don't think so. (I'm not sure exactly how you want to set it up.) But there's always a solution, even if I need to add it to the next update. Do you mean, for example, that 5 chicken NPCs might each have the same "feed me" quest?

    If you have 5 chickens, each with a "feed me" quest, currently you need a unique quest ID for each one. If you're generating these quests using QM's quest generator feature, the generator will set a unique ID for each one. But if you're making them by hand you'll need to specify unique IDs. Otherwise the NPC will see that the player already has a quest with a matching ID, and it won't offer its own copy of the same quest.
     
    AndyNeoman likes this.
  42. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    I was planning on using the procedural quests but when I looked at the standard quests with autostart options i thought that would be perfect.

    Yes, I do have five gorillas all have the ability to ask the player to feed them. I have the gorillas as quest givers. A script attached to each one with values for hunger and such (individual to each instance of the gorilla), so if the hunger hits a certain level the quest is triggered. I have only tested with one so far until I got it working but it seems you are saying it wont work for multiple at this time?

    It seems like you are saying if I use procedural then it will work with multiple is that correct?

    I will look at setting it up that way if so and then each one should have there own ID. I presume I can still feed in my own counters/stats to the quest machine counters and then it should work as I want it too.

    EDIT:- I've just started trying out the procedural quests.

    I really like the setup, seems really interesting. One thing that has sprung to mind is can we alter the value at runtime/code for the drive values? This would allow me to feed in the variables I described early for AI desires (food,sleep etc) and hopefully make the quests generated tie in with what the AI needs at any time.


    There seems to be an error when you try to create your own urgencies. Currently there is only threat in the system - it says in the docs it ships with several am i missing something?

    NotSupportedException: The invoked member is not supported in a dynamic module.
    System.Reflection.Emit.AssemblyBuilder.GetExportedTypes () (at <f2e6809acb14476a81f399aeb800f8f2>:0)
    PixelCrushers.QuestMachine.QuestGeneratorUrgencyFunctionListGUI.<CreateNewAsset>m__0 (System.Reflection.Assembly domainAssembly) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Editor/Quest Generator Editors/Quest Generator Editor Window/QuestGeneratorUrgencyFunctionListGUI.cs:36)
    System.Linq.Enumerable+<SelectManyIterator>d__167`3[TSource,TCollection,TResult].MoveNext () (at <839a3cb835c04d14aeb58d83bb7bc4bd>:0)
    System.Linq.Enumerable+WhereSelectEnumer
     
    Last edited: Sep 18, 2018
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    Correct. But you can have quests with IDs like "Feed Koko", "Feed King Kong", etc. Or even "Feed Gorilla 1", "Feed Gorilla 2", etc.

    Yes.

    It's possible but not very elegant in the current version. (You need to create runtime instances of entity types.) I'll look into providing a cleaner way to do this in a future version.

    It ships with scripts for Threat, Faction, and Literal. Only Threat has an actual asset when you import Quest Machine. To create assets for the others, open the Quest Generator window (Tools > Pixel Crushers > Quest Machine > Quest Generator). On the Urgencies tab, click New, and select the type of urgency function asset you'd like to create (e.g,. Literal).
    • Faction Urgency returns an urgency that's the negative of the quest giver's faction relationship to the entity. For example, the Villagers faction for Orcs is -80. This means the urgency for Villagers to deal with Orcs is +80.
    • Threat Urgency is a version of Faction Urgency that takes into account the number of entities. For example, if there are two Orcs, then the urgency is 2 * 80, or 160. The scale is a curve that you can adjust by inspecting the Threat asset. You can create multiple threat urgency assets if you want to use different curves.
    • Literal Urgency is a literal number, such as 42. It's not based on any other factors. So if you add a literal urgency of 42 to a Monkey, then the monkey will always have 42 urgency regardless of which NPC is generating the quest. Create a literal urgency asset for each literal number that you want to use.

    You may have an older version of some DLL in your project, such as an older version of Playmaker, that System.Reflection can't fully read. If you update the offending asset, the error should disappear. If you can't update, the next release will handle this exception without reporting an error.
     
  44. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782

    Hi @TonyLi, could you describe the dirty way to access and change the drive values at runtime? It's fundamental to me being able to get the quests working I think. They need to be updated fairly regularly - I update the values in a enumarator every few seconds and would ideally then push those values onto the drive values of the entities.
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    I suspect urgency functions may play a bigger role in your quest generation. But, in any case, it will be almost as fast for me to finish up the patch I'm working on rather than detail the dirty process. I'll have a patch for you later today that lets you cleanly adjust drive values at runtime, and that also gets rid of that error with urgency functions when your project has an old DLL.
     
    AndyNeoman likes this.
  46. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    wow, awesome customer service, Your help has been immense. I'm just going through your Dialogue system integration, i'm glad I bought both now.

    Excellent Asset Dev I will review both products just as soon as I get them up and running. :)

    I will look at creating urgency functions for food, sleep etc once the update clears the error on creating urgencies. I've no idea which asset is causing the issue and have no info from the error logs unfortunately.
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    @AndyNeoman - I'm following up on this in case you missed the PM I sent you yesterday. If you have any questions about setting up procedurally-generated quests or adjusting drive values at runtime, just let me know.
     
  48. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    Thanks @TonyLi I've had a bit of a nightmare with my terrain shader this morning but it looks like I have figured it out. I'm about to try your new fixes. Hopefully all goes well I will let you know shortly. :)
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    8,637
    (This is a topic AndyNeoman and I were discussing in PM. I'm bringing it here because the info may be helpful to others, too.)
    Think of it like utility AI, as in The Sims. In The Sims, a Sim has an overall urgency value, which is the sum of its hunger, thirst, sleep, boredom, etc., values. The Sim's goal is to keep the urgency value as low as possible. When the Sim wants to figure out what to do, it examines nearby objects. Each object advertises that it will adjust one or more values. The Sim then picks the object that advertises to reduce overall urgency the most.

    Similarly in Quest Machine, your gorilla has an overall urgency value, which is the sum of all of the urgencies on all of the entities it's aware of. The Banana's Sate Hunger urgency is a function of the gorilla's Hunger drive. If the Hunger drive is high, the Banana's urgency will be high. On the other hand, if the gorilla's Hunger is low but Sleepiness is high, then a Bed entity might return a higher urgency.

    The gorilla will generate a quest about the entity with the highest urgency. Each entity has a set of actions, such as Eat. To generate the quest, it will choose the action that advertises to best reduce the gorilla's overall urgency value.

    Actions advertise effects, which are a list of entities that will be added or removed from the NPC's mental model of the world when the action is complete. For example, the Eat action will remove the Banana from the mental model, which will reduce the gorilla's urgency because the Banana is no longer contributing to it. Similarly -- as strange as it might sound at first -- you'd configure the Sleep action to remove the Bed entity. This means that the Bed is no longer contributing to the gorilla's mental model. Note that actions just advertise to change the NPC's mental model. By themselves, they don't change the actual game world (i.e., scene). They depend on gameplay to do that, and they generally listen for gameplay messages such as "Fed" + "{QUESTGIVER}" to know when the gameplay part has been completed.

    With this solution, you don't need to manually check needfood.value > 80. You just tell the gorilla to generate a quest, and it will generate the most appropriate quest for its current state.
     
    Weblox and AndyNeoman like this.
  50. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    782
    Hi @TonyLi

    I'm trying to add a questentity to a gameobject at runtime. It's simple enough to add the script but is there then a way to set the type? I'm having a problem using questEntity.type for some reason. I have a lot of food objects in my game and I don't want them all set to entitytype in case it overirdes all the other quests that can generate that don't have some many items.