A Modding Tutorial: Coding

PART I: CODING

1. What Everything Means

A. Armor (not including helmets or shields)

Here is a basic idea of what an armor definition file looks like for armor:

(This only applies to chest plates, gloves, and boots. Helmets and shields are coded like weapons... Why? I dont know.)

[item]

All items start with this tag. This tells the game that this is an item, not a spell or monster.

<type>:

Next, this tag defines whether this is petfood, a helmet, a sword, ect.

<rarity>:
Next is this tag which defines how often you will see the item in the dungeon and in merchants.
  • 0 = very common
  • 500 = reasonably common
  • 700 = reasonably rare
  • 900 = very rare
  • 1000 = this will not appear in the game unless you summon it. It is used on things like a creature you want only to be able to see when summoned, or an item you want not to appear.
<minimum_depth>:

Next on the list is this tag, which is the minimum dungeon level you must be on to see the item.

<maximum_depth>:

And after that, this tag is the maximum dungeon you will see the item on. This is so you stop seeing easy monsters and weak items as you go on.

<model>:

Then this tag is what an item looks like on the ground.

<animated_model>:

Then this tag is what the item looks like on your character.

<collideable>:

Next tag is whether you can run into it: 0 for no, 1 for yes. ( Props you can; weapons and armor you can’t ).

<icon>:

Next is, which defines what the item will look like in you inventory. There are two icons.

The first defines the color of the icon:

<icon>:[folder]/[file name.file type]:[alpha transparency path]

Example: <ICON>:ICONS/ring.png:ICONS/ringa.png

The second defines the icon’s transparencies:

<icon>:[icon path]:[folder]/[file name.file type]

Example: <ICON>:ICONS/ring.png:ICONS/ringa.png
<value>:

How much gold the item is worth

<takeable>:

This is whether you can take it or not; items are takeable, props are not. 1 = yes 0 = no.

<armor>:

How much protection this item is worth when worn, done in minimum:maximum format.

<drop_sound>:
<take_sound>:
<land_sound>:

Tells the computer what sound to play then the item is dropped, taken, or lands.

<requires>:

For stat, level, renown, or skill, this defines how good your character has to be to use the item.

You need to add a ‘requires’ tag for every requirement, so if you want some gloves to require 70 strength and 50 dexterity, it’ll look like this:

  • <requires>:strength:70
  • <requires>:dexterity:50
<merchant_minimum>:
<merchant_maximum>:

These are the same as dungeon min/max, except with merchants. The merchant’s items gain levels as you gain levels.

[/item]

All items end with this closing tag.

So, we have this:

[item]
<type>:
<name>:
<rarity>:
<minimum_depth>:
<maximum_depth>:
<model>:
<animated_model>:
<collideable>:
<icon>:
<value>:
<takeable>:
<armor>:
<drop_sound>:
<take_sound>:
<land_sound>:
<requires>:
<merchant_minimum>:
<merchant_maximuM>:

[/item]

Okay, that's it for armor.

B. Weapons ( and Helmets )

Mostly the same, but some differences.

[item] same
<type>: same
<name>: same
<rarity>: same
<minimum_depth>: same
<maximum_depth>: same

<model>:

This is the main difference, for weapons this defines how they look on the ground and on your character.

<collideable>: same
<icon>: same
<value>: same
<takeable>: same
#<damage>:minimum:maximum
<damage>:14:53

Defines the min and max damage.

<attack_radius>:7

Defines radius of circle a target must be within to start an attack.

<strike_radius>:9

Defines radius of circle a target must be within to succeed in an attack.

<speed>:normal

Defines how fast the weapon is: slowest, slow, normal, fast, or fastest.

<requires>: same
<take_sound>: same
<drop_sound>: same
<land_sound>: same
<strike_sound>:
<strike_sound>:
<strike_sound>:
<attack_sound>:

All four of these define the different sounds the weapon can make when it hits something.

<miss_sound>:

Defines the sound it makes when you miss.

<merchant_minimum>: same
<merchant_maximum>: same
[/ITEM] same

Okay, that's basically it for weapons.

C. Shields and Helms

[item]
<type>: same
<name>: same
<rarity>: same
<minimum_depth>: same
<maximum_depth>: same
<model>:

This defines what it looks like on the ground and on your player, like weapons.

<collideable>: same
<icon>: same
<value>: same
<takeable>: same
<armor>: same
<drop_sound>: same
<take_sound>: same
<land_sound>: same
<requires>: same
<merchant_minimum>: same
<merchant_maximum>: same
[/item] same

D. Monsters

[monster]

Tells the program that a monster is being defined.

<family>:

Defines what basic family the monster is in, spider, undead, insect ect.

<name>:same
<rarity>:same
<alignment>:

Defines if the monster is for or against you.

<base_level>:

Defines the level youll see the monster on most

<minimum_depth>:same
<maximum_depth>:same
<model>:

Defines what the monster looks like in gameplay as far as modeling, not texture.

<collision_model>:

This defines clipping planes for the monster; never change this when you make new monsters.

<scale>:

Defines how big the monster is. It appears like this: #:#. Don’t change the first number. The second number you can change like this: 2 is 2 times as big as original model, 4 is 4 times, .5 is half, and so on.

<walking_speed>:

How fast the creature walks.

<running_speed>:

How fast the creature runs.

<turn_rate>:

How fast the creature turns.

<view_radius>:

How far the creature can see.

<motion_radius>:

How close a monster has to be to react to your movements.

<attention_radius>:

How close a monster has to be for it to react to your presence.

<follow_radius>:

How far away a monster has to get for the it to stop following.

<hp>:

The min and max hit points this monster has, laid out like this: min:max.

<natural_armor>:

How much natural armor the monster has.

<tohit>:

Defines a creatures’s chance of hitting an opponent.

This block defines the parameters for the creatures unarmed attack

[unarmed_attack]

Opens the unarmed attack block.

<animation>:attack1

Selects the creature’s attack animation.

<range>:10:14

The monster’s reach.

<damage>:12:25

The min and max damage when unarmed.

<damage_type>:crushing

The unarmed damage type

[/unarmed_attack]

Closes the unarmed attack block.

<strength>:

How much strength a monster has.

<dexterity>:

How much dexterity a monster has.

<vitality>:

How much vitality a monster has.

<magic>:

How much magic a monster has.

<experience>:

How much experience a monster is worth.

<death_sound>:

Sound a monster makes when it dies.

<idle_sound>:

Sound a monster makes when it’s not doing anything.

<roar_sound>:

Sound a monster makes when it roars.

<step_sound>:

Sound a creature makes when it steps.

<strike_sound>:

Sound it makes when it strikes.

<attack_sound>:

Sound a monster makes when it attacks.

<armed_attack_sound>:

Sound it makes when it attacks armed.

<blood_particle>:

What color a creature’s blood is.

<sound_radius>:

How close you have to be to hear a monster’s various noises.

<can_equip>:

What weapons it can equip ( you can take away weapon types, but as far as I know you cannot add weapon types to this ).

<preferred_weapon>:

What weapons a creature is most likely to appear with.

[/monster]

Monster files end with this.

Back to Top

2. An Example

A. Banded Mail

Say you want to make a piece of armor that looks like banded mail, has 100-102 defense, costs 30,000, and is on dungeon levels 45 and up.

Here's what to do:

Copy the banded mail file into a new document in Notepad.

[ITEM]
<TYPE>:SHIRT
<NAME>:Banded Mail
<RARITY>:900
<MINIMUM_DEPTH>:32
<MODEL>:ITEMS/bandedmail.mdl
<ANIMATED_MODEL>:PLAYER/bandedmail.sms
<COLLIDEABLE>:0
<ICON>:ICONS/bandedmail.png:ICONS/bandedmaila.png:96:96
<VALUE>:13571
<TAKEABLE>:1
<ARMOR>:66:71
<DROP_SOUND>:SOUNDS/ITEMS/fall.wav
<TAKE_SOUND>:SOUNDS/ITEMS/plateget.wav
<LAND_SOUND>:SOUNDS/ITEMS/platedrop.wav
<REQUIRES>:STRENGTH:65
<MERCHANT_MINIMUM>:11

[/ITEM]

Change the armor to <armor>:100:102

Change the value to <value>:30000

Change the minimum depth to <minimum_depth>:45

GOOD, now save this in your mods folder in a mod folder called whatever you want. In that mod folder, save it in a folder called “ITEMS” and name it “items.dat”. Make sure you save it as “all files” instead of a text document, or else you’ll get items.dat.txt.

Now, open Mod Manager. Apply your mod and your armor will appear!

You can do the same with monsters and weapons, spells are a little trickier.

B. Adding Effects

You can add effects to all items you can equip. Here’s how.

After all the other stuff but before the [/ITEM] add this:

[EFFECT]
<ACTIVATION>:PASSIVE
<TYPE>:
<DURATION>:INSTANT
<VALUE>:
[/EFFECT]

Then fill in the <type>: with any skill or effect. When you put in skills, the word skill goes first. like this: skillsword, not swordskill. You can also add strength, percentstrength, hprecharge, or any other effect.

Then fill in <value>: with an amount you want to increase your <type>: entry by. For example, if your “type” entry is “percentstrength”, you can enter <value>:10 to get a 10 percent increase to your strength stat.