Modding:Quests

Revision as of 06:11, 26 June 2024 by Kernelmethod (talk | contribs) (Start a quest modding page rewrite)
This page is about modding. See the modding overview for an abstract on modding.

This page will step you through writing your own questline. First, we will break down some of the common components of quests.

Quests.xml

The game defines quests in the Quests.xml file. Each quest is primarily broken down into the following:

  • A top-level <quest> tag that defines high-level properties of the quest, including the faction that assigned it (if any), journal accomplishments that should be added upon completing the quest, and so on, and
  • <step> nodes that define individual steps of the quest.

For example, here is the quest definition for O Glorious Shekhinah!:

<quest
    Name="O Glorious Shekhinah!"
    Level="3"
    System="TravelToStiltSystem" 
    Accomplishment="On the recommendation of a proselyte, you visited the merchant bazaar and grand cathedral at the Six Day Stilt."
    Hagiograph="=name= trekked through the salt pans, north and west, to the merchant bazaar and grand cathedral of the Six Day Stilt. There, the stiltfolk sang hymns in the sultan's honor."
    HagiographCategory="VisitsLocation">

    <step Name="Make a Pilgrimage to the Six Day Stilt" XP="1500">
      <text>Journey through the Great Salt Desert to visit the merchant bazaar and Mechanimist cathedral, where a proselyte asked you to make on offering of a trinket.</text>
    </step>
</quest>

IQuestSystem

Most quests are tracked through the use of custom per-quest systems that advance a player's progression through the quest as they achieve various objectives. Continuing our example from earlier, here's the system used by O Glorious Shekhinah!, TravelToStiltSystem:

using System;

namespace XRL.World.Quests;

[Serializable]
public class TravelToStiltSystem : IQuestSystem
{
        public override void Register(XRLGame Game, IEventRegistrar Registrar)
        {
                Registrar.Register(ZoneActivatedEvent.ID);
        }

        public override bool HandleEvent(ZoneActivatedEvent E)
        {
                if (E.Zone.ZoneID == "JoppaWorld.5.2.1.1.10" || E.Zone.ZoneID == "JoppaWorld.5.2.1.2.10")
                {
                        The.Game.FinishQuestStep("O Glorious Shekhinah!", "Make a Pilgrimage to the Six Day Stilt", -1, CanFinishQuest: true, E.Zone.ZoneID);
                }
                return base.HandleEvent(E);
        }

        // GetInfluencer is primarily used to determine who should be referenced when
        // naming an item. If the player successfully rolls an item naming opportunity
        // upon completing the quest, they will be able to name their item after the
        // culture of either Wardens Esther or Tszappur.
        public override GameObject GetInfluencer()
        {
                if (50.in100())
                {
                        return GameObject.FindByBlueprint("Wardens Esther");
                }
                return GameObject.FindByBlueprint("Tszappur");
        }
}

The main thing that this quest system does is register an event handler to check for ZoneActivatedEvent and determine whether the player has arrived at the  Six Day Stilt. If they have, then the quest is completed.

Example: Nima Ruda's fetch quest

This article is a stub. You can help Caves of Qud Wiki by expanding it.