84 lines
4.0 KiB
Plaintext
84 lines
4.0 KiB
Plaintext
////////////////////////////////////////////////////////////////////////////////
|
|
// wazoo_spellhook - Custom spells out the wazoo spell hook
|
|
// By Deva Bryson Winblood.
|
|
//------------------------------------------------------------------------------
|
|
// NOTE: This spellhook is required for some of the spells in the wazoo package
|
|
// to execute. We realize, you may have an additional spellhook. If that is the
|
|
// case simply define it on the module as sWAZOOSPELLHOOK and it will be called
|
|
// after any special conditions for WAZOO are checked here.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
#include "prc_inc_spells"
|
|
|
|
void main()
|
|
{
|
|
object oMod=GetModule();
|
|
string sWAZOOHOOK=GetLocalString(oMod,"sWAZOOSPELLHOOK");
|
|
object oCaster=OBJECT_SELF;
|
|
object oTarget=PRCGetSpellTargetObject();
|
|
int bContinue=TRUE;
|
|
int nID=PRCGetSpellId();
|
|
int nN;
|
|
string sOnCastAt=GetLocalString(oTarget,"sWAZOOONSPELLCASTAT");
|
|
if (GetLocalInt(oCaster,"bContingency"))
|
|
{ // suck the spell into contingency
|
|
SetLocalInt(oCaster,"nContingencySpell",nID);
|
|
DeleteLocalInt(oCaster,"bContingency");
|
|
SetLocalInt(OBJECT_SELF,"X2_L_BLOCK_LAST_SPELL",TRUE);
|
|
SendMessageToPC(oCaster,Get2DAString("spells","Label",nID)+" is stored in your contingency spell! Warning you can only have one active contingency at a time!");
|
|
nN=GetLocalInt(oCaster,"nContingencyType");
|
|
if (nN!=8&&nN!=9) ExecuteScript("wazoo_ex_conmon",oCaster);
|
|
return;
|
|
} // suck the spell into contingency
|
|
if (GetLocalInt(oTarget,"nContingencySpell")>0&&oCaster!=oTarget)
|
|
{ // target has a contingency spell
|
|
nN=GetLocalInt(oTarget,"nContingencyType");
|
|
if (nN==8)
|
|
{ // trigger contingency - fire spell back at caster
|
|
nN=GetLocalInt(oTarget,"nContingencySpell");
|
|
DeleteLocalInt(oTarget,"nContingencySpell");
|
|
DeleteLocalInt(oTarget,"nContingencyType");
|
|
AssignCommand(oTarget,ClearAllActions());
|
|
AssignCommand(oTarget,ActionCastSpellAtObject(nN,oCaster,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
SendMessageToPC(oTarget,"Your contingency stored spell has been used.");
|
|
} // trigger contingency - fire spell back at caster
|
|
else if (nN==9)
|
|
{ // trigger contingency - fire spell at self
|
|
nN=GetLocalInt(oTarget,"nContingencySpell");
|
|
DeleteLocalInt(oTarget,"nContingencySpell");
|
|
DeleteLocalInt(oTarget,"nContingencyType");
|
|
AssignCommand(oTarget,ClearAllActions());
|
|
AssignCommand(oTarget,ActionCastSpellAtObject(nN,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
SendMessageToPC(oTarget,"Your contingency stored spell has been used.");
|
|
} // trigger contingency - fire spell at self
|
|
} // target has a contingency spell
|
|
if ((GetLocalInt(oTarget,"nIsVampire")||GetLocalInt(oTarget,"bIsLich"))&&((nID>430&&nID<435)||nID==77))
|
|
{ // inflict spells
|
|
SetLocalInt(OBJECT_SELF,"X2_L_BLOCK_LAST_SPELL",TRUE);
|
|
nN=33;
|
|
if(nID==432) nN=32;
|
|
else if (nID==433) nN=34;
|
|
else if (nID==434) nN=35;
|
|
else if (nID==435) nN=31;
|
|
else if (nID==77) nN=79;
|
|
AssignCommand(oCaster,ClearAllActions());
|
|
AssignCommand(oCaster,ActionCastSpellAtObject(nN,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
return;
|
|
} // inflict spells
|
|
//SendMessageToPC(oCaster,"wazoo_spellhook: You cast a spell on "+GetName(oTarget)+" with sOnCastAt set to '"+sOnCastAt+"'.");
|
|
if (GetStringLength(sOnCastAt)>0)
|
|
{
|
|
ExecuteScript(sOnCastAt,oCaster); // note the caster calls the script
|
|
bContinue=GetLocalInt(oCaster,"bWAZOOCONTINUE");
|
|
DeleteLocalInt(oCaster,"bWAZOOCONTINUE");
|
|
}
|
|
// Set bContinue to FALSE if you want the script to end after this one
|
|
if (bContinue!=TRUE)
|
|
{ // Abort
|
|
SetLocalInt(OBJECT_SELF,"X2_L_BLOCK_LAST_SPELL",TRUE);
|
|
} // Abort
|
|
else if (GetStringLength(sWAZOOHOOK)>0)
|
|
{ // execute other script
|
|
ExecuteScript(sWAZOOHOOK,oCaster);
|
|
} // execute other script
|
|
}
|