Initial upload. PRC8 has been added. Module compiles, PRC's default AI & treasure scripts have been integrated. Started work on top hak for SLA / Ability / Scripting modifications.
127 lines
3.5 KiB
Plaintext
127 lines
3.5 KiB
Plaintext
/////::///////////////////////////////////////////////
|
|
//:: [Raise Dead]
|
|
//:: [NW_S0_RaisDead.nss]
|
|
//:: Copyright (c) 2000 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
//:: Brings a character back to life with 1 HP.
|
|
//:://////////////////////////////////////////////
|
|
//:: 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 "rpo_inc"
|
|
#include "jw_xp_penalty"
|
|
|
|
|
|
|
|
#include "x0_i0_spells"
|
|
#include "x2_inc_spellhook"
|
|
|
|
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())
|
|
{
|
|
return;
|
|
}
|
|
// End of Spell Cast Hook
|
|
if (GetIsInCombat(OBJECT_SELF))
|
|
{
|
|
SendMessageToPC(OBJECT_SELF,"You need peace and quiet to concentrate while casting this spell. You cannot cast it in combat, or while party members are distratcing you");
|
|
return;
|
|
}
|
|
//Declare major variables
|
|
object oTarget = GetSpellTargetObject();
|
|
effect eRaise = EffectResurrection();
|
|
effect eVis = EffectVisualEffect(VFX_IMP_RAISE_DEAD);
|
|
if(GetIsDead(oTarget))
|
|
{
|
|
|
|
|
|
if (GetLocalInt(oTarget,"cantres"))
|
|
{
|
|
SendMessageToPC(oTarget,"The raise dead spell fails");
|
|
FloatingTextStringOnCreature("The raise dead spell fails",OBJECT_SELF,TRUE);
|
|
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, GetLocation(oTarget));
|
|
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
|
|
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, GetLocation(oTarget));
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRaise, oTarget);
|
|
|
|
|
|
object oDead=oTarget;
|
|
int nPenalty=40;
|
|
int nXP = GetXP(oDead);
|
|
nPenalty = nPenalty * GetHitDice(oDead);
|
|
int nHD = GetHitDice(oDead);
|
|
|
|
// * You can not lose a level with this respawning
|
|
int nMin = ((nHD * (nHD - 1)) / 2) * 1000;
|
|
|
|
int nNewXP = nXP - nPenalty;
|
|
if (nNewXP < nMin)
|
|
{
|
|
nNewXP = nMin;
|
|
}
|
|
|
|
|
|
|
|
if (nHD==1)
|
|
{
|
|
nNewXP = (nXP-10);
|
|
|
|
|
|
}
|
|
|
|
if (nNewXP < (nXP/10*9))
|
|
{
|
|
nNewXP = (nXP/10*9);
|
|
}
|
|
|
|
|
|
if (nNewXP < 1)
|
|
{
|
|
nNewXP = 1;
|
|
}
|
|
|
|
|
|
SetXP(oDead, nNewXP);
|
|
|
|
if (GetSpellCastItem() != OBJECT_INVALID)
|
|
{
|
|
effect eStr=EffectAbilityDecrease(ABILITY_STRENGTH,3);
|
|
effect eDex=EffectAbilityDecrease(ABILITY_DEXTERITY,3);
|
|
effect eWis=EffectAbilityDecrease(ABILITY_WISDOM,3);
|
|
effect eInt=EffectAbilityDecrease(ABILITY_INTELLIGENCE,3);
|
|
effect eChar=EffectAbilityDecrease(ABILITY_CHARISMA,3);
|
|
effect eLink=EffectLinkEffects(eStr,eDex);
|
|
eLink=EffectLinkEffects(eWis,eLink);
|
|
eLink=EffectLinkEffects(eInt,eLink);
|
|
eLink=EffectLinkEffects(eChar,eLink);
|
|
effect eSpeed=EffectMovementSpeedDecrease(30);
|
|
effect eCurse=ExtraordinaryEffect(eLink);
|
|
eSpeed=ExtraordinaryEffect(eSpeed);
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eCurse,oDead,600.0);
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eSpeed,oDead,300.0);
|
|
}
|
|
|
|
RemoveDeathAmulet(oTarget);
|
|
|
|
RemoveDeathAmulet(oTarget);
|
|
}
|
|
}
|
|
|