RPGFPS quest tutorial [help]

i got a RPGFPS (it looks like elderscroll series) but i cant produce some quest. And making a quest list. ( sry if my english so bad)

Well first of all, your map probably gets loaded/unloaded often when you enter dungeons and such, so I would create a Quest Scene and put the code there, since it’s persistent. And put a QuestManager object in there with a script.

Once you talked to an NPC and have triggered a quest, it becomes active. You could hold a List<> of active quests. And save those with you game save.

Then every time you kill an NPC, or pickup an objects. You could warn your QuestManager of the event. And it will judge if you have complete the quest or not.

EDIT: I realized your question was more how do I define those quests. You could create define them in XML files. You can create text assets. And your Quest Manager will load them.

veldrict: I created a working quest system. One must realise that a quest system needs to work hand in hand with the inventory system, if any of the quests require items to complete the quest… I’ll try to get you an idea of the architecture I used, but it’s been a few years since I did this, so I can’t remember off the top of my head. I am not at my desk today, and then there is the Easter break, so if I have not gotten back to you by next week, PM me and remind me.

On the other hand… http://www.burgzergarcade.com/ does an RPG tutorial. I have not watched them in any detail, but they must have a working inventory and quest system, so if you want to cut right to it, you might head on over there and see what you can find.

http://www.burgzergarcade.com/ does have an inventory system, but as of now the quest system has not been done. However as far as I know, it is planned and will eventually come.

Forgot about this thread…

Thanks for the bump. If you need a pointer re: Quest Systems, post a note.

My only complaint with the guy that does the hack and slash tutorial is he tends to not respond to 90 percent of what I have to say. to me that’s ignoring and that is by far my biggest pet peeve.

At the same time, he took the time to make these tutorials for free. You should never complain about that…

true, but the least he could do is respond even if it’s one word it works better than simply ignoring me.

Edit: Or even if he said, “I’m just not worried about that right now,” would work for me any day. In any case, I do appreciate his tutorials and I’ve even paid money for the scripts as he gets them done.

Omniverse, I don’t think he’s purposely ignoring you, it’s more likely that he doesn’t have time to think about and reply to all of his viewers comments. I understand how much work is involved in producing video tutorials, it far exceeds the effort that went into figuring out and building the code in the first place. Any person making video tutorials for free (or for dirt cheap) can only do so much, after that the onus is on the viewer to expand their knowledge on their own.

I was compelled to spend a bit of time and reply to this comment here because I strongly believe that Petey (BurgZerg Arcade) should be defended from what I see as unfair criticism.

I thank you for not replying snarky. I respect you even more now. However, I don’t get how this is unfair criticism. I know how much work is put into really any kind of tutorial, written or video because I’ve done written tutorials before. At the same time, this pet peeve is so big I actually have a hard time controlling it. I hope you understand that I’m not trying to unfairly criticize anyone.

Let’s keep the thread on track, svp.

Agreed Little Angel, anyways I’m stuck on making a questing system. I wondering how you can create a quest so lets say the quest is to kill 10 wolfs, how do you define this? Make a separate script for that quest or keep everything saved in something? This is were I’m stuck!

I’m in Copenhagen all this week at UT HQ, so I have little access to my office. What I’ll try to do tomorrow is look at the basic architecture of my quest system for ezgui and go over the logic in a general way. That way you can have a road map of how I’ve approached it.

Thanks! :smile:

The basic architecture runs like this:

The following concepts are ignoring any UI solution, as this was originally complete using EZGui by Brady at A&BSoft.
http://www.anbsoft.com/middleware/ezgui/

Everything is driven off of a “QuestClass”:

[System.Serializable]
public class Quest {
    public string title;                                //    String Title for the quest
    public int id;                                        //    ID number for the quest                 
    public QuestProgress progress;                        //    State of the current quest progress (enum)
    public string description;                            //    String from the Quest Giver/Receiver
    public string hint;                                    //    String from the Quest Giver/Receiver
    public string congratulations;                        //    String from the Quest Giver/Receiver
    public string summary;                                //    String from the Quest Giver/Receiver
    public int nextQuest;                                //    The next quest, if there is one
    public string questObjective;                        //    Name if the item (Used to remove the item  as a doublecheck)
    public int questObjectiveCount;                        //    Current number of questObjective Objects
    public int questObjectiveRequirement;                //    Required amount of questObjective Objects
}

Quest Progress in an ENUM:

public enum QuestProgress {NotEligible, Eligible, Accepted, Complete, Done}

The quest ID number is one of the key bits to drive the system.

Each quest was originally written in an external database but you could use a spreadsheet, then these were read into the system using a script that parsed a text file. Later I used a simple array built into Unity and wrote a custom editor window to manipulate it. This is similar to the system I used in InventoryManager to keep track of inventory items. Either way, you could “zip” the array into a dictionary at runtime for easier access.

Then I have a “QuestObject” which can either give or receive quests (or both). This was a script you would put on any object that could give or receive quests. Each quest object has a list of quests it could give or receive. When you activated the event on the object (usually just clicking on it) it would send it’s list of quests to a “QuestManager” script. The quest manager would look at the state of each quest and control whether you could take or finish a quest or it it was in progress - give the appropriate hint or whatever. (“Have you brought me my magic beans? They are found under the JumJum tree!”) The quest manager could just as easily do nothing. Imagine a statue that will give you a quest later in the the game. You click on it at the beginning of the level and nothing happens (questProgress == QuestProgress.NotEligible), but later on when questProgress == QuestProgress.Eligible, clicking on it gives you a window.

questManager.QuestRequest (thisQuestObject, questGiverIDs, questReceiverIDs);

This way the objects only really need to know a simple list of the ID’s it can give or receive. This also means you could have multiple objects that could give or receive the same quest, but once it was accepted (or returned) by one object, the other objects wouldn’t be able to give (or accept) them, as the check against the state of the quest would not allow it.

The quest manager would process this information and display the appropriate information in a window, showing what quests can be taken, which are in progress, and which are complete and can be finished.

The quest manager controls the state of all the quests:

    public Quest[] questsArray;                                            //    Our master quest list
    public Quest[] currentQuestsArray;                                    //    Our current quest list
 
    private QuestObject currentQuestObject;                                //    The pointer to the current quest giver being processed
    private QuestObject newQuestObject;                                    //    The pointer to a new quest giver to be processed

When the Quest Manager opened a window, it listed each quest and it’s status. By clicking on that quest, a new view opened showing the details of that quest. A similar window/view was opened from the user’s panel when requesting a look at the quest log.

The quest manager had a series of methods to Accept a Quest, Decline a Quest, Complete a Quest, to Check a Quest (including the inventory), to Add a Quest Item, Remove a Quest Item…

To check a quest you need a reference to your inventory. If the currentQuest needs an inventory item to complete the quest, iterate thru the inventory and if the inventory item ID or name equals the current quest objective then add to the current quest objective count. When you’ve checked that, if the current quest objective count is greater than the current objective requirement then the quest is marked as complete. This gets more complicated if you have multiple requirements for a quest. (10 eggs, 1 pepper mill, 1 frying pan) This is often best to do when a quest is accepted to check to see if any items are already in the inventory. If the quest is accepted and the player already has 3 eggs and a frying pan in their inventory, you want to register these. You don’t want the player to have to collect 13 eggs, the pepper mill and 2 frying pans, but equally, you don’t want to track and register all potential items at all times - even for quests that are not yet taken or not yet eligible.

After a quest has been accepted, and/or to check items on the fly, you need to check when looting or picking things up. You’d need an “Add Item” and “Remove Item” method. When you pick something up, check thru all current quests and if any current quest requires an item with that quest object ID then increment QuestObjectiveCount by 1. If the current quest objective count is greater than the current objective requirement then the quest is marked as complete. This would also work for expendable things or events (like kills: “Kill 10 stinking badgers!”), you would just need to attach a test to the quest manager when something dies. If you do this for physical objects, you should definitely have a “Remove Item” method and I would suggest that before the actual completion of the quest, check/double check the inventory to make sure that the player hasn’t dropped, used or BANKED their objects. These objects usually need to be in the inventory on the player, rather than have simply been collected at some time in the past. Remember it’s possible to “complete” a quest (have all the objects collected somewhere) but not be able to finish the quest, because the items are not currently in the active inventory.

There are also a lot of other details…

The one thing not really mentioned in detail here is the need for an event system for displaying graphical hints. If you complete a quest that makes new quests eligible, you could iterate through a list newly enabled quests and turn on their graphical hint (like a floating !).

Let me know if this can get you started.

2 Likes

This is VERY useful :slight_smile: I’ve started the quest system and I’ve managed to get the quest holder object working so now I can keep quests once I take them. Tho I may make another quest holder to keep all the quests on and not just the ones i picked so that I dont have to use .txt files.

You should be able to keep it all in a list/array or dictionary.

I used one list for all the quests possible in the game held in the quest manager, and then I has another list of all the currently open quests, tho’ I’d have to look at how I did things as to why I did this. It seems to me that if the quest list was zipped into a dictionary, you wouldn’t need to have a separate list for the current quests.

Oh ok I will keep them in a list then :slight_smile: And so you saved your list into a dictionary right?

Yes. You can iterate through all of the entries in a list or array and build a dictionary out of it.

Hi, go and have a look at this new tool

http://forum.unity3d.com/threads/173984-Quest-and-Dialog-editor-for-games-developers?p=1190402#post1190402

Cheers
Cobus