User:Kernelmethod/Sandbox: Difference between revisions

From Caves of Qud Wiki
Jump to navigation Jump to search
m (Rename "mage of fire/ice" to "fire/ice mage")
m (Add some XML fragments to the static encounters section)
 
(34 intermediate revisions by the same user not shown)
Line 1: Line 1:
Modding Tutorial: ''Snapjaw Mages!''
== Tutorial: Mage Towers (static and dynamic encounters) ==


Welcome! If you're looking to get started with modding Caves of Qud, this tutorial is a good place to start.
Potential ideas for an encounters tutorial:


In this tutorial, we're going to add a new creature to the game -- the great and mystical '''''snapjaw mage'''''. Along the way we're going to be helped by my friends {{qud text|&MRulimispruce, legendary sprouting orb}} and {{qud text|&MPyovya, legendary mopango}}.
* Static/dynamic locations
* Adding secrets during worldgen
* Zone builders


{| style = "margin: 1em;font-family:Source Code Pro;"
Some potential references:
| style = "padding:0em 1em;"| [[File:Sprouting orb.png|40px]]
| style= "color:#155352" | <
| style = "border:1px solid #155352;padding:0.5em 1em;" | Howdy!
|}


{| style = "margin: 1em;font-family:Source Code Pro;"
* {{favilink|Flattened remains}}
| style = "padding:0em 1em;"| [[File:Mopango_pilgrim.png|40px]]
* {{favilink|Ancient bones}} in the {{favilink|waterlogged tunnel}}
| style= "color:#155352" | <
* {{favilink|Stopsvalinn}}
| style = "border:1px solid #155352;padding:0.5em 1em;" | I'm excited!
* {{favilink|Oddly-hued Glowpad}}
|}
* {{favilink|Ruin of House Isner}}
* {{favilink|Bey Lah}}


By the end of this tutorial, you'll have created a new mod which
Other:


* introduces two new creatures, the {{qud text|snapjaw &Rfire &Ymage}} and the {{qud text|snapjaw &Cice &Ymage}}, and
* https://bitbucket.org/bbucklew/cavesofqud-public-issue-tracker/issues/9458/modding-feature-request-allow-for-merging
* introduces two books that function as missile weapons, the {{qud text|tome of &Rfire}} and the {{qud text|tome of &Cice}}.


== Getting started ==
Static encounters section can be done with just XML; dynamic encounters section will require some C# experience.


TODO:
== Adding static encounters ==
* Setting up development environment
* Where to find game files.
* Player.log
* How to perform a wish
* The _Quickstart game option


Prerequisites:
* Editing cell definition in Worlds.xml
* Have played through a good chunk of Qud
* Add a new population table to a cell.
* Create a map template with the map editor.


== Basic concepts ==
<syntaxhighlight lang="XML">
 
=== XML ===
 
* What is XML?
* Tags vs attributes
 
=== Wishes ===
 
== Creating a mod ==
 
* Adding new mod with <code>manifest.json</code> to the <code>Mods/</code> folder.
* At the end of this section, modders should have a no-op mod that appears in their mods list.
 
<syntaxhighlight lang="text">
SnapjawMage
├── manifest.json
└── preview.png
</syntaxhighlight>
 
== Your first creature ==
 
=== Adding a new creature to <code>Creatures.xml</code> ===
 
In your mod directory, create a new folder called <code>ObjectBlueprints/</code>, and within that folder open up a new file in your text editor called <code>Creatures.xml</code>. Let's start by adding the following to <code>Creatures.xml</code>:
 
<syntaxhighlight lang="xml">
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<objects>
<objects>
</objects>
  <!--
</syntaxhighlight>
    Due to an outstanding bug in the way the Hills zonebuilder works, your
 
     terrain object *must* have the word "Hills" somewhere in its name.
Save this file! Before continuing, make sure your mod directory looks something like this:
 
<syntaxhighlight lang="text">
SnapjawMage
├── manifest.json
├── ObjectBlueprints
│  └── Creatures.xml
└── preview.png
</syntaxhighlight>
 
With that out of the way, let's start adding our new snapjaw mage to <code>Creatures.xml</code>:
 
<syntaxhighlight lang="xml">
<?xml version="1.0" encoding="utf-8" ?>
<objects>
  <object Name="Pyovya_SnapjawMage_Snapjaw Mage" Inherits="Snapjaw">
  </object>
</objects>
</syntaxhighlight>
 
Let's break this down:
* The <code>object</code> tag tells Qud that we want to add a new creature.
* The <code>Name</code> attribute is a unique identifier for our new creature (it's not the name of the creature as it appears in-game -- we'll get to that shortly). You'll use this identifier whenever you want to wish for a new snapjaw mage.
* The <code>Inherits</code> attribute says that our new creature should "inherit" all of the properties of the <code>Snapjaw</code> creature.
 
{| style = "margin: 1em;font-family:Source Code Pro;"
| style = "padding:0em 1em;"| [[File:Sprouting orb.png|40px]]
| style= "color:#155352" | <
| style = "border:1px solid #155352;padding:0.5em 1em;" | Hey, why'd you add the <code>Pyovya_SnapjawMage</code> bit to the front of the name of the creature? Why not just call it a <code>Snapjaw Mage</code>?
|}
 
{| style = "margin: 1em;font-family:Source Code Pro;"
| style = "padding:0em 1em;"| [[File:Mopango_pilgrim.png|40px]]
| style= "color:#155352" | <
| style = "border:1px solid #155352;padding:0.5em 1em;" | When writing a mod, it's common courtesy to prefix unique identifiers with your name, an underscore <code>_</code>, followed by the mod's name. This ensures that if somebody else writes their own Snapjaw Mage mod, your mod won't conflict with theirs.
|}
 
So far we haven't actually added anything to our new creature; for all intents and purposes it's a plain ol' snapjaw. Let's change that by adding some parts.
 
{| style = "margin: 1em;font-family:Source Code Pro;"
| style = "padding:0em 1em;"| [[File:Sprouting orb.png|40px]]
| style= "color:#155352" | <
| style = "border:1px solid #155352;padding:0.5em 1em;" | What's a part?
|}
 
{| style = "margin: 1em;font-family:Source Code Pro;"
| style = "padding:0em 1em;"| [[File:Mopango_pilgrim.png|40px]]
| style= "color:#155352" | <
| style = "border:1px solid #155352;padding:0.5em 1em;" | A '''''part''''' is a special piece of code that can be added to a creature to modify its appearance, behavior, stats, and any number of other things. There are a ''lot'' of parts -- over a thousand! You won't need to worry about most of them; many of them are highly-customized bits of code written for just one or two creatures. For instance, there's a <code>CryptSitterBehavior</code> part that is used exclusively by {{favilink|crypt sitter|plural}}.
|}
 
We're going to add two new parts to our creature: <code>Render</code> and <code>Description</code>.
 
<syntaxhighlight lang="xml">
<?xml version="1.0" encoding="utf-8" ?>
<objects>
  <object Name="Pyovya_SnapjawMage_Snapjaw Mage" Inherits="Snapjaw">
     <part Name="Description" Short="A great hero of the snapjaws." />
    <part Name="Render" DisplayName="snapjaw mage" Tile="Assets_Content_Textures_Creatures_sw_snapjaw_warrior.bmp" ColorString="&amp;O" DetailColor="Y" />
  </object>
</objects>
</syntaxhighlight>
 
Before I did into the new XML we've added, save <code>Creatures.xml</code>. Reload your mods, start a new game and wish for a <code>Pyovya_SnapjawMage_Snapjaw Mage</code>. You should a new snapjaw like the one below show up:
 
(IMAGE HERE, INCLUDING DESCRIPTION OF SNAPJAW)
 
Congrats! You've successfully added a snapjaw mage to your game.
 
{| style = "margin: 1em;font-family:Source Code Pro;"
| style = "padding:0em 1em;"| [[File:Sprouting orb.png|40px]]
| style= "color:#155352" | <
| style = "border:1px solid #155352;padding:0.5em 1em;" | I did?
|}
 
Well, it's still a little bare-bones, but you have indeed created a new creature called a <code>snapjaw mage</code> and spawned it in your game! Give yourself a pat on the back, Rulimispruce.
 
{| style = "margin: 1em;font-family:Source Code Pro;"
| style = "padding:0em 1em;"| [[File:Sprouting orb.png|40px]]
| style= "color:#155352" | <
| style = "border:1px solid #155352;padding:0.5em 1em;" | *rustling noises*
|}
 
Now, back to the parts that you just added:
 
* The <code>Description</code> part changes (as you might guess) the description of the creature when you look at it.
* The <code>Render</code> attribute changes the creature's appearance, as well as its name (as it appears in-game). This tag has the following attributes:
** <code>DisplayName</code>: how the creature's name is displayed in-game.
** <code>Tile</code>: a .png or .bmp ("bitmap") image that's used to display the creature. Check out [[Modding:Tiles]] for more information. In the snippet above, I just used the tile for {{favilink|snapjaw warrior|plural}} to get us started.
** <code>ColorString</code> and <code>DetailColor</code>: these are the primary and secondary colors used to color in the tile that you supply. You can look at [[Modding:Colors & Object Rendering]] for a full list of all of the available colors; in this case, we used <code>O</code> (orange) as the primary color and <code>Y</code> (white) as the detail color.
 
=== Using custom tiles ===
 
Instead of having our snapjaw mages look like off-color snapjaw warriors, let's add a snazzy new tile to the game to use for our mages! Just pop open a pixel editor, create a 16px x 24px black-and-white tile, save it as a --
 
{| style = "margin: 1em;font-family:Source Code Pro;"
| style = "padding:0em 1em;"| [[File:Sprouting orb.png|40px]]
| style= "color:#155352" | <
| style = "border:1px solid #155352;padding:0.5em 1em;" | I'm just a lil old sprouting orb, I don't know how to do any of those things.
|}
 
Ah, alright, fair enough. Well in that case, feel free to download the tile that I've already made for you here:
 
DOWNLOAD LINK FOR NEW TILE
 
In your mod directory, create a new folder called <code>Textures/</code>; in that folder, create a new subfolder called <code>Pyovya_SnapjawMage/</code>; and in there, create another subfolder called <code>Creatures/</code>. Save <code>snapjaw_mage.png</code> there, so that your mod folder now looks like this:
 
<syntaxhighlight lang="text">
SnapjawMage
├── manifest.json
├── ObjectBlueprints
│  └── Creatures.xml
├── preview.png
└── Textures
    └── Pyovya_SnapjawMage
        └── snapjaw_mage.png
</syntaxhighlight>
 
Now, let's change the <code>Render</code> part for our mages to use this new tile:
 
<syntaxhighlight lang="xml">
<part Name="Render" DisplayName="snapjaw mage" Tile="Pyovya_Snapjaw/snapjaw_mage.png" ColorString="&amp;O" DetailColor="Y" />
</syntaxhighlight>
 
Now when you spawn a snapjaw hero, it'll look something like this:
 
IMAGE
 
Cool! Now let's fill out some more details about our new creature.
 
=== Adding inventory ===
 
We'll keep adding stuff to our snapjaw mage to round them out a bit more. First of all, like any good mage, they need a {{favilink|walking stick}} and some [[book|books]]. Let's give them some clothes to equip while we're at it. Add the following XML to your creature:
 
<syntaxhighlight lang="xml">
<inventoryobject Blueprint="Walking Stick" Number="1" />
<inventoryobject Blueprint="Woven Tunic" Number="1" />
<inventoryobject Blueprint="Sandals" Number="1" />
<inventoryobject Blueprint="StandaloneMarkovBook" Number="1-2" Chance="10" />
</syntaxhighlight>
 
By setting <code>Number="1-2"</code> and <code>Chance="10"</code> in that last line, we've given our mages a 10% chance of holding 1-2 books when they spawn.
 
=== Adding skills ===
 
Let's give our mage the [[Cudgel]] skill as well, so that they're a little bit better at fighting with that walking stick:
 
<syntaxhighlight lang="xml">
<skill Name="Cudgel" />
</syntaxhighlight>
 
=== Changing stats ===
 
The base <code>Snapjaw</code> creature that we're inheriting from has really low stats, so we're going to bump up our mage's stats a little.
 
<syntaxhighlight lang="xml">
<stat Name="Hitpoints" Value="15" />
<stat Name="DV" Value="4" />
 
<!-- Raise ego to make the mage's mental mutations a little more powerful -->
<stat Name="Ego" Value="17" />
 
<!-- Raise willpower to reduce the cooldowns of abilities -->
<stat Name="Willpower" Value="17" />
</syntaxhighlight>
 
=== Minor details ===
 
TODO
 
<syntaxhighlight lang="xml">
<property Name="Role" Value="Artillery" />
</syntaxhighlight>
 
TODO
 
<syntaxhighlight lang="xml">
<tag Name="DynamicObjectsTable:Snapjaws" />
<tag Name="AggregateWith" Value="Pyovya_SnapjawMage_Snapjaw Mage" />
</syntaxhighlight>
 
FINAL VERSION OF CREATURE XML BEFORE GOING TO THE NEXT SECTION
 
== Using your creature as a base: Elemental Mages ==
 
{| style = "margin: 1em;font-family:Source Code Pro;"
| style = "padding:0em 1em;"| [[File:Sprouting orb.png|40px]]
| style= "color:#155352" | <
| style = "border:1px solid #155352;padding:0.5em 1em;" | Hold up a second. How is this creature a mage? It doesn't have any kind of magic spells!
|}
 
I was just getting to that!
 
So far, we've sketched out most of the properties, skills, and stats that a snapjaw mage should have. Now we're going to create two types of mages: '''''fire mages''''' and '''''ice mages'''''. Under your definition of the <code>Pyovya_SnapjawMage_Snapjaw Mage</code> creature in <code>Creatures.xml</code>, add two new creatures:
 
<syntaxhighlight lang="xml">
<?xml version="1.0" encoding="utf-8" ?>
<objects>
  <object Name="Pyovya_SnapjawMage_Snapjaw Mage" Inherits="Snapjaw">
    <!-- All of the stuff that you added in the previous section... -->
    <tag Name="BaseObject" Value="*noinherit" />
  </object>
</objects>
</syntaxhighlight>


TODO
    https://bitbucket.org/bbucklew/cavesofqud-public-issue-tracker/issues/10902
 
<syntaxhighlight lang="xml">
<?xml version="1.0" encoding="utf-8" ?>
<objects>
  <!--
  Skipped: the XML that defines the "Pyovya_SnapjawMage_Snapjaw Mage" creature
   -->
   -->
 
   <object Name="Pyovya_SnapjawMage_TerrainMageHills" Inherits="TerrainHills">
   <object Name="Pyovya_SnapjawMage_Fire Mage" Inherits="Pyovya_SnapjawMage_Snapjaw Mage">
    <part Name="Render" DisplayName="mage's tower" RenderString="227" ColorString="&amp;K" DetailColor="m" Tile="Pyovya_SnapjawMage/mage_tower.png" />
  </object>
    <part Name="Description" Short="The secluded abode of an accomplished magician lays against the rolling hillscape. At night, one can hear their lonely howls emanating from the ruined tower." />
 
    <!--
  <object Name="Pyovya_SnapjawMage_Ice Mage" Inherits="Pyovya_SnapjawMage_Snapjaw Mage">
      Remove the RandomTile part inherited from TerrainHills so that our tile doesn't
      get replaced with a random hills tile.
    -->
    <removepart Name="RandomTile" />
    <!--
      We modify grammatical usage of the terrain's name so that when we pass it by
      on the world map, it says that we pass by "a mage's tower" rather than "some
      mage's tower" or "a set of mage's tower".
    -->
    <xtagGrammar Proper="false" massNoun="false" />
    <tag Name="Gender" Value="*delete" />
   </object>
   </object>
</objects>
</objects>
</syntaxhighlight>
</syntaxhighlight>


Notice how we've used the <code>Inherits</code> attribute here. We're using our original snapjaw mage creature, <code>Pyovya_SnapjawMage_Snapjaw Mage</code>, as a base for our fire and ice mages. As a result, our new creatures will spawn with walking sticks, have the [[Cudgel]] skill, and so on.
<syntaxhighlight lang="XML">
 
Referencing the [[Modding:Colors & Object Rendering]] page, we're going to change our fire mages' detail color to red. We're also going to give them the {{favilink|Pyrokinesis}} mutation:
 
<syntaxhighlight lang="xml">
<object Name="Pyovya_SnapjawMage_Fire Mage" Inherits="Pyovya_SnapjawMage_Fire Mage">
  <part Name="Render" DisplayName="snapjaw {{R|fire}} mage" Tile="Pyovya_SnapjawMage/snapjaw_mage.png" ColorString="&amp;O" DetailColor="R" />
  <mutation Name="Pyrokinesis" Level="1" />
</object>
</syntaxhighlight>
 
TODO: explain syntax for changing text color.
 
TODO: explain what's going on in the <code><mutation></code> tag.
 
Now we'll make some similar changes to our ice mages: we'll change their detail color to cyan, and give them the {{favilink|Cryokinesis}} mutation.
 
<syntaxhighlight lang="xml">
<object Name="Pyovya_SnapjawMage_Ice Mage" Inherits="Pyovya_SnapjawMage_Ice Mage">
  <part Name="Render" DisplayName="snapjaw {{C|ice}} mage" Tile="Pyovya_SnapjawMage/snapjaw_mage.png" ColorString="&amp;O" DetailColor="C" />
  <mutation Name="Cryokinesis" Level="1" />
</object>
</syntaxhighlight>
 
TODO:
* Inherit from the Snapjaw Hero
* Add mutations, change colors
 
Proof-of-concept:
 
<syntaxhighlight lang="xml">
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<objects>
<worlds>
   <object Name="Pyovya_SnapjawMage_Snapjaw Mage" Inherits="Snapjaw">
   <world Name="JoppaWorld" Load="Merge">
     <part Name="Description" Short="Tussocks of fur dress skin stretched over taut muscle." />
     <cell Name="Pyovya_SnapjawMage_MageTower" Inherits="Hills" ApplyTo="Pyovya_SnapjawMage_TerrainMageHills" Mutable="false">
    <part Name="Render" DisplayName="snapjaw mage" Tile="Pyovya_SnapjawMage/snapjaw_mage.png" ColorString="&amp;O" DetailColor="Y" />
      <!-- New zone containing the mage's tower -->
 
      <zone Level="10" x="1" y="1" IndefiniteArticle="a" Name="mage's tower" HasWeather="true" WindSpeed="0-60" WindDirections="N,NW,NW,W,W,SW,S,SE" WindDuration="50-3000">
    <inventoryobject Blueprint="Walking Stick" Number="1" />
      </zone>
    <inventoryobject Blueprint="Woven Tunic" Number="1" />
     </cell>
    <inventoryobject Blueprint="Sandals" Number="1" />
   </world>
    <inventoryobject Blueprint="StandaloneMarkovBook" Number="1-2" Chance="10" />
</worlds>
 
    <skill Name="Cudgel" />
 
    <stat Name="Hitpoints" Value="15" />
    <stat Name="DV" Value="4" />
    <stat Name="Ego" Value="17" />
    <stat Name="Willpower" Value="17" />
 
    <property Name="Role" Value="Artillery" />
    <tag Name="DynamicObjectsTable:Snapjaws" />
    <tag Name="AggregateWith" Value="Pyovya_SnapjawMage_Snapjaw Mage" />
    <tag Name="BaseObject" Value="*noinherit" />
  </object>
 
  <object Name="Pyovya_SnapjawMage_Fire Mage" Inherits="Pyovya_SnapjawMage_Snapjaw Mage">
    <part Name="Render" DisplayName="snapjaw {{R|fire}} mage" Tile="Pyovya_SnapjawMage/snapjaw_mage.png" ColorString="&amp;O" DetailColor="R" />
    <mutation Name="Pyrokinesis" Level="1" />
  </object>
 
  <object Name="Pyovya_SnapjawMage_Ice Mage" Inherits="Pyovya_SnapjawMage_Snapjaw Mage">
     <part Name="Render" DisplayName="snapjaw {{C|ice}} mage" Tile="Pyovya_SnapjawMage/snapjaw_mage.png" ColorString="&amp;O" DetailColor="C" />
    <mutation Name="Cryokinesis" Level="1" />
   </object>
</objects>
</syntaxhighlight>
</syntaxhighlight>


== Creating new items ==
<syntaxhighlight lang="XML">
 
<?xml version="1.0" encoding="utf-8"?>
TODO: magical tome of fire + magical tome of ice
<Map Width="80" Height="25">
 
   <cell X="19" Y="23">
Proof-of-concept:
     <object Name="Pyovya_SnapjawMage_TerrainMageHills"></object>
 
   </cell>
<syntaxhighlight lang="xml">
</Map>
<?xml version="1.0" encoding="utf-8" ?>
<objects>
  <!-- Weapons -->
  <object Name="Pvovya_SnapjawMage_Magic Tome" Inherits="BaseMissileWeapon">
    <part Name="Description" Short="A magical tome." />
    <part Name="Physics" Weight="1" UsesTwoSlots="true" Category="Missile Weapon" />
    <part Name="Commerce" Value="200" />
 
    <tag Name="Tier" Value="2" />
    <tag Name="BaseObject" Value="*noinherit" />
  </object>
 
  <object Name="Pvovya_SnapjawMage_Fire Tome" Inherits="Pvovya_SnapjawMage_Magic Tome">
    <part Name="Render" DisplayName="tome of {{R|fire}}" Tile="Items/sw_book_1.bmp" ColorString="&amp;R" DetailColor="Y" />
    <part Name="MissileWeapon" Skill="Rifle" AmmoChar="f" ShotsPerAction="1" AmmoPerAction="1" ShotsPerAnimation="1" WeaponAccuracy="0" />
    <part Name="CooldownAmmoLoader" Cooldown="10" Readout="true" ProjectileObject="Pvovya_SnapjawMage_FireTomeProjectile" />
 
    <tag Name="MissileFireSound" Value="flamethrower" />
    <stag Name="Heat" />
   </object>
 
  <object Name="Pvovya_SnapjawMage_Ice Tome" Inherits="Pvovya_SnapjawMage_Magic Tome">
    <part Name="Render" DisplayName="tome of {{C|ice}}" Tile="Items/sw_book_1.bmp" ColorString="&amp;C" DetailColor="Y" />
    <part Name="MissileWeapon" Skill="Rifle" AmmoChar="FR" ShotsPerAction="1" AmmoPerAction="1" ShotsPerAnimation="1" WeaponAccuracy="0" />
     <part Name="CooldownAmmoLoader" Cooldown="10" Readout="true" ProjectileObject="Pvovya_SnapjawMage_IceTomeProjectile" />
 
    <tag Name="MissileFireSound" Value="hiss_low" />
    <stag Name="Cold" />
  </object>
 
  <!-- Projectiles -->
  <object Name="Pvovya_SnapjawMage_FireTomeProjectile" Inherits="TemporaryProjectile">
    <part Name="Render" DisplayName="{{R|stream of flame}}" ColorString="&amp;R" />
    <part Name="Projectile" BasePenetration="8" BaseDamage="1d2" Attributes="Heat Fire" ColorString="&amp;R" PassByVerb="whoosh" />
    <part Name="TemperatureOnHit" Amount="4d20" Max="false" OnWielderHit="true" />
    <part Name="TemperatureOnEntering" Amount="8d20" Max="false" OnWielderHit="true" />
  </object>
 
   <object Name="Pvovya_SnapjawMage_IceTomeProjectile" Inherits="TemporaryProjectile">
    <part Name="Render" DisplayName="{{C|streak of ice}}" ColorString="&amp;B" />
    <part Name="Projectile" BasePenetration="4" BaseDamage="1d4" Attributes="Cold NonPenetrating" ColorString="&amp;B" PassByVerb="crackle" />
    <part Name="TemperatureOnHit" Amount="-4d20" Max="false" OnWielderHit="true" />
    <part Name="TemperatureOnEntering" Amount="-8d20" Max="false" OnWielderHit="true" />
  </object>
</objects>
</syntaxhighlight>
</syntaxhighlight>


== Going forward ==
== Your first dynamic encounter ==
 
Congrats! You reached the end of the tutorial!
 
{| style = "margin: 1em;font-family:Source Code Pro;"
| style = "padding:0em 1em;"| [[File:Mopango_pilgrim.png|40px]]
| style= "color:#155352" | <
| style = "border:1px solid #155352;padding:0.5em 1em;" | Woohoo!
|}
 
{| style = "margin: 1em;font-family:Source Code Pro;"
| style = "padding:0em 1em;"| [[File:Sprouting orb.png|40px]]
| style= "color:#155352" | <
| style = "border:1px solid #155352;padding:0.5em 1em;" | I'm ready to go face these mages in magical combat.
|}


=== Extra challenge ===
=== World generation ===


Before you go, here's a little challenge that you can use to test what you've learned so far. We now have mages of fire and ice; now, try creating a new {{qud text|snapjaw &Welectric &Ymage}}, along with a {{qud text|tome of &Welectricity}} that shoots electric projectiles. You're free to go about this however you wish, but here are some general pointers:
* Locate zone to place tower
* Place creature


* You'll probably want to give your new mage the {{favilink|Electrical Generation}} mutation.
=== Zone builders ===
* When you're creating your {{qud text|tome of &Welectricity}}, start by having it shoot <code>ProjectileElectroPistol</code>; this is the projectile that is shot by an {{favilink|arc winder}}. Once you're ready, create your own version of this projectile by referring to how <code>ProjectileElectroPistol</code> is implemented in the game's version of <code>ObjectBlueprints/Items.xml</code>.


[[Category:Guides]]
* Place walls and items
* Add map template.

Latest revision as of 01:13, 5 March 2024

Tutorial: Mage Towers (static and dynamic encounters)

Potential ideas for an encounters tutorial:

  • Static/dynamic locations
  • Adding secrets during worldgen
  • Zone builders

Some potential references:

Other:

Static encounters section can be done with just XML; dynamic encounters section will require some C# experience.

Adding static encounters

  • Editing cell definition in Worlds.xml
  • Add a new population table to a cell.
  • Create a map template with the map editor.
<?xml version="1.0" encoding="utf-8" ?>
<objects>
  <!--
    Due to an outstanding bug in the way the Hills zonebuilder works, your
    terrain object *must* have the word "Hills" somewhere in its name.

    https://bitbucket.org/bbucklew/cavesofqud-public-issue-tracker/issues/10902
  -->
  <object Name="Pyovya_SnapjawMage_TerrainMageHills" Inherits="TerrainHills">
    <part Name="Render" DisplayName="mage's tower" RenderString="227" ColorString="&amp;K" DetailColor="m" Tile="Pyovya_SnapjawMage/mage_tower.png" />
    <part Name="Description" Short="The secluded abode of an accomplished magician lays against the rolling hillscape. At night, one can hear their lonely howls emanating from the ruined tower." />
    <!--
      Remove the RandomTile part inherited from TerrainHills so that our tile doesn't
      get replaced with a random hills tile.
    -->
    <removepart Name="RandomTile" />
    <!--
      We modify grammatical usage of the terrain's name so that when we pass it by
      on the world map, it says that we pass by "a mage's tower" rather than "some
      mage's tower" or "a set of mage's tower".
    -->
    <xtagGrammar Proper="false" massNoun="false" />
    <tag Name="Gender" Value="*delete" />
  </object>
</objects>
<?xml version="1.0" encoding="utf-8" ?>
<worlds>
  <world Name="JoppaWorld" Load="Merge">
    <cell Name="Pyovya_SnapjawMage_MageTower" Inherits="Hills" ApplyTo="Pyovya_SnapjawMage_TerrainMageHills" Mutable="false">
      <!-- New zone containing the mage's tower -->
      <zone Level="10" x="1" y="1" IndefiniteArticle="a" Name="mage's tower" HasWeather="true" WindSpeed="0-60" WindDirections="N,NW,NW,W,W,SW,S,SE" WindDuration="50-3000">
      </zone>
    </cell>
  </world>
</worlds>
<?xml version="1.0" encoding="utf-8"?>
<Map Width="80" Height="25">
  <cell X="19" Y="23">
    <object Name="Pyovya_SnapjawMage_TerrainMageHills"></object>
  </cell>
</Map>

Your first dynamic encounter

World generation

  • Locate zone to place tower
  • Place creature

Zone builders

  • Place walls and items
  • Add map template.