How to Create and Edit NPCs on Your MU Online Server
Learn how to create, position, and configure NPCs on your MU Online private server by editing the right files and understanding NPC data structures.
NPCs (Non-Player Characters) are the backbone of player interaction on any MU Online private server. They handle shops, quests, teleportation, item crafting, and much more. Understanding how to create and edit them correctly means you can fully customize the experience for your players without breaking server stability.
This guide covers the core files involved, the data structure behind NPC definitions, how to place them on maps, and how to troubleshoot common problems.
Understanding the NPC System Architecture
Before touching any file, it helps to understand how the server resolves NPC data at runtime.
When the GameServer starts, it reads a set of text-based configuration files and loads each NPC definition into memory. Every NPC has two separate concerns that live in separate files:
- Identity and spawn — what type of NPC it is and where it appears on the map.
- Behavior and inventory — what the NPC does (sells items, grants quests, teleports players, etc.).
The most common files you will work with are:
| File | Purpose |
|---|---|
MonsterSetBase.txt | Spawn positions, map, direction, count |
MonsterInfo.txt | NPC display name, stats, type flags |
ShopItemList.txt | Items sold by merchant NPCs |
MerchantList.txt (some seasons) | Alternative merchant item tables |
Server emulators based on Season 6 and Season 9 source code follow this pattern closely. Seasons above 12 may use a database-driven approach instead of flat text files — consult your emulator's documentation for the exact file names.
Data/ directory of your GameServer and look for files matching the patterns above. Some releases prefix them with the season number (e.g., S6_MonsterSetBase.txt).Editing MonsterSetBase.txt to Place an NPC
The MonsterSetBase.txt file is where every spawn on the server is declared. Open it with a plain-text editor (Notepad++ with UTF-8 encoding is recommended to avoid character corruption).
Each non-comment line follows this column layout:
// Map Type X Y Dir Ground Distance Count RespawnInterval
0 226 125 125 1 0 0 1 0
// → Map 0 = Lorencia
// → Type 226 = David (Potion Seller)
// → X=125, Y=125 → coordinates on the map grid
// → Dir=1 → NPC faces south
// → Ground=0 → standard ground spawn
// → Distance=0 → no patrol radius (stationary)
// → Count=1 → one instance
// → RespawnInterval=0 → NPCs do not respawn after being removed; use 0 for static NPCs
To add a new NPC, append a new line with valid values:
// Adding a custom NPC (type 540) to Noria at position 170, 100
33 540 170 100 2 0 0 1 0
// → Map 33 = Noria
// → Type 540 → must match an entry in MonsterInfo.txt
// → Dir=2 → faces west
// → All other fields remain default for a static NPC
> [!WARNING] > Never use the same coordinates as an existing NPC of the same type. Overlapping spawns cause client-side rendering glitches and may trigger collision logic that makes one of the NPCs unclickable. Offset new entries by at least 2 tiles in any direction.
Directions follow a clockwise numbering convention on most emulators:
// Direction values
// 0 → North
// 1 → South
// 2 → West
// 3 → East
// 4 → Northeast
// 5 → Northwest
// 6 → Southeast
// 7 → Southwest
Defining NPC Identity in MonsterInfo.txt
Every type ID referenced in MonsterSetBase.txt must have a corresponding entry in MonsterInfo.txt. If the type ID is missing, the server either skips the spawn or crashes during initialization depending on the emulator version.
A typical MonsterInfo.txt entry looks like this:
// ID Name Level HP MP Atk Def MoveSpeed AttackSpeed Flags
540 "Custom Guard" 1 9999 0 0 9999 0 0 NPC
// → ID=540 → must match the Type column in MonsterSetBase.txt
// → Level=1 → NPCs typically use level 1 regardless of function
// → HP=9999 → high HP makes them unkillable in most configurations
// → Atk=0, Def=9999 → typical for non-combat NPCs
// → MoveSpeed=0 → stationary NPC
// → Flags=NPC → marks entity as non-aggressive and interactable
The Flags field is critical. Common values include:
// Flag values (may be combined with | depending on the emulator)
// NPC → Friendly, non-aggressive, player-interactable
// MONSTER → Aggressive, combat entity
// GUARD → Attacks monsters near players (town guards)
// MERCHANT → Opens shop interface on interaction
// QUEST → Opens quest dialog on interaction
> [!TIP] > If your emulator uses numeric flags instead of named constants, check the source code or the emulator's documentation for the bitmask table. A common pattern is: 0 = monster, 1 = NPC, 2 = merchant. Using the wrong flag causes the client to treat your peaceful shopkeeper as an enemy.
Configuring a Merchant NPC Shop
Once the NPC is placed on the map and its identity is defined, you can configure what it sells. Open ShopItemList.txt and locate the section for your NPC type ID (some files group items by NPC ID as a section header).
// ShopItemList.txt structure
// NPC_Type Slot ItemGroup ItemNumber DurOrLevel SkillFlag LuckFlag OptionFlag Price
540 0 0 0 0 0 0 0 2000
// → NPC 540, Slot 0 → sells Small Healing Potion (Group 0, Number 0)
// → DurOrLevel=0 → base durability/level
// → All enhancement flags = 0 → plain item, no skill/luck/option
// → Price=2000 → Zen cost to the player
540 1 0 1 0 0 0 0 3000
// → Slot 1 → sells Medium Healing Potion (Group 0, Number 1)
540 2 0 2 0 0 0 0 5000
// → Slot 2 → Large Healing Potion (Group 0, Number 2)
Keep slot numbers sequential starting from 0. Gaps in slot numbers may cause the shop to display empty cells, which looks broken to players. The maximum number of shop slots varies by client version — Season 6 clients typically support up to 40 items per merchant.
Reloading and Verifying Changes
After saving all edited files, the changes need to be loaded by the server. The standard procedure is:
- Stop the GameServer process cleanly using its shutdown command or the server manager interface.
- Verify that the files you edited are saved in the correct encoding (UTF-8 without BOM for most emulators, ANSI for older ones).
- Start the GameServer and watch the startup log output. Any malformed lines in
MonsterSetBase.txtorMonsterInfo.txtwill print an error or warning with the line number. - Connect with a game client and navigate to the map where you placed the NPC.
- Open the server console and use the position display command (usually
/posin-game or a GM command) to confirm you are standing near the correct coordinates.
> [!TIP] > Many server emulators include a GM command that reveals all nearby NPCs with their type IDs displayed above them. Enable this during testing so you can visually confirm your NPC spawned with the correct ID before moving on to inventory configuration.
Common issues and what they mean:
- NPC is invisible — the type ID in
MonsterSetBase.txtis missing fromMonsterInfo.txt, or the client's creature files do not contain a model for that ID. - NPC is a red monster instead of an NPC — the
Flagsfield is wrong; the client is treating it as an aggressive entity. - Shop opens but is empty — the NPC type ID in
ShopItemList.txtdoes not match the type ID inMonsterSetBase.txt, or the item group/number combination is invalid. - Server crashes on startup — a malformed line exists in one of the edited files; check the server log for the exact line number and correct the syntax.
Summary
Creating and editing NPCs on a MU Online server is a multi-file process. You define spawn positions in MonsterSetBase.txt, declare NPC identity in MonsterInfo.txt, and configure merchant behavior in ShopItemList.txt. Each file references the same NPC type ID, so consistency across all three files is essential.
Start with a single test NPC on an easily accessible map like Lorencia, verify each step before moving to the next file, and always keep backups of the original files before making changes. This systematic approach will save hours of troubleshooting and give you full confidence when deploying more complex NPC configurations to a live server.
Perguntas frequentes
What file controls NPC spawn positions?
The main file is MonsterSetBase.txt (or its equivalent in your server season), located in the Data folder. Each line defines a NPC/monster entry with map ID, coordinates, direction, and respawn settings.
Can I add a custom NPC that sells specific items?
Yes. You first define the NPC in MonsterSetBase.txt with the correct type ID, then configure its shop inventory in the ShopItemList (or MerchantList) files, linking the NPC type ID to the item table you want it to sell.
What happens if I use coordinates outside the map boundaries?
The NPC will either fail to spawn silently or appear at position 0,0. Always cross-reference your coordinates against the walkable area of the map using a map editor or the server's debug log output.
Do I need to restart the server after editing NPC files?
In most Season 6 and later server emulators, you need at minimum a GameServer restart for NPC changes to take effect. Some emulators support a partial reload command (/reloadnpc or similar console command), but a full restart is the safest approach.