You'll want to enable spellhooking in your module by setting a string variable in Edit>Module Properties>Advanced>Variables with the Name X2_S_UD_SPELLSCRIPT and the Value set to the name of your spellhook script.
Now in your spellhook script you'll use the following relevant functions:
#include "x2_inc_switches"
void main()
{
object oCaster = OBJECT_SELF;
object oTarget = GetSpellTargetObject();
int nSpell = GetSpellId();
int nSpellDC = GetSpellSaveDC();
int nCastLevel = GetCasterLevel(oCaster);
if(nSpell == SPELL_MAGIC_WEAPON)
{
//Do something then execute the default spell script
}
if(nSpell == SPELL_TIME_STOP)
{
//Do something then bypass the default spell script
SetModuleOverrideSpellScriptFinished();
}
}
I use this on my server's "magic forge" to allow casters to create magic items by casting spells directly on the items.
-420
Modifié par 420, 13 novembre 2010 - 06:32 .