Characters & Animation

Creature Editor

Change any monster of the game or make new ones - statistics and level scaling, model and looks, senses, attack timings, loot, AI role, resistances and a Lua script - with a live preview and Test in level.

The Creature Editor (Characters & Animation section) edits every monster of the game and makes new ones. It writes the mod's gamedata/monsters.toml, holding only what differs from the game.

Classes and kinds

The game's creatures come in two layers:

  • A class is a type of creature with its own code: Kobold, Goblin, Skeleton, RedDragon... It decides the model archive, the body, the senses and how it fights.
  • A kind is what a map places: Kobold, koboldtough, skeletonbowred... Each belongs to a class and has its own balance numbers, looks and boss flag. A kind's values override its class's.

Most changes are to kinds. Change a class to change every kind of it.

Finding a creature

The Details panel lists every kind of the game and the mod. Classes too adds the classes; The mod's only shows only what the mod has. Type in the filter to find one. New creatures are green and changed ones amber.

Select one to edit it in tabs. Every key shows the original's value and has its own revert, and every change is an undo step. A key you haven't set shows the value in effect (usually the class's).

The tabs

Creature

The display name and description, its class, its base (for a new kind, the kind it was made from), boss (counts as a boss: no party damage scaling) and boss names (a boss only when its placement's name= is one of these). For classes, the factory order and how a placed name is matched.

Model

  • Archive: the model and animation archive (KOBOLD is BG/DATA/KOBOLD.LMP), or an imported model of any mod (@my-mod/drake, from Model Import or Rigging). Picking another mod's model adds that mod to the mod's requires when you save.
  • Model, texture: entries of the archive.
  • Model variant and looks 1-4: models that hold several looks (goblins' and orcs' helmets and armour by rank) show the meshes of the variant bits, plus one value picked at random from each looks list.
  • The body: radius and height (its size for collision), scale with its random steps and spread, and radius times scale (the radius grows with the scale). When a kind sets scale, a placement's Scale= is ignored, as in the original.
  • Colour: a tint over the texture.

Stats

  • The five balance percentages: health, armor, damage, attack and experience, each a percentage of the game's formula for the creature's level (the original Kobold's health is 69).
  • The senses: pointblank_range, visual_range, visual_arc, home_range (how far it follows before going home), flinch_chance (how often a blow that doesn't kill makes it flinch), turn_rate (full turns a second).
  • A level-scaling table: the health, armour, damage, attack and experience the game rolls at levels 1 to 100, for a rank, a difficulty and a number of Players. Use it to see what your percentages mean in play.

Attacks

The class's animations with their events: up to four time, flags pairs, in seconds. Flag 1 is when a blow lands, so moving it earlier makes a swing hit sooner. Play shows each clip, and Revert puts back the game's.

[anim.Kobold.attack3]
events = [0.4, 1]       # this swing's blow lands at 0.4 s

Loot

  • Drops loot, and its loot: gold scale, gold chance, quality tier and item chance.
  • loot_speed, loot_filter, loot_direct.
  • Give it boss loot rows: writes loot_extra and loot_per_player so a new kind drops like the game's bosses (more rolls, one per player). Revert loot takes them off.
[kind.koboldking]
class = "Kobold"
loot_extra = [4, 1, 6, 2, 5, 1, 7, 2]   # two more rolls: gold scale, gold chance, tier, item chance each
loot_per_player = [8.5, 0.5]            # one roll per player: tier, unique chance

AI

What the class's code decides, each with an override (and R to put the class's back):

Key Means
role The fighting style, picked from every role the game has and the mod's own (AI Behaviours). The role's melee reach, swings, shots, casts, blocks, lunges and combos are listed below it. none keeps the class's own code.
side The monsters' side, or the players' (like the gnomes and friendly wood elves)
race undead (Holy Strike, the undead slays and conversions affect it), vermin (the vermin shock and slay), or none
resist_fire, resist_cold, resist_poison, resist_disease, resist_lightning The share of that damage taken off: 1 is immune, negative takes more
enchant, enchant_chance Its weapon's element, rolled at each spawn
sound_hit The material of the hit sounds a blow on it plays (flesh, plate, stone, bone...)
script A Lua script of monster hooks (below)

More

Other keys, the creature's problems, and the mod's changes to the file.

New creatures

New... makes a creature:

  1. Type a Name. The kind id that maps place is made from it and shown below.
  2. Choose Clone the selected creature (a copy of its numbers and looks), or From scratch, on the class: its behaviour, attacks, animations and model come from the class, and its statistics start at 100%.
  3. Press Create.

Maps place it by its kind id, from the Level Editor's palette under Monsters.

# A new kind, placed as "koboldboss": a Kobold with its own numbers
[kind.koboldboss]
class = "Kobold"
health = 900
damage = 250
scale = 2
boss = true

The preview

The viewport shows the creature as the game loads it: its model, texture, variant, colour and scale. Play its idle, walk or attack (the role's clips), or any clip of its archive, at a speed. A slider for each looks list shows the variant a spawn would pick. Bind pose and Frame help when posing.

Test in level

Test in level saves, then plays a stage in the devkit's window: the chosen level (WATER1 by default) with only a start point and your creature 220 units ahead. Fight it, then Return to Editor (or Ctrl+Shift+Q); the stage map is removed on the way back.

A creature script

The script key gives a creature behaviour in Lua on top of its class's: every creature of the class or kind runs the script's hooks. Pick one of the mod's scripts; it is checked in the sandbox and its hooks are listed. Create it from the template makes a new one.

-- scripts/shaman_mend.lua: heals itself once when badly hurt
function on_hurt(m, amount)
  if not m.data.mended and m.health < m.max_health * 0.3 then
    m.data.mended = true
    rta.heal(m, m.max_health * 0.5)
    rta.particles(m, "spark")
  end
end

The hooks are on_spawn, on_tick, on_hurt and on_death; see Lua scripts.

Saving

Save (or Save All) writes gamedata/monsters.toml with only what differs from the game. The file opens here again from the Content Browser or File > Open File.

# mods/tough-kobolds/gamedata/monsters.toml
[kind.Kobold]
health = 200        # percent; the original is 69
scale = 1.3

Change how creatures fight in AI Behaviours, give them new models with Model Import or Rigging, and new clips with the Animation Editor.