Files
Anphillia_PRC8/_module/nss/prc_pw_raisedead.nss
Jaysyn904 28cdb617b3 Initial commit
Adding all of the current content for Anphillia Unlimited.
2024-01-04 07:49:38 -05:00

120 lines
3.9 KiB
Plaintext

//::///////////////////////////////////////////////
//:: [Raise Dead]
//:: [NW_S0_RaisDead.nss]
//:: Copyright (c) 2000 Bioware Corp.
//:://////////////////////////////////////////////
//:: Brings a character back to life with 1 HP.
/*
Anphillia Changes
This spell also works on the body placeables now. Also uses
HCR Material Components if those are set. Also respects Subrace System
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Jan 31, 2001
//:://////////////////////////////////////////////
//:: Last Updated By: Preston Watamaniuk, On: April 11, 2001
//:: 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 "nwnx_object"
#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
//Declare major variables
object oCastAt = GetSpellTargetObject();
object oTarget = GetSpellTargetObject();
effect eRaise = EffectResurrection();
effect eVis = EffectVisualEffect(VFX_IMP_RAISE_DEAD);
int nAtDC;
object oDC;
object oMod = GetModule();
// HCR Material Component Check
if(GetLocalInt(oMod,"MATERCOMP") && GetIsPC(OBJECT_SELF) && GetIsDM(OBJECT_SELF)==FALSE)
{
object oComp;
if( (oComp=GetItemPossessedBy(OBJECT_SELF, "ressdiamond"))==OBJECT_INVALID)
{
SendMessageToPC(OBJECT_SELF,"You do not have the required materials to "+
"cast this spell. For this spell you need a small diamond.");
AssignCommand(OBJECT_SELF, ClearAllActions());
return;
}
else
DestroyObject(oComp);
}
if(GetTag(oTarget)=="DeathCorpse")
{
oDC=oTarget;
oTarget = AnphFindPlayerByKey (GetLocalString (oDC, "Name"),
GetLocalString (oDC, "Key"));
nAtDC=1;
}
if(nAtDC || GetIsDead(oTarget))
{
// If cast at corpse, but the player is offline
if(nAtDC && !GetIsObjectValid(oTarget))
{
SendMessageToPC(OBJECT_SELF,NOTONLINE);
SetPersistentLocation(oMod,"RESLOC"+
GetLocalString(oDC,"Name")+
GetLocalString(oDC,"Key"), GetLocation(OBJECT_SELF));
if(GetIsDM(OBJECT_SELF))
SetPersistentInt(oMod,"PlayerState"+
GetLocalString(oDC,"Name")+
GetLocalString(oDC,"Key"), 8);
else
SetPersistentInt(oMod,"PlayerState"+
GetLocalString(oDC,"Name")+
GetLocalString(oDC,"Key"), 9);
return;
}
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_RAISE_DEAD, FALSE));
//Apply raise dead effect and VFX impact
SetPlotFlag(oTarget, FALSE);
RemoveEffects(oTarget);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, GetLocation(oCastAt));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRaise, oTarget);
// Set player health to 1
effect eDam=EffectDamage(GetCurrentHitPoints(oTarget)-1);
int nBonusCON = abs(GetAbilityScore(oTarget, ABILITY_CONSTITUTION, FALSE) - GetAbilityScore(oTarget, ABILITY_CONSTITUTION, TRUE));
int nHP = 1 + (nBonusCON * GetHitDice(oTarget));
NWNX_Object_SetCurrentHitPoints(oTarget, nHP);
//Jump the player out of Fugue to his body
AssignCommand(oTarget,JumpToObject(oDC));
}
}