Custom Classes

You may now create your own class by mixing existing skills, which only requires basic XML knowledge. You will need to create three different files for that purpose: a class definition (which lists the name of the class, its associated trait, its abilities, whether it is a mage, a fighter, or both, and a few more things), a trait definition (the trait that grants the class, its descriptions and effects on stats), and the learning item definition. Additionally, you will need to have three images (the class icon, an empty version of it, and an icon for the learning item), though you could just use existing images with a slight immersion break.

If you have questions about this, go on the RWoM Discord, where I go by Metalocif, and ping me!

### Class Definition

The Shadow is implemented as a custom class, so you may take inspiration from its file, called TM\_CustomClassDef, found in the CustomDefs folder. The file is heavily commented with explanations from the mod creator.

In the Shadow's file, copy everything from the first <li> to the last </li>, and paste that underneath that last </li>. Congratulations: you just added a class to the custom class roster! Unfortunately, it is but a copy of the Shadow right now.

The most important thing is the abilities. If you want to give a class an ability, you have to find the ability's defName in the class' abilities file. Typically, an ability's def name will be written as TM\_TheAbilityNameInCamelCaseWithoutSpaces, but some abilities do not follow that format. To add an ability, just follow the existing format, where you write the ability's defName between <li> tags. If I wanted to give the Shadow access to the Fireball spell, I'd add, after its existing mage spells, <li>TM\_Fireball</li>.

Note that, if the spell itself can be upgraded (with levels going from 0 to 3, like Spite or Blink), you must specify its four levels (so, to add Spite to the Shadow's spells, I'd have to add <li>TM\_Spite</li>, <li>TM\_Spite\_I</li>, <li>TM\_Spite\_II</li>, <li>TM\_Spite\_III</li>).

If your ability has a linked ability (like how Sentinel gives access to the Shatter Sentinel ability, or how Shapeshift gives access to the Shapeshift - Dire Wolf spell), you need the main ability, otherwise the linked ability will not work.

Trait-based abilities (passive that change the pawn's trait on being leveled, like Ranger Training) will not work unless your custom class uses that class trait.

Some classes have access to learnable spells. There are two cases: the spells that can be upgraded and first need to be unlocked by scrolls, and the ones that cannot be upgraded. Let's say you want to give your class access to the Meteor master spell. You will then add an ability to the list of spells, but you also need to add a scroll to the list of scrolls that can be read by the class. Typically, a spell's scroll's defName will be written as SpellOf\_TheAbilityNameInCamelCaseWithoutSpaces, but some abilities do not follow that format. If you wanted your class to have access to the Blank Mind spell, however, you would just add <li>SpellOf\_BlankMind</li> to the list of learnable spells.

Spells that are accessible to all mages and fighters (cantrips) do not need to be added to the list.

Taking the rest in order from the top:

- the **class trait** is the internal name of the class trait, which is not necessarily the name of the class that will be seen during play.

- the **trait degree** should be 4.

- the **class hediff** can be blank, except if your class needs to use psionic energy (in which case you'd write "<li>TM\_PsionicHD</li>", the def name for a critical hediff); it assigns an hediff the class will cause (making the pawn undead, for instance), you can look at the hediffs file for the list of all hediff names in the mod, or you can create your own custom hediff.

- the **class texture path** and **icon path** are the internal names for the icons the class will use. If your names here are wrong, the game will not find the icon you created for the class. The class icon color is the color that will fill the second of the two icons, as we will see later.

- the **torn script** is the internal name for the item that teaches some, but not all, of the class' spells and skills. It is not necessary. The **full script** is the internal name for the item that teaches all of the class' spells and skills. It is necessary, unless you start with Prepare Carefully and assign the class trait.

- **isMage** and **isFighter** give the class a mana/stamina bar. Use "true" to make the class a mage/fighter, use "false" to make them not a mage or not a fighter.

- **isNecromancer** makes the class a necromancer, draining mana to sustain undead. isUndead makes the class undead, which only means that the class is damaged by healing from the Heal, Advanced Heal, Healing Circle, and Regeneration spells. The "TM\_Undead" hediff means that the pawn is considered undead, with all of the associated perks and effects. Note that, if the class has that hediff, it dies if there is no Necromancer on the map.

- **isAndroid** makes the class an android, for compatibility with the Technomancer (Technobit automatically repairs androids, Overdrive boosts them).

- **isAdvancedClass** should not be used.

### Trait Definition

Your class exists, but it must be tied to a trait. Copy a trait from the Traits file, found in TraitDefs, and replace the following:

- its **defName**, the internal name the trait has, as far as the game is concerned. This must be the same name you gave your class in the classTrait field.

- its **label**, the name that will be displayed to the player, the class' actual name.

- its **description**, the blurb that is displayed when the player hovers on the trait. It is written as plain text; however, to display the pawn's name, you use [PAWN\_nameDef], to display the pawn's pronoun (he/she) you use [PAWN\_pronoun], to display the pawn's objective pronoun (him/her) you use [PAWN\_objective], and to display the pawn's possessive pronoun (his/hers) you use [PAWN\_possessive].

- its **stat offsets**, the effect the trait has on the pawn's stats. You can alter many stats, most of them already exist from one class or another, so look it up in the file to find the right syntax.

### Learning Item Definition

The easiest part! Just replace the following:

- **defName**, giving the book a new internal name, which must be the same as the one in the class definition.

- **label**, the name that will be displayed.

- **description**, the item's descriptive blurb.

- in graphic data, **texPath**, the file path, starting from the Textures folder, to the file that contains the image for the book. If you do not have an image to use, just reuse an existing one.

### Class Icons

A class has two icons: one that is displayed in the colonist bar, next to the pawn's portrait, and the other displayed next to the pawn's head. The mod will expect to find the custom icon in the Textures\Others folder, and the regular icon in the Textures\Others\ClassTextures folder. The only difference between the two is that the custom icon is expected to be mostly white, with the classIconColor you specified in the class file filling it. That color is described with two numbers from 0 to 1, in the RGB (red, green, blue) format. Increase the first number for a redder color, the second number for a greener color, the third number for a bluer color.

### Custom Abilities

We now have support for custom abilities, which means you are not restricted to mixing and matching existing abilities anymore! See here.