127 lines
4.7 KiB
Plaintext
127 lines
4.7 KiB
Plaintext
#include "nw_i0_tool"
|
|
//::///////////////////////////////////////////////
|
|
//:: Death Script
|
|
//:: NW_O0_DEATH.NSS
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
This script handles the default behavior
|
|
that occurs when a player dies.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Brent Knowles
|
|
//:: Created On: November 6, 2001
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
void ClearAllFactionMembers(object oMember, object oPlayer)
|
|
{
|
|
// AssignCommand(oMember, SpeakString("here"));
|
|
AdjustReputation(oPlayer, oMember, 100);
|
|
SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
|
|
object oClear = GetFirstFactionMember(oMember, FALSE);
|
|
while (GetIsObjectValid(oClear) == TRUE)
|
|
{
|
|
ClearPersonalReputation(oPlayer, oClear);
|
|
oClear = GetNextFactionMember(oMember, FALSE);
|
|
}
|
|
} */
|
|
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);
|
|
}
|
|
|
|
void main()
|
|
{
|
|
// WriteTimestampedLogEntry("Entering Module onPlayerDeath: xx_cb_death");
|
|
object oPlayer = GetLastPlayerDied();
|
|
SetLocalInt(GetLastPlayerDied(),"Dead",1);
|
|
SetCampaignInt("PlayerData","Dead",1,oPlayer);
|
|
|
|
// Save persistent location
|
|
SetLocalInt(oPlayer,"BypassLocation",1);
|
|
SetCampaignLocation("PlayerData","Location",GetLocation(oPlayer),oPlayer);
|
|
string sArea = GetTag(GetArea(oPlayer));
|
|
|
|
// * make friendly to Each of the 3 common factions
|
|
AssignCommand(oPlayer, ClearAllActions());
|
|
// * Note: waiting for Sophia to make SetStandardFactionReptuation to clear all personal reputation
|
|
if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oPlayer) <= 10)
|
|
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
|
|
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oPlayer);
|
|
}
|
|
if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oPlayer) <= 10)
|
|
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
|
|
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oPlayer);
|
|
}
|
|
if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oPlayer) <= 10)
|
|
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
|
|
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPlayer);
|
|
}
|
|
DelayCommand(3.5, PopUpGUIPanel(oPlayer,GUI_PANEL_PLAYER_DEATH));
|
|
|
|
// I apply vis effect for death here, chunky red cause it's funny.
|
|
object oPC = GetLastPlayerDied();
|
|
if (!GetIsPC(oPC)) return;
|
|
object oTarget;
|
|
oTarget = oPC;
|
|
int nInt;
|
|
nInt = GetObjectType(oTarget);
|
|
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_CHUNK_RED_LARGE), oTarget);
|
|
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_CHUNK_RED_LARGE), GetLocation(oTarget));
|
|
|
|
|
|
|
|
// Reward for PvP players.
|
|
object oPC2 = GetLastKiller();
|
|
if (!GetIsPC(oPC2)) return;
|
|
if (GetItemPossessedBy(oPC2, "PVPTOKEN")== OBJECT_INVALID)
|
|
return;
|
|
RewardPartyXP(50, oPC2, FALSE);
|
|
RewardPartyGP(50, oPC2, FALSE);
|
|
DelayCommand(3.5, PopUpGUIPanel(oPlayer,GUI_PANEL_PLAYER_DEATH));
|
|
// WriteTimestampedLogEntry("Exiting Module onPlayerDeath: xx_cb_death");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|