Spell hook scope

According to my tests, the spell hook script doesn’t fire for all spells.

For example, Summon Creature 1 is intercepted by the spell hook, but Summon Familiar by-passes it.

Is this documented anywhere?

Is it hard-coded?

Spells that work with the spellhook have this in their spellscript:

/*
  Spellcast Hook Code
  Added 2003-06-20 by Georg
  If you want to make changes to all spells,
  check x2_inc_spellhook.nss to find out more

*/

    if (!X2PreSpellCastCode())
    {
    // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
        return;
    }

// End of Spell Cast Hook

If something doesn’t have a spellscript or doesn’t have that bit, it won’t fire for it.

2 Likes

Thanks!

@Daz As you’d expect, adding that code to a spell script that doesn’t have it triggers the spell hook.

Are there any known downsides?

Were certain spells excluded from hooking for a good reason?

Summon Familiar is not a spell but feat. Likewise special abilities such as howl of confusion don’t have it.

From regular spells I don’t think there is any missing, but it normally only runs for players, so adding it to mentioned special abilities will no nothing by default anyway.