Item Creation Tutorial - dredmor-com/dungeons-of-dredmor GitHub Wiki

⁠⁠Here, you'll be taught to create any item you might want to introduce in your mod. Let's get started!

  1. Setting your mod up
  2. Food and Drink
  3. Weapons
  4. Armour
  5. Bolts and Thrown Weaponry
  6. Potions
  7. Traps
  8. Crafting Materials
  9. See Also

Setting your mod up

Before anything, you'll need a proper directory structure prepared and a valid mod.xml file built. You can follow those links if you need to set this up.

Otherwise, you'll now need to make a file named 'itemDB.xml' in the 'mod' directory. When you start to edit it, make sure it starts with <itemDB> and ends with </itemDB>, or your mother will be very disappointed. You can then start to add more items to the file. According to the XML Prophecy, each item starts with <item> and ends with </item>.

Food and Drink

For starters, we can begin with Food and Booze. The following is an implementation of the Cheese and Dwarven Gut Rot items.

<item name="Cheese" iconFile="items/food_cheese.png" level="3">
    <price amount="30"/>
    <food hp="7" meat="1"/>
    <description text="This is what happens when someone leaves the milk out."/>
</item>

<item name="Dwarven Gut Rot" iconFile="items/booze_gutrot.png" level="6">
    <price amount="94"/>
    <food mp="27" effect="Lingering Weakness"/>
    <description text="God only knows how they stomach this stuff."/>
</item>
Tag Attribute Description
item name="Cheese" The item's name. Other XMl files will use this to call it.
iconFile="items/food_cheese.png" The icon for the item. What it appears as in-game.
level="3" What level this item appears most often in. It can appear on other levels less frequently.
price amount="30" The item's price. Depending on difficulty, purchase price will be higher and sell price, lower.
food hp="7" This item will be used as food and animated as such. It will place a "recover HP" buff for 7 turns once consumed.
meat="1" OPTIONAL! A boolean indicating if the item is vegan or not, for purposes of the Vegan skill tree.
mp="27" This item will be used as booze and animated as such. It will place a "recover Mana" buff for 27 turns on consume.
effect="Lingering Weakness" OPTIONAL! When this item is used, the spell Lingering Weakness is cast on the user. More about spells on the Spell Tutorial.
description text="..." The humorous and/or descriptive text that appears when you mouse over an item.

Weapons

Weapons have some more tags pertaining to their weapon-ness. Let's see the Axetar.

<item name="Axetar" iconFile="items/axe_axetar.png" level="7" type="1" artifact="1">
    <price amount="7440"/>
    <weapon slashing="11"/>
    <artifact quality="2"/>
    <targetHitEffectBuff percentage="20" name="Rockburst"/>
    <description text="Wielded by awesome bards that journey the lands, this axetar will totally shred your enemies with sharp-feeling rocks."/>
</item>
Tag Attribute Description
item type="1" The type of weapon. Read more about it here.
artifact="1" OPTIONAL! A boolean to rename the item. Here, the item will not get a fancy randomly-generated name, even if it has artifact enchantments.
weapon slashing="11" This tag determines the item is a weapon. After that, there's damage attributes: This axe deals 11 Slashing Damage (plus melee bonuses).
artifact quality="2" OPTIONAL! When generated, this item gets 2 randomly-generated bonuses.
targetHitEffectBuff percentage="20" This tag is OPTIONAL! When you hit a target, you'll get a bonus effect. In particular, when this weapon hits, it has a 20% chance to cast the Rockburst spell on the target. More information on the Skill and Spell tutorials.
effect="Rockburst"
Weapons can also have the 'primarybuff', 'secondarybuff' and 'resistbuff' tags featured in Armour, as well as 'damagebuff'. More about this later on.

Armour

As is tradition of Dredmor modding, the syntax for armor is slightly different from the one for weapons. Just slightly.

Note: When modding, use armoUr, not armor.

<item name="Knight's Helmet" iconFile="items/helm_knights.png">
    <price amount="1600"/>
    <armour level="6" type="head"/>
    <primarybuff id="2" amount="-1"/>
    <secondarybuff id="9" amount="-2"/> <!-- edr -->
    <secondarybuff id="10" amount="3"/> <!-- armour absorption -->
    <secondarybuff id="7" amount="4"/> <!-- block -->
    <secondarybuff id="3" amount="-2"/> <!-- magic power -->
    <secondarybuff id="14" amount=".2"/> <!-- mana regen -->
    <resistbuff piercing="1"/>
    <secondarybuff id="18" amount="-1"/>
    <description text="This knight's helm looks a lot like a bucket if a bucket had a hole cut in it for you to see through and a visor you could raise to eat through. These features would not be useful on most buckets, however."/>
</item>
Tag Attribute Description
armour level="6" Yes, the level attribute is now on the armour tag. Don't ask why.
type="head" Where the armor piece is placed (either head, chest, legs, hands, feet, neck, ring, shield and, most importantly, sleeve)
primarybuff id="2" This tag is OPTIONAL! When equipped, this will debuff the primary stat of id 2 (Nimbleness) by -1.
amount="-1"
secondarybuff id="10" This tag is OPTIONAL! When equipped, this will buff the secondary stat of id 10 (Armour Absorption) by 3.
amount="3"
resistbuff piercing="1" OPTIONAL! When equipped, this item grants 1 point of Piercing Resistance.

Bolts and Thrown Weaponry

These are written up like weapons, with a specific type (5 for Thrown Weapons, 6 for Bolts) and some additional attributes.

<item name="Clockwork Drill Bolt" iconFile="items/bolt_drill.png" level="8" type="6" maxstack="5">
    <price amount="259"/>
    <weapon piercing="8" hit="Clockwork Drill Hit"/>
    <description text="Originally invented to assist in long-range carpentry, the tragic prototype test results spurred unintended breakthroughs in weapon technologies."/>
</item>

<item name="Hand Grenade" iconFile="items/thrown_grenade.png" level="8" type="5" maxstack="3">
    <price amount="350"/>
    <weapon crushing="4" thrown="items/thrown_grenade.png" hit="Grenade Center" canTargetFloor="1"/>
    <description text="You're going to blow someone's eye up with this."/>
</item>
Tag Attribute Description
item maxstack="5" How many of these appear in a single stack. They can be stacked in larger numbers in the player's inventory.
weapon hit="Clockwork Drill Hit" This spell is cast on the target when the weapon hits it. It is unclear whether or not it works on melee weapons, too, but it is unlikely.
thrown="items/thrown_grenade.png" Use this if you want a fancy graphic for your item when it is thrown. You can use the same icon you use for a regular item, as shown here.
canTargetFloor="1" A boolean to indicate if this weapon can target an empty floor tile. In our case, that's a 'yes'.

Potions

Potions are almost identical to food and booze, only with the <potion> tag instead of the <food> one.

<item name="Potion of Lively Regeneration" iconFile="items/potion_regen0.png" level="3">
    <price amount="260"/>
    <potion spell="Medium Regen"/>
    <description text="This flask is filled to the brim with cheerful pinkiness."/>
</item>
Tag Attribute Description
potion spell="Medium Regen" This potion casts the spell "Medium Regen" on the target when used. Read more on the Spell Tutorial.

Traps

Traps are the only items that do anything when stepped on, and the only ones that can't be taken from the floor arbitrarily.

<item name="Shoddy Dwarven IED" iconFile="dungeon/trap_tnt.png">
    <price amount="100"/>
    <trap trigger="once" casts="Makeshift Bomb Center" level="1"/>
    <description text="This is a sub-par Dwarven IED design. All craftsdwarfship is pretty lousy, actually."/>
</item>

<item name="Gargoyle Arrow Trap" iconFile="dungeon/trap_pressure_plate0.png">
    <price amount="100"/>
    <trap origin="dungeon/trap_wall_gargoyle0.png" originFacing="south" originMount="wall" trigger="always" casts="Gargoyle Arrow" level="1"/>
    <description text="Triggering this plate causes a Gargoyle to spit a large spinning arrow at you. Ow!"/>
</item>
Tag Attribute Description
trap trigger="once" This trap triggers once, then disappears.
trigger="always" This trap will trigger every time it's stepped on, until removed.
casts="Makeshift Bomb Center" This spell is casted when the trap is triggered. As always, more info at the Spell Tutorial.
level="1" The trap level, aside from telling you what level it appears most in, defines how hard it is to disarm.
origin="dungeon/trap_wall_gargoyle0.png" This kind of trap spawns a gargoyle head to the north of it.
originFacing="south" The direction the spawned mechanism is oriented. It's unclear if anything other than "south" works, although it's very likely.
originMount="wall" Where the trap spawns its spell. While "wall" is currently the only option available, "floor" was also intended to work, but it currently isn't.

Crafting Materials

The simplest items in the game, by structure. Keep in mind they won't do much until added to 'craftDB.xml' as well.

<item name="Zinc Ingot" iconFile="items/ingot_zinc.png" alchemical="1" craftoutput="1">
    <price amount="90"/>
    <description text="Zinc - one of the three Forbidden Metals."/>
</item>
Tag Attribute Description
item alchemical="1" This item appears in the Crafty-Crafts vending machines.
craftoutput="1" This does absolutely nothing.

See Also:

Item System Reference

⚠️ **GitHub.com Fallback** ⚠️