PoA_PRC8/_module/_removed files/everpcrespawn.nss
Jaysyn904 151d074880 Added "Removed Files" folder
Added "Removed Files" folder in case we needed to review any of them.
2022-10-10 10:39:34 -04:00

144 lines
4.4 KiB
Plaintext

//Script Name: everpcrespawn
//////////////////////////////////////////
//Created By: Genisys (Guile)
//Created On: 5/20/08 (Updated 8/10/08)
/////////////////////////////////////////
/*
This script goes in your OnPlayerRespawn
Module Event, it determines where to
send the player when they die, also, it
applies a respawn penalty depending upon
their level, this system was also designed
for Legendary Levels (By Higher Ground)
which is in the "setxp_inc" include.
IMPORTANT: You must have a way point in your module tagnamed "deathway"
This is where all of the PCs who respawn go to!
*/
////////////////////////////////////////
//Redundant Variables Declared
object oItem;
effect eEffect;
object oTarget;
location lTarget;
//Required Includes
#include "nw_i0_plot"
//This include will penalize the PC when they respawn.
#include "setxp_inc"
//PROTOTYPE DECLARED
void Raise(object oPlayer);
//Main Script
void main()
{
object oPC = GetLastRespawnButtonPresser();
if (!GetIsPC(oPC)) return;
//////////////////IMPORTANT OPTION//////////////////////////////////
//Optionally you can use the script portpctodeath to teleport the pc
//Back to where they died, this function below allows this to happen
SetLocalLocation(oPC, "ls_death_loc", GetLocation(oPC));
////////////////////////////////////////////////////////////////////
//This removes the death token from the PC which prevents them
//from logging out to cheat the death respawn penalty and live again.
if (GetItemPossessedBy(oPC, "death")!= OBJECT_INVALID)
{
oItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem))
{
if (GetTag(oItem)=="death") DestroyObject(oItem);
oItem = GetNextItemInInventory(oPC);
}
}
//Resurrect & Heal The Player.
Raise(oPC);
//Apply a cool visual effect to level 40s..
int nLvl = GetHitDice(oPC);
if (nLvl >=40)
{
//Lets make the concealed 40%
eEffect = EffectConcealment(40);
eEffect = SupernaturalEffect(eEffect);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
//Lets make the look like a ghost.. :)
ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectVisualEffect(VFX_DUR_GLOW_WHITE)), oPC);
}
//Send them to Fugue
oTarget = GetWaypointByTag("respawnpt");
lTarget = GetLocation(oTarget);
//Apply a respawn penalty (See the setxp_inc script)
ApplyRespawnPenalty(oPC);
//If the location is valid, send them there..
if (GetArea(GetAreaFromLocation(lTarget))!=OBJECT_INVALID)
{
//Send the PC to the waypoint tagnamed "deathway"
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionJumpToLocation(lTarget));
}
//Otherwise if the area is not valid..
else
{
//Otherwise they respawn where they died.
}
//Main Script End
}
//////BIOWARE STANDARD Raise OnDeath FUNCTION///////////
//PROTOTYPE DEFINED
// Raise OnDeath function
void Raise(object oPlayer)
{
effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION);
effect eBad = GetFirstEffect(oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPlayer)), oPlayer);
//Search for negative effects
while(GetIsEffectValid(eBad))
{
if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS ||
GetEffectType(eBad) == EFFECT_TYPE_DEAF ||
GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||
GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL)
{
//Remove effect if it is negative.
RemoveEffect(oPlayer, eBad);
}
eBad = GetNextEffect(oPlayer);
}
//Fire cast spell at event for the specified target
SignalEvent(oPlayer, EventSpellCastAt(OBJECT_SELF, SPELL_RESTORATION, FALSE));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oPlayer);
}