> For the complete documentation index, see [llms.txt](https://axiomemu.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://axiomemu.gitbook.io/docs/data/monster.md).

# Monster Configuration

The Monster system controls all NPC and monster behavior in the game including spawning, stats, AI, and skills.

## Configuration Files

### Core Monster Definitions

| File                                         | Purpose                                        |
| -------------------------------------------- | ---------------------------------------------- |
| [Monster.xml](/docs/data/monster/monster.md) | Monster stats, levels, resistances, regen time |

### Spawn Configuration

| File/Directory                                                           | Purpose                                                                                   |
| ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------- |
| [MonsterSetBase/](/docs/data/monster/monstersetbase.md)                  | Directory containing per-map spawn files (e.g., `000 - Lorencia.xml`, `002 - Devias.xml`) |
| [KanturuMonsterSetBase.xml](/docs/data/monster/kanturumonstersetbase.md) | Kanturu event map spawns (loaded separately by the Kanturu system)                        |

{% hint style="info" %}
**How spawns load**: The server scans the `MonsterSetBase/` directory and loads every `.xml` file found. There is no master registry file; files load alphabetically.
{% endhint %}

### Monster Skills

| File                                                                         | Purpose                                           |
| ---------------------------------------------------------------------------- | ------------------------------------------------- |
| [MonsterSkill.xml](/docs/data/monster/monsterskill.md)                       | Assigns skills to specific monsters               |
| [MonsterSkillUnit.xml](/docs/data/monster/monsterskill.md#skill-units)       | Defines skill behaviors (targeting, scope, delay) |
| [MonsterSkillElement.xml](/docs/data/monster/monsterskill.md#skill-elements) | Defines skill effects (damage, debuffs, buffs)    |

### Advanced AI System

| File                                                             | Purpose                                                                                             |
| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| [MonsterAIGroup.xml](/docs/data/monster/monsteraigroup.md)       | Assigns AI personalities to monster spawns                                                          |
| [MonsterAIUnit.xml](/docs/data/monster/monsteraiunit.md)         | Defines complete AI personalities (links automata to actions)                                       |
| [MonsterAIAutomata.xml](/docs/data/monster/monsteraiautomata.md) | State machine definitions (when to change behavior)                                                 |
| [MonsterAIElement.xml](/docs/data/monster/monsteraielement.md)   | Atomic AI actions (what to do in each state)                                                        |
| [MonsterAIRule.xml](/docs/data/monster/monsterairule.md)         | Time-scheduled per-class AI Unit overrides (shipped file is empty; loader and dispatcher are wired) |

{% hint style="warning" %}
**AI System vs Basic Spawns**: Most monsters use basic spawns from MonsterSetBase files. The AI system (MonsterAI\*.xml) is only used for advanced boss mechanics, invasion events, and Kanturu stage groups.
{% endhint %}

## File Location

All monster configs are in: `Data/Monster/`

Basic spawn files are in: `Data/Monster/MonsterSetBase/` (directory with per-map XML files)

{% hint style="info" %}
**How spawns load**: The GameServer scans `MonsterSetBase/` directory and loads ALL `.xml` files found. Each file is named by map number and name (e.g., `000 - Lorencia.xml`, `002 - Devias.xml`). There is no master registry file controlling which maps load.
{% endhint %}

## Workflow Overview

### Adding a New Monster

1. **Define stats** in [Monster.xml](/docs/data/monster/monster.md) - Add `<Info>` entry with unique Index, stats, resistances, RegenTime
2. **Assign skills** (optional) in [MonsterSkill.xml](/docs/data/monster/monsterskill.md) - Add `<Monster>` entry linking monster Index to skill units
3. **Configure spawns** - Choose one method:
   * **Basic spawn**: Edit appropriate map file in [MonsterSetBase/](/docs/data/monster/monstersetbase.md) directory
   * **Advanced AI spawn**: Create entries in [MonsterAIGroup.xml](/docs/data/monster/monsteraigroup.md) with AI personality

### Modifying Monster Behavior

* **Change stats** - Edit Monster.xml (Level, Life, DamageMin/Max, Defense, etc.)
* **Change spawn density** - Edit Count attribute in map-specific MonsterSetBase/\*.xml file (Type 1 or 3 only)
* **Change spawn locations** - Edit X/Y (and TX/TY for Type 1/3) coordinates in map-specific file
* **Change respawn time** - Edit RegenTime in Monster.xml (in seconds, server multiplies by 1000)
* **Add/remove skills** - Edit MonsterSkill.xml (add or remove `<Monster>` entry)
* **Change AI behavior** - Edit MonsterAIGroup.xml (for AI-controlled monsters only)

### Creating Custom Skills

1. **Define effects** in [MonsterSkillElement.xml](/docs/data/monster/monsterskill.md#skill-elements) - Create Element entries
2. **Define behavior** in [MonsterSkillUnit.xml](/docs/data/monster/monsterskill.md#skill-units) - Create Unit entry referencing Elements
3. **Assign to monster** in [MonsterSkill.xml](/docs/data/monster/monsterskill.md) - Reference Unit index

## Important Concepts

### Spawn File Loading Behavior

The GameServer loads monster configuration files at startup in this order:

1. `KanturuMonsterSetBase.xml` - Kanturu event spawn list (200-entry table)
2. `MonsterAIAutomata.xml`, `MonsterAIElement.xml`, `MonsterAIGroup.xml`, `MonsterAIRule.xml`, `MonsterAIUnit.xml`
3. `Monster.xml` - Monster stat definitions
4. All `.xml` files in the `MonsterSetBase/` directory (one file per map), appended into one global table
5. `MonsterSkillElement.xml`, `MonsterSkillUnit.xml`, `MonsterSkill.xml`

After step 4 the server logs `[MonsterSetBase] loaded N / 20000 entries`, and `[MonsterSetBase] CAP HIT` if the table filled.

**Spawn directory loading behavior:**

* Server scans the appropriate spawn directory and loads ALL `.xml` files found
* Files are processed in alphabetical order by filename
* If you add a new map spawn file, just place it in the directory - no registry file needed
* No master spawn registry file exists

{% hint style="warning" %}
**No Master Registry**: There is NO master spawn registry file. The server scans the `MonsterSetBase/` directory and loads every `.xml` file inside it. No `MonsterSetBase.xml` ships at the parent level and the loader does not look for one.
{% endhint %}

### Monster Index

Every monster has a unique Index number used throughout all configs:

* 0-99: Common monsters (Bull Fighter, Spider, etc.)
* 200-299: NPCs (Trainers, merchants, guards)
* 300+: Special monsters and bosses

### Spawn Types

| Type | Behavior                                                                                  | Use Case                                                                |
| ---- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| 0    | Fixed position                                                                            | NPCs, guards, bosses                                                    |
| 1    | Count monsters in rectangle defined by X,Y and TX,TY                                      | Normal monster groups                                                   |
| 2    | Single monster, X/Y offset by +/-3 at load time                                           | Scattered spawns                                                        |
| 3    | Same as Type 1 but filtered out of normal init; activated by Invasion Manager using Value | Invasions, White Wizard, custom events                                  |
| 4    | Single monster at fixed X/Y; filtered out of normal init; activated by event code         | Blood Castle, Devil Square, Illusion Temple, Imperial Guardian, Raklion |

{% hint style="info" %}
**Type 1 vs Type 2**: Type 1 spawns require TX/TY coordinates defining a spawn area and a Count field. Type 2 has no TX/TY and no Count; the loader offsets the configured X/Y by a random value in the range -3..+3 once at load time.
{% endhint %}

{% hint style="warning" %}
**Types 3 and 4 are skipped during normal map initialization.** They are held in the spawn table and only instantiated when an event system (Invasion Manager, Blood Castle, Devil Square, Illusion Temple, Imperial Guardian, Raklion, Crywolf, Castle Siege, Chaos Castle) scans the table and spawns matching entries on its own schedule.
{% endhint %}

### Skills System

Skills are modular:

* **Elements** define effects (damage, stun, heal)
* **Units** combine Elements into a complete skill
* **MonsterSkill** assigns Units to monsters

A monster can have up to 6 skill unit slots.

## Dependencies

### Basic Monster System

```
Monster.xml (defines stats, RegenTime by Index)
    ↑
    | (references monster Index)
    |
MonsterSetBase/*.xml (spawns monsters at locations)
```

### Skill System

```
Monster.xml (monster Index)
    ↑
    | (references monster Index)
    |
MonsterSkill.xml (assigns skill units to monsters)
    ↓ (references unit Index)
MonsterSkillUnit.xml (skill behavior)
    ↓ (references element Index)
MonsterSkillElement.xml (skill effects)
```

### Advanced AI System

```
MonsterAIGroup.xml (spawns monsters with AI)
    ↓ (references StartAI, AI01-03)
MonsterAIUnit.xml (AI personality)
    ↓ (references Automata + Elements)
    |
    +→ MonsterAIAutomata.xml (state transitions)
    +→ MonsterAIElement.xml (actions in each state)
```

## Common Tasks

### Increase Monster Difficulty

1. Edit Monster.xml - Increase Level, DamageMin/Max, Defense
2. Optionally add skills in MonsterSkill.xml

### Add Boss Spawn

1. Ensure boss exists in Monster.xml with proper stats
2. Add Type="0" entry in appropriate map file with fixed X/Y
3. Set high RegenTime in Monster.xml (e.g., 3600 = 1 hour)

### Create Monster-Dense Zone

1. Find the appropriate map file in `Data/Monster/MonsterSetBase/` directory
2. Add multiple `Type="1"` entries with same `Class` attribute
3. Set `Count` attribute to desired density (e.g., `Count="20"` for 20 monsters per spawn point)
4. Define spawn area with `X`, `Y`, `TX`, `TY` coordinates (monsters spawn randomly within this rectangle)

### Disable Monster Skills

1. Find monster Index in MonsterSkill.xml
2. Change UnitType/UnitIndex to "\*" (wildcard) to disable slots
3. Or remove entire Monster entry

## Related Pages

* [Kanturu event state machine](/docs/data/event/kanturu.md) - Stage timing that drives `KanturuMonsterSetBase.xml` spawn groups
* [MapManager](/docs/data/mapmanager.md) - Map index table; spawn entries on maps not enabled here are dropped at load time

## Next Steps

* [Monster Stats Configuration](/docs/data/monster/monster.md) - Define monster attributes
* [Monster Spawning](/docs/data/monster/monstersetbase.md) - Configure spawn locations and density
* [Monster Skills](/docs/data/monster/monsterskill.md) - Assign and create monster skills
