Initial commit
Adding all of the current content for Anphillia Unlimited.
This commit is contained in:
134
_module/nss/nw_s0_res.nss
Normal file
134
_module/nss/nw_s0_res.nss
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
nw_s0_res.nss
|
||||
|
||||
Raise Dead, Resurrection
|
||||
|
||||
By: Flaming_Sword
|
||||
Created: Jun 16, 2006
|
||||
Modified: Jun 16, 2006
|
||||
|
||||
Consolidation of 2 scripts, cleaned up
|
||||
*/
|
||||
|
||||
#include "prc_sp_func"
|
||||
#include "anph_inc"
|
||||
#include "hc_text_activate"
|
||||
#include "hc_inc_pwdb_func"
|
||||
|
||||
|
||||
//Implements the spell impact, put code here
|
||||
// if called in many places, return TRUE if
|
||||
// stored charges should be decreased
|
||||
// eg. touch attack hits
|
||||
//
|
||||
// Variables passed may be changed if necessary
|
||||
int DoSpell(object oCaster, object oTarget, int nCasterLevel, int nEvent)
|
||||
{
|
||||
int nSpellID = PRCGetSpellId();
|
||||
int bRes = (nSpellID == SPELL_RESURRECTION);
|
||||
|
||||
|
||||
if (GetIsObjectValid(oTarget))
|
||||
{
|
||||
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, nSpellID, FALSE));
|
||||
if (GetIsDead(oTarget))
|
||||
{
|
||||
SPApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(), oTarget);
|
||||
if(bRes) SPApplyEffectToObject(DURATION_TYPE_INSTANT, PRCEffectHeal(GetMaxHitPoints(oTarget) + 10, oTarget), oTarget);
|
||||
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_RAISE_DEAD), GetLocation(oTarget));
|
||||
ExecuteScript(bRes ? "prc_pw_res" : "prc_pw_raisedead", oCaster);
|
||||
if(GetPRCSwitch(PRC_PW_DEATH_TRACKING) && GetIsPC(oTarget))
|
||||
SetPersistantLocalInt(oTarget, "persist_dead", FALSE);
|
||||
}
|
||||
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,oCaster);
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE; //return TRUE if spell charges should be decremented
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
object oCaster = OBJECT_SELF;
|
||||
object oMod = GetModule();
|
||||
object oDC;
|
||||
|
||||
int nAtDC;
|
||||
|
||||
int nCasterLevel = PRCGetCasterLevel(oCaster);
|
||||
PRCSetSchool(GetSpellSchool(PRCGetSpellId()));
|
||||
if (!X2PreSpellCastCode()) return;
|
||||
object oTarget = PRCGetSpellTargetObject();
|
||||
int nEvent = GetLocalInt(oCaster, PRC_SPELL_EVENT); //use bitwise & to extract flags
|
||||
|
||||
// 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());
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
if(!nEvent) //normal cast
|
||||
{
|
||||
if(GetLocalInt(oCaster, PRC_SPELL_HOLD) && oCaster == oTarget)
|
||||
{ //holding the charge, casting spell on self
|
||||
SetLocalSpellVariables(oCaster, 1); //change 1 to number of charges
|
||||
return;
|
||||
}
|
||||
DoSpell(oCaster, oTarget, nCasterLevel, nEvent);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(nEvent & PRC_SPELL_EVENT_ATTACK)
|
||||
{
|
||||
if(DoSpell(oCaster, oTarget, nCasterLevel, nEvent))
|
||||
DecrementSpellCharges(oCaster);
|
||||
}
|
||||
}
|
||||
PRCSetSchool();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user