Modding:Pets

From Caves of Qud Wiki
Jump to navigation Jump to search
This page describes modding techniques to add new pets to the game. For information on the pets that are provided to Freehold Games' Patreon members, see Pets.
Disambiguation This page describes modding techniques to add new pets to the game. For information on the pets that are provided to Freehold Games' Patreon members, see Pets.
This page is about modding. See the modding overview for an abstract on modding.
This page is about modding. See the modding overview for an abstract on modding.

Caves of Qud provides support for modding in new pets into the game using just XML.

Modding in a custom pet

Technically, the only thing that you need in order to mod in a custom pet is to add

<tag Name="StartingPet" />

to a creature's blueprint. For example, the following XML is sufficient to add a snapjaw scavenger pet to the game:

<?xml version="1.0" encoding="utf-8" ?>
<objects>
  <object Name="Snapjaw Scavenger Pet" Inherits="Snapjaw Scavenger">
    <tag Name="StartingPet" />
  </object>
</objects>

This will cause a snapjaw scavenger pet to appear in the character customization menu.

In practice, you will often want to give your pet custom skills, mutations, stats, and so on. The Snapjaw Mages tutorial covers the majority of these concepts. The pets that are supported through the Freehold Games Patreon also usually have the following properties:

  • They have the Pettable part, and the PetResponse tag.
  • They have a unique tile (see Modding:Tiles).
  • They have the Story property, which points to a unique story related to the pet.
  • They have a unique conversational script (see Modding:Conversations).

You can decide whether or not these are appropriate for your pet; none of them are strictly necessary.

For a complete example of a pet that includes all of these pieces, check out the Marmus Mulegus mod (source code).

Pettable

To make a pet pettable (i.e. give it the pet interaction), you will need to give them the Pettable part, as well as the PetResponse tag. The value assigned to PetResponse is a comma-separated list of the different responses that the pet can have. Continuing our snapjaw scavenger pet example from before, here is how you would define some custom pet responses for your snapjaw pet:

<?xml version="1.0" encoding="utf-8" ?>
<objects>
  <object Name="Snapjaw Scavenger Pet" Inherits="Snapjaw Scavenger">
    <part Name="Pettable" />
    <tag Name="PetResponse" Value="licks you,growls" />
    <tag Name="StartingPet" />
  </object>
</objects>

Story

To give your pet its own backstory, you should give them the Story property. For example:

<?xml version="1.0" encoding="utf-8" ?>
<objects>
  <object Name="Snapjaw Scavenger Pet" Inherits="Snapjaw Scavenger">
    <part Name="Pettable" />
    <property Name="Story" Value="My Snapjaw Scavenger Story" />
    <tag Name="PetResponse" Value="licks you,growls" />
    <tag Name="StartingPet" />
  </object>
</objects>

Then in Books.xml, you can define a story under the My Snapjaw Scavenger Story ID:

<?xml version="1.0" encoding="utf-8" ?>
<books>
  <book ID="My Snapjaw Scavenger Story" Title="{{W|My Story Title}}">
    <page>
Write your story for your creature here!
    </page>
  </book>
</books>