Tutorial for Creating Basic XML Quests

Discussion in 'XmlSpawner Development' started by Deacon, Jul 25, 2014.

  1. Deacon

    Deacon Well-Known Member

    Joined:
    Sep 5, 2012
    Messages:
    766
    Likes Received:
    808
    Introduction

    Hello and welcome! This guide is aimed at providing a basic tutorial for creating XML spawner quests on the XML development shard, while the other guides on this topic provide a much more in depth analysis of XML spawners, they can be quite daunting for new players to pick up.

    This guide will be aimed at providing a basic understanding of XML spawner quests, how to create them, and how to create rewards.

    Reason for XML Quests over GM/Coded Quests

    Players may be familiar with many of the GM initiated/coded quests on this shard; these are great worldwide events such as the aMiB/Cupid/Santa/Leprechaun/Easter ones. These quests usually provide a lot more functionality than XML quests, including awesome features for NPCs and other unique attributes that would not normally be seen during regular play. The downside to these is they are quite rigid and not very portable, but most of all they require a lot of development time from the staff.

    XML spawner quests are quite different; they can be made on other servers and ported over, not to mention they do not require the code to be compiled every time there is a change (no restarting the server). They are also quite powerful in the sense that they allow for a great deal of flexibility without too much difficulty.

    XML spawner quests are a great way to provide a lot of early game interest for new players, previously players were advised to macro for several days before taking part in any real activity, the goal of these is to provide something interesting for new players to do while raising skills, exploring the world and interacting with players. Lastly these XML quests provide some small reward incentives to keep new players interested and also provide some starting equity that does not rely on handouts from vets.

    The biggest downside to XML spawner quests is unfortunately, the interface. I will go in depth about this later on, but any programmer that is familiar with IDEs will find it frustrating the majority of the time.

    Types of Quests

    There are four basic quest types which I'll cover in this tutorial, a description of them can be found below:

    COLLECT - This requires the player to collect X amount of items (e.g. "Collect 10 rubies") to redeem them for a reward
    COLLECTNAMED - This requires the player to collect X amount of named items (e.g. collect 10 "a mongbat head" from mongbats) to redeem them for a reward
    KILL - This requires the player to kill X amount of NPC's (e.g. "Kill 10 mongbats")
    KILLNAMED - This requires the player to kill X amount of specially named NPC's (e.g. "Kill Deacon the Wizard)

    Getting Started

    The first thing needed to start making XML spawner quests is to have a seer-level account on the XML development shard (Server: xml.uorenaissance.com port: 2599), to get one you may have to PM Telamon via forums/IRC.

    Creating the NPC

    Once you have a seer account, locate a free area where you would like to create your quest (Note that interfering with other player's work/testing will result in a ban from the server) and create your XML Spawner quest NPC with the following command:

    [add xmlquestnpc

    [​IMG]

    This will prompt the user to place the Quest NPC, the NPC will be created at the location the user has specified:

    [​IMG]

    When the NPC is created the user can start creating the quest by setting the XML properties with the following command:

    [xmledit

    This will bring up the following gump:

    [​IMG]

    The fields on the gump are:
    ProximityRange - The distance at which players will be able to interact with the quest NPC
    ResetTime - The time taken for the NPC to reset the quest speech
    SpeechPace - The speed at which the NPC speaks
    GhostTrig - Whether the NPC will trigger only on ghosts (Ghost quests!)
    TrigOnCarried - Whether the NPC will trigger the quest if the player is carrying an item
    NoTrigOnCarried - Whether the NPC will not trigger the quest if the player is carrying an item

    On - Whether the quest is active/inactive
    Refresh - Refreshes the NPC if there has been a change
    Add - Creates a new instruction for the NPC
    Delete - Removes an instruction for the NPC

    The remaining buttons are to navigate the available instructions on the NPC.

    Creating Instructions

    The first step we are going to do is to add a new instruction on the NPC by selecting the "Add" button

    [​IMG]

    This will create a blank instruction for the NPC, initially we want the NPC to yell something out to attract nearby adventurers, therefore we are going to add the text:
    Code:
    "Please sir, will you lend thy aid to help a starving peasant? "
    Note that the "DependsOn" field needs to be "-1" for the NPC to shout this all the time.

    [​IMG]

    This allows us to specify the first line of speech from the NPC, once you have provided all the required fields, hit the "Refresh" button and the command will be saved:

    [​IMG]

    At this point we want the player to be able to respond to the NPC, therefore we will create a new instruction with a keyword that the NPC will react to, the keyword in the below example will be “Yes”. This keyword needs to rely on the previous instruction; therefore the “DependsOn” field needs to be populated with the ID of the previous instruction (10). Note that the current ID of the instruction is “20”.

    [​IMG]

    When the player types “Yes” next to the NPC, we want a gump on the client to be raised, prompting the user for further action, this is done by selecting the parchment next to the “GUMP” field (Outlined in red above), this will open a blank “book” which will allow the user to specify the details of the gump.
    Deacon’s Note: This “book” is where all of the XML editing takes place, while I can write pages and pages on how horrible this interface is, my only advice is to initially write the XML in notepad and then copy it over.

    [​IMG]

    In the below example, I’ve written the gump so that the user will be prompted with two options, either to accept the quest, or to hear more details regarding the quest

    [​IMG]

    XML Code:
    Code:
    GUMP,Gram,4/Dear warrior, I am in urgent need of thy aid! A roaming band of orcs have wiped out my village and raided all of the supplies for their own. My family has been left to stave, wilst thou lend thy aid?;Yes;agree;How did this happen?;question
    This will create a gump with the text “Dear warrior, I am in urgent need of thy aid! A roaming band of orcs have wiped out my village and raided all of the supplies for their own. My family has been left to stave, wilst thou lend thy aid?”

    The user will then have to options to select, either:

    “Yes” which will map to the keyword “agree”
    “How did this happen?” which will map to the keyword “question”.

    When we have specified the two options, we will create new dialogue depending on the option the user selected, the first dialogue I am going to create is if the player responded with “Yes”. Firstly a new action will need to be added with the “Add” button, the action will be granted a new ID (30).

    [​IMG]

    This instruction will need to be dependent on the previous action so we will populate the “DependsOn” field with “20”.

    [​IMG]

    The keyword we specified in the XML gump to determine whether the user accepts the quest was “agree”, therefore we need to ensure that the “keyword” field is populated with “agree”.

    [​IMG]

    A new gump will need to be created if the player agrees to the quest, once again this can be done by selecting the parchment icon by the “GUMP” text. The below Gump will provide a brief description of the quest.

    [​IMG]

    XML Code:
    Code:
    GUMP,Gram,3/Thank you kind stranger! Our village will be able to survive the harsh seasons if you are able to provide 1,000 fish steaks, will you accept this task?
    The above Gump will display the following text:
    “Thank you kind stranger! Our village will be able to survive the harsh seasons if you are able to provide 1,000 fish steaks, will you accept this task?”

    The gump will also provide two options, either “Yes” or “No”.

    The next step we are going to do is to actually create the “Quest”, this is accomplished by creating a new instruction (ID=40) with the keyword “Accept” and the “DependsOn” field populated with “30”.

    [​IMG]

    Should the user respond to instruction “30” with “Yes”, a quest will need to be created; this can be accomplished by populating the “Action” field with the following XML code:

    [​IMG]

    XML Code:
    Code:
    GIVE/<questholder/name/Save Gram’s Village!/notestring/Gram’s village has been raided by villainous orcs, and they have no food for winter. Gram has asked that you collect 1000 fish steaks to supply his village./objective1/COLLECT,fishsteak,1000/autoreward/true/rewardstring/@bag/ADD/<club/hue/1157/name/an orc’s blood encrusted club>
    The above XML code does the following:
    GIVE – This command gives the player an item, in this instance it will be the “Quest”
    Name – This is the name of the quest in the “Quests” tab on the paperdoll (Save Gram’s Village!)
    Notestring – This is the description when the user selects the quest in their paperdoll (Gram’s village has been raided by villainous orcs, and they have no food for winter. Gram has asked that you collect 1000 fish steaks to supply his village.”
    Objective1 – The first (only) objective in the quest
    COLLECT,<item>,<count> – The task required (mentioned above), this is a quest where the user will have to collect the next item listed (Fishsteak), the number next to the item indicates how many of the item needs to be collected (1000)
    Autoreward/true – This is used to determine whether the user can collect the reward at any time, or whether the quest must be “handed in”.
    Rewardstring/@bag – This will create a reward “bag”, the subsequent text will determine what is inside the bag.
    ADD/<item/property1/value1/property2/value2…> - This is the item(s) that will be inside the reward bag, in the above example the player will be rewarded with a red hued, named club.

    We have now completed the basic path of the quest, simply put, the player has agreed to everything. As you may recall, when we created instruction 20, we also provided the option to inquire for more details (“How did this happen?” mapped to the keyword “question”), to add more details to the quest, a new gump will be created via the “Add” button (ID = 50) to provide the player with more details on the quest. The instruction will need to have the “DependsOn” field populated with the ID “20” (This was the instruction which prompted the user to accept the quest or inquire for more details), and the keyword will need to match the one we have provided previously (question).

    [​IMG]

    A new gump will be required, once again this can be selected with the parchment next to the gump field. This gump will allow the user to accept the quest (This will then continue on the same path as the first “accept” keyword), or to decline the quest.

    [​IMG]

    XML Code:
    Code:
    GUMP,Gram,4/The past few months have been harsh on the villagers here in Ocllo, we have noticed gangs of brigands popping up on the western shores, scores of evil mages and their unholy constructs to the south… Lastly the caverns below the village have become a congregation of the worst sort… I feel that the future of this village is bleak for us poor villagers! Hearing all of this, will you lend thy aid?; I will gather food for your village!;agree;I am unable to help thee;decline
    This gump will display the following text:
    The past few months have been harsh on the villagers here in Ocllo, we have noticed gangs of brigands popping up on the western shores, scores of evil mages and their unholy constructs to the south… Lastly the caverns below the village have become a congregation of the worst sort… I feel that the future of this village is bleak for us poor villagers!

    And provide the player with two options:

    “I will gather food for your village!” which will map to the “agree” keyword
    “I am unable to help thee” which will decline the quest.

    If the player chooses to accept the quest, the “agree” keyword will need to be mapped to the quest-acceptance path, this can be done by adding the current instruction (50) to the “DependsOn” field in instruction 30. It is possible to have multiple dependencies (i.e. two different gumps can lead to the same outcome), through the use of the comma delimiter ","

    [​IMG]

    When the final dependency has been added, your quest should look something similar to this:

    [​IMG]

    Congratulations! You have just made your first quest to collect 1000 fish steaks! This is a very simple quest with only one objective that will reward the user automatically, while it may seem quite long and tedious, once you get the hang of it you will be able to make quests faster than players can complete them.

    The last step that needs to be taken is to ensure the quest is active, and that players can access it. This can be done by typing the command “[props” and selecting the NPC.

    [​IMG]

    The two values that should be changed are:
    IsActive – True
    TriggerAccessLevel - Player

    [​IMG]

    If they are already in that state then that’s it! When you log onto a player account, the quest will be active.

    Completing the Quest

    This part of the guide will show the completed quest from a player’s perspective, firstly the NPC will shout out whenever a player reaches the proximity (3).


    [​IMG]

    Should the player respond with “Yes”, a gump will be displayed, in this scenario I will select the “How did this happen” option, and hit “Next”.
    [​IMG]
    When the option has been selected, a new gump will be displayed, allowing the player to accept/decline the quest, in the below example the player will accept the quest.

    [​IMG]

    The final gump will be presented to the user, this gump will contain the quest objective and a last chance for the player to back out. Should the player accept, the quest will be started.

    [​IMG]

    When the player accepts the quest, they will see a system message and receive a questbook.

    [​IMG]

    The questbook will contain details about the quest, alternatively the user will be able to manage their quest(s) from the “Quests” button on their paperdoll.

    [​IMG]

    A preview of the reward can be seen by selecting the little button next to the reward bag:

    [​IMG]

    When the player collects all of the required quest items, they are able to complete the quest by selecting the “Collect” button and targeting the item(s).

    [​IMG]

    Upon completion of the last task(s), the reward will automatically be placed in the player’s backpack, this is due to the “autoreward” flag being set to “true” during the quest creation.

    [​IMG]

    The player has now completed the quest, the reward has been given and the quest has been updated in the quest log.

    [​IMG]


    Deacon’s Notes

    • As of 24/07/2014 the KILL/KILLNAMED quests do not work, a quick search of Google found this to be a pretty common issue on RUO servers: http://www.runuo.com/community/threads/xmlquest-runuo-2-1-killname-kill.501507/ So currently it’s not possible to create quests where the user is asked to kill a specific named mob (Otherwise I would have made this a “Kill the evil Lord Deacon in the land of Trammelia” quest)
    • This quest can be completed as many times as required (Mostly because it makes testing a lot easier)
    • The quest can be received multiple times (Once again testing purposes)
    • To save the quest you will need to use the “[xmlsave” command, however it is unavailable to seers (Only Telamon can do this as far as I know).
    • The weird “?” characters that come up partway through words in my quest are due to copy/pasting from MS Word, notepad is the preferred option but as I was writing this guide I used the more convenient option
    • You do not have to use "gumps" to tell your story/set the quest, these are just my preferred method as they allow multiple players to access the questgiver without cluttering up screens with walls of text, additionally it allows them to read the quest at their own pace and make decisions based off the quests. Previously I did make quests where they players would have to type out keywords (Similar to the oldschool Ultima games "Job" "Virtues" "British" "Word of Power" etc) however I found these got quite hard to manage
    • XML quests have amazing possibilities that aren't even explored in this tutorial, I recall on a previous server making a "puzzle" quest where the user was required to answer many questions, if they answered wrongly they were teleported to a pit of snakes! I feel the best quests do not come from the best programmers, but the most imaginative ones.
    • I have set up 4 XML quest NPC’s to show the basics of these on the XML server in Ocllo. The four NPC’s can be found by the bank and are:
    ○ Gram – Collect 1000 fish steaks for a red club
    ○ Kepa – Kill a named troll “Barnabus” east of the bank for 250 gold (NOT WORKING, see above)
    [​IMG]
    ○ Justien – Kill 10 mongbats for 500 gold (NOT WORKING, see above)
    ○ Ryder – Collect 50 rubies for a newbied red bracelet.

    Lastly let me just say that I’m more than happy to help out any players wanting to create their own quests, if you get stuck or need some advice, shoot me a PM via IRC/forums and I’ll get back to you as soon as possible.

    Happy Questing!
    Last edited: Jul 25, 2014
    Mordechai, Pill and Dalavar like this.
  2. Laretheo

    Laretheo Active Member
    UO:R Donor

    Joined:
    Jan 9, 2015
    Messages:
    197
    Likes Received:
    121
    is the kill/killnamed quests still not working? or has this been figured out just curious
    Lightshade likes this.
  3. Bodhran

    Bodhran Active Member

    Joined:
    May 10, 2017
    Messages:
    133
    Likes Received:
    108
    I'm interested in learning how to do this. I'd like to make a variety of quests and submit them to @Chris and see if it's possible that any could be used on UOR.



    However, I've never coded and I am not sure where to start, could you link me to intro/novice lessons and directions to where I need to start from the ground up?



    Also, is anything I do going to be compatible with UOR?
  4. Deacon

    Deacon Well-Known Member

    Joined:
    Sep 5, 2012
    Messages:
    766
    Likes Received:
    808
    Your best bet is to get in touch with Chris and see if he can set you up with an account on the development server to start off.

    There's lots of guides online and if you ever need a hand, feel free to ask!

Share This Page