The C++ script library lives in src/scripts/ and is bound to the database through the
ScriptName columns (creature_template, gameobject_template, map_template,
quest_template, …). This page maps the layout.
| Directory | Contents |
|---|---|
src/scripts/eastern_kingdoms/ |
Zone & dungeon scripts for EK (one folder per zone: elwynn_forest, eastern_plaguelands, …). |
src/scripts/kalimdor/ |
Zone & dungeon scripts for Kalimdor. |
src/scripts/battlegrounds/ |
BG hooks beyond the core implementations. |
src/scripts/spells/ |
Spell-affect scripts registered by spell_template.ScriptName. |
src/scripts/world/ |
World-wide scripts: special NPCs (npcs_special.cpp), generic GO scripts (go_scripts.cpp), event helpers (elemental_invasions.cpp, fireworks_show.cpp…). |
src/scripts/custom/ |
Community additions. |
- The DB row carries the script name, e.g.
UPDATE creature_template SET ScriptName='npc_flame_ring' WHERE entry=12345; - At startup
ScriptLoader.cppregisters allAddSC…functions; each script object adds itself to lookup maps keyed by that name. - At spawn,
FactorySelector::selectAIconsults the script map before any built-in AI - a matchingscript_namealways wins (AI System).
The same name must exist in exactly one script; duplicates are reported at load.
| Use C++ scripts when… | Use EventAI when… |
|---|---|
| custom boss mechanics with phases/timers | standard combat events |
| new spell behaviours | say/emote/summon/cast sequences |
| special gossip handling beyond tables | simple event-driven content |
DB-only content keeps the fork small and is editable with tools like ScriptEditor.