63 lines
1.8 KiB
Plaintext
63 lines
1.8 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Name x2_def_spellcast
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Default On Spell Cast At script
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Keith Warner
|
|
//:: Created On: June 11/03
|
|
//:://////////////////////////////////////////////
|
|
|
|
void main()
|
|
{
|
|
|
|
//--------------------------------------------------------------------------
|
|
// GZ: 2003-10-16
|
|
// Make Plot Creatures Ignore Attacks
|
|
//--------------------------------------------------------------------------
|
|
if (GetPlotFlag(OBJECT_SELF))
|
|
{
|
|
return;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------
|
|
// Execute old NWN default AI code
|
|
//--------------------------------------------------------------------------
|
|
|
|
int nSpell = GetLastSpell();
|
|
object oCaster = GetLastSpellCaster();
|
|
|
|
// SpeakString("Spellcast: " + IntToString(nSpell) + " Caster: " + GetName(oCaster));
|
|
if ( oCaster == OBJECT_SELF || !GetIsEnemy(oCaster) )
|
|
{
|
|
// SpeakString("Not Hostile Spell");
|
|
return;
|
|
}
|
|
|
|
|
|
if ( GetLocalInt(OBJECT_SELF,"Immune_" + IntToString(nSpell) ) )
|
|
{
|
|
// SpeakString("Already Immune");
|
|
return;
|
|
}
|
|
SetLocalInt(OBJECT_SELF,"Immune_" + IntToString(nSpell),1 );
|
|
|
|
effect eImmune = EffectSpellImmunity(nSpell);
|
|
// if ( GetIsEffectValid(eImmune) )
|
|
// {
|
|
eImmune = SupernaturalEffect(eImmune);
|
|
eImmune = ExtraordinaryEffect(eImmune);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eImmune,OBJECT_SELF);
|
|
SendMessageToPC(oCaster,"The Infernal is now immune to that spell!");
|
|
// }
|
|
// else
|
|
// {
|
|
// SpeakString("eImmune is Invalid");
|
|
// }
|
|
|
|
ExecuteScript("nw_c2_defaultb", OBJECT_SELF);
|
|
|
|
}
|