136 lines
4.3 KiB
Plaintext
136 lines
4.3 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: [Ressurection]
|
|
//:: [NW_S0_Ressurec.nss]
|
|
//:: Copyright (c) 2000 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
//:: Brings a character back to life with full
|
|
//:: health.
|
|
//:: When cast on placeables, you get a default error message.
|
|
//:: * You can specify a different message in
|
|
//:: X2_L_RESURRECT_SPELL_MSG_RESREF
|
|
//:: * You can turn off the message by setting the variable
|
|
//:: to -1
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Preston Watamaniuk
|
|
//:: Created On: Jan 31, 2001
|
|
//:://////////////////////////////////////////////
|
|
//:: Last Updated By: Georg Z on 2003-07-31
|
|
//:: VFX Pass By: Preston W, On: June 22, 2001
|
|
|
|
#include "x2_inc_spellhook"
|
|
#include "hc_inc_pwdb_func"
|
|
#include "hc_text_activate"
|
|
#include "hc_inc_rezpen"
|
|
#include "anph_inc"
|
|
#include "prc_inc_spells"
|
|
#include "hc_inc_remeff"
|
|
|
|
void main()
|
|
{
|
|
|
|
/*
|
|
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 */
|
|
|
|
|
|
//Get the spell target
|
|
object oCastAt = GetSpellTargetObject();
|
|
object oTarget = GetSpellTargetObject();
|
|
object oCaster = OBJECT_SELF;
|
|
int nAtDC;
|
|
object oDC;
|
|
object oMod = GetModule();
|
|
|
|
// HCR Material Components
|
|
if(GetLocalInt(oMod,"MATERCOMP") && GetIsPC(oCaster) && GetIsDM(oCaster)==FALSE)
|
|
{
|
|
object oComp;
|
|
if( (oComp=GetItemPossessedBy(oCaster, "ressdiamond"))==OBJECT_INVALID)
|
|
{
|
|
SendMessageToPC(oCaster,"You do not have the required materials to "+
|
|
"cast this spell. For this spell you need a small diamond.");
|
|
AssignCommand(oCaster, ClearAllActions());
|
|
return;
|
|
}
|
|
else
|
|
DestroyObject(oComp);
|
|
}
|
|
|
|
if(GetTag(oTarget)=="DeathCorpse")
|
|
{
|
|
oDC=oTarget;
|
|
oTarget = AnphFindPlayerByKey (GetLocalString (oDC, "Name"),
|
|
GetLocalString (oDC, "Key"));
|
|
nAtDC=1;
|
|
}
|
|
|
|
//Check to make sure the target is dead first
|
|
if(nAtDC || GetIsDead(oTarget))
|
|
{
|
|
// Target isn't online
|
|
if(nAtDC && GetIsObjectValid(oTarget)==FALSE)
|
|
{
|
|
SendMessageToPC(oCaster,NOTONLINE);
|
|
SetPersistentLocation(oMod,"RESLOC"+
|
|
GetLocalString(oDC,"Name")+
|
|
GetLocalString(oDC,"Key"), GetLocation(oCaster));
|
|
if(GetIsDM(oCaster))
|
|
SetPersistentInt(oMod,"PlayerState"+
|
|
GetLocalString(oDC,"Name")+
|
|
GetLocalString(oDC,"Key"), 8);
|
|
else
|
|
SetPersistentInt(oMod,"PlayerState"+
|
|
GetLocalString(oDC,"Name")+
|
|
GetLocalString(oDC,"Key"), 7);
|
|
return;
|
|
}
|
|
|
|
//Fire cast spell at event for the specified target
|
|
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_RESURRECTION, FALSE));
|
|
|
|
//Declare major variables
|
|
int nHealed = GetMaxHitPoints(oTarget);
|
|
effect eRaise = EffectResurrection();
|
|
effect eHeal = EffectHeal(nHealed + 11);
|
|
effect eVis = EffectVisualEffect(VFX_IMP_RAISE_DEAD);
|
|
|
|
//Apply the heal, raise dead and VFX impact effect
|
|
SetPlotFlag(oTarget, FALSE);
|
|
RemoveEffects(oTarget);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRaise, oTarget);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget);
|
|
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, GetLocation(oCastAt));
|
|
|
|
// Jump the player out of fugue to his corpse
|
|
AssignCommand(oTarget,JumpToObject(oDC));
|
|
}
|
|
else
|
|
{
|
|
if (GetObjectType(oTarget) == OBJECT_TYPE_PLACEABLE)
|
|
{
|
|
int nStrRef = GetLocalInt(oTarget,"X2_L_RESURRECT_SPELL_MSG_RESREF");
|
|
if (nStrRef == 0)
|
|
{
|
|
nStrRef = 83861;
|
|
}
|
|
if (nStrRef != -1)
|
|
{
|
|
FloatingTextStrRefOnCreature(nStrRef,OBJECT_SELF);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|