diff --git a/.agents/docs/cpp-scripts.md b/.agents/docs/cpp-scripts.md index 1bd4bac084..c7f171bd05 100644 --- a/.agents/docs/cpp-scripts.md +++ b/.agents/docs/cpp-scripts.md @@ -18,6 +18,7 @@ Then declare and call `AddSC_()` from the regional loader (`Spells/spells_ - A `SpellScript`/`AuraScript` without a matching `spell_script_names` row is inert — ship the binding SQL update in the same change as the C++ registration. - Never add `UNIT_FLAG*` / `UNIT_FLAG2*` / `UNIT_DYNFLAG*` values without sniff or upstream evidence; the same flag used in another script is not evidence. - Trigger NPCs (`creature_template.flags_extra` 0x80) have no threat list — `SelectTarget` / `AddThreat` / `UpdateVictim` chains on them silently do nothing. A never-evading helper NPC left on a boss's threatened-by list also stalls the boss's evade/reset forever; make such helpers `IMMUNE_TO_NPC`. +- `InstanceScript` object storage (the `ObjectData` tables passed to `LoadObjectData`) maps each listed entry to a `DATA_*` slot holding a single guid: `OnCreatureCreate` overwrites that slot unconditionally and `OnCreatureRemove` erases it when the current holder despawns. Summoning a second creature with an entry in that table redirects every `instance->GetCreature(DATA_X)` to the summon and, once it despawns, leaves the slot empty while the original spawn still lives. Never summon an entry that is in the `ObjectData` table; use a dedicated entry or track the summon through the summoner's `SummonList`/guid member. - A spell id missing from Wowhead is inconclusive — check the world DB's `spell_dbc` table (server-side spells) before concluding a sniffed id doesn't exist. Custom (non-upstream) scripts go in `src/server/scripts/Custom/` (gitignored).