How to Add a Custom NPC to Your Metin2 Private Server
An NPC in Metin2 is defined the same way as a mob — through mob_proto — but with a different AI type and mob rank. Once defined, you spawn it via a regen file and optionally bind it to a Lua quest so players can interact with it.
Use the Mob Proto Editor to edit all mob_proto columns visually without touching raw text files.
Step 1 — Add the mob_proto Entry
Open mob_proto.txt and add a new row for your NPC. Key columns:
| Column | Value | Notes |
|---|---|---|
vnum | e.g. 20100 | Choose an unused VNUM (NPCs often use 20000+) |
name | TradeNPC | Internal name, no spaces |
type | NPC | NPC type (vs MONSTER, STONE, etc.) |
rank | PAWN | PAWN = normal rank |
battle_type | MELEE | NPCs typically do not fight — any value works |
level | 0 | 0 = no level indicator shown |
ai_flag | NOATK | NOATK = NPC will not attack players |
resist_sword | 100 | 100% resistance = cannot be killed |
st | 0 | Stats all 0 for a non-combat NPC |
The most important field is ai_flag. Setting it to NOATK (or NOATK|NOMOVE) prevents the NPC from attacking or wandering. Setting all resists to 100 makes it unkillable.
Step 2 — Add to mob_names.txt
Add the display name shown above the NPC's head:
20100 Trade NPC
Format: VNUM TAB DisplayName. Some distributions use locale_mob.txt instead — check your server's file structure.
Step 3 — Place the Spawn (Regen File)
NPCs are spawned via regen files. Each map has a regen directory, typically:
server/share/maps/MAP_NAME/regen.txt
A regen entry looks like:
f 600 600 10 10 1 20100 1 0
Column breakdown:
f— fixed spawn (does not move on respawn)600 600— X, Y coordinates on the map10 10— spawn area width and height (small = tight cluster)1— respawn time in seconds (use a high value for NPCs, e.g. 99999)20100— the NPC's VNUM1— count to spawn0— mob level override (0 = use mob_proto level)
To find the exact X/Y coordinates you want, use an in-game GM command like /warp or a map editor. Coordinates are in centimeters (1 tile ≈ 100 units).
Step 4 — Bind to a Quest (Optional)
To make the NPC interactive (shop, dialogue, quest giver), create a Lua quest file in your server's quest/ directory:
quest trade_npc begin
state start begin
when 20100.chat."Open Shop" begin
pc.open_shop(SHOP_VNUM)
end
when 20100.chat."Quest Info" begin
say("Welcome, " .. pc.get_name() .. "!")
say("Visit the market and bring me 10 Dragon Stones.")
end
end
end
Key points:
- The trigger
when 20100.chat."TEXT"adds a menu option when a player clicks the NPC pc.open_shop(VNUM)opens a shop window (shop must be defined separately)say()adds a dialogue line to the NPC's speech window- Place the quest file in
server/share/locale/LANG/quest/and reload quests with/reload q
For complex multi-floor dungeon quests, see the Dungeon Quest Generator.
Step 5 — Test In-Game
- Restart the game server (or reload mob_proto and regen files)
- Travel to the map and coordinates where you placed the spawn
- Verify the NPC appears, displays the correct name, and cannot be attacked
- If you added a quest: click the NPC and verify the dialogue options appear
Common Errors
- NPC does not spawn — VNUM not in mob_proto, or regen file not reloaded
- NPC attacks players — ai_flag NOATK missing; add NOATK to the ai_flag column
- NPC can be killed — resists not set to 100; also set
max_hpvery high - No dialogue options — quest file not loaded or wrong VNUM in the when trigger
- NPC spawns but wrong model — check mob_proto model column and client data pack
Related Tools
- Mob Proto Editor — edit mob_proto entries in a spreadsheet view
- TXT ↔ SQL Converter — convert mob_proto between TXT and SQL formats
- Dungeon Quest Generator — generate complex dungeon quests with NPC bindings