Site Admin
Metin2 Quest Scripting Fundamentals
Metin2 quest scripting: dungeon quest structure and d.setf() state flags. Metin2's quest system is built on server-side scripts that control progression, state transitions, and reward distribution. This guide covers the fundamental building blocks for creating or modifying dungeon quests.

**Quest file structure**
Quests are defined in .quest files that reference non-player characters (NPCs), map locations, and quest objectives. Each quest has a unique identifier (qid) that the server uses to track progress. The file lists the starting NPC, the required map coordinates, and the sequence of objectives the player must complete.

**d.setf() state flags**
The d.setf() function sets integer state flags that track quest progression. Common flags include:
- Flag 1: Quest started (player has accepted the quest)
- Flag 2: Quest in progress (objectives being completed)
- Flag 3: Quest completed (ready for turn-in)
- Flag 4: Quest failed (objectives not met within time limit)

These flags are checked at each stage using d.getf() to determine what the player has already accomplished. A quest may have multiple flags for different sub-objectives, allowing complex branching paths within a single quest file.

**Server timer and event triggers**
Server timers control quest time limits and event spawns. The server_timer() function sets a real-time clock that fires after a specified number of seconds, while server_loop_timer() repeats at regular intervals. Quest items dropped by Metin Stones often have timer flags that despawn the item if not collected within the allotted time, preventing item clutter on busy servers.

**Floor transitions and map changes**
Quests often require moving between multiple maps. The transition logic uses specific NPC interaction points that trigger a map change when the player meets the prerequisites. Common patterns include: entering a Metin Stone chamber, defeating all spawned monsters, and then the NPC warping the player to the next area. The floor transition coordinates are defined in the map file and must align with the NPC's interaction radius.

**Boss kill events and reward distribution**
When a quest boss is defeated, the server checks the quest state via d.getf() before distributing rewards. The reward table in the quest file specifies experience points, zen (in-game currency), and item drops. Some quests also have conditional rewards - for example, defeating the boss within a time limit may grant an additional bonus item. The bbcode_uid field in each post tracks which reward variant the player received, ensuring correct attribution on the high scores table.

**Common quest modification patterns**
Operators frequently modify existing quests to adjust difficulty or reward rates. Changing the d.setf() flag threshold alters when a quest is considered completed. Modifying the server_timer() duration extends or reduces the time limit for objective completion. Adjusting the mob spawn count in the quest area directly impacts the time required to finish the quest, which is the most common tweak for population-specific server balancing.

Source: Metin2 quest scripting guide https://quickwebtools.app/blog/metin2-q ... geon-guide
Source: Metin2 Wiki - Quest system https://en-wiki.metin2.gameforge.com/index.php/Quest
Source: Metin2 event calendar 2026 https://gameforge.com/en-GB/games/metin ... -2026.html

Information

Users browsing this forum: No registered users and 4 guests