Aschbourne_PRC8/_module/nss/nw_o0_death.nss
GetOffMyYarn 7f75e229f9 Adds and Changes
Added missing crafting maps, removed unnecessary maps, changed a few miscellaneous things.
2024-09-14 13:52:39 -04:00

167 lines
6.8 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Death Script
//:: NW_O0_DEATH.NSS
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This script handles the default behavior
that occurs when a player dies.
BK: October 8 2002: Overriden for Expansion
*/
//:://////////////////////////////////////////////
//:: 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()
{
//Set variables
int xCount, xGold;
object xPC, xCorpse, xItem;
location xLoc;
//Get player and find locations
xPC = GetLastPlayerDying();
xLoc = GetLocation(xPC);
//Create corpse at player's feet
xCorpse = CreateObject(OBJECT_TYPE_PLACEABLE,"corpse002",xLoc);
//Drop equipment on corpse
for (xCount = 1; xCount < 15; xCount++)
{
switch (xCount)
{
case 1: xItem = GetItemInSlot(INVENTORY_SLOT_ARMS,xPC); break;
case 2: xItem = GetItemInSlot(INVENTORY_SLOT_ARROWS,xPC); break;
case 3: xItem = GetItemInSlot(INVENTORY_SLOT_BELT,xPC); break;
case 4: xItem = GetItemInSlot(INVENTORY_SLOT_BOLTS,xPC); break;
case 5: xItem = GetItemInSlot(INVENTORY_SLOT_BOOTS,xPC); break;
case 6: xItem = GetItemInSlot(INVENTORY_SLOT_BULLETS,xPC); break;
case 7: xItem = GetItemInSlot(INVENTORY_SLOT_CHEST,xPC); break;
case 8: xItem = GetItemInSlot(INVENTORY_SLOT_CLOAK,xPC); break;
case 9: xItem = GetItemInSlot(INVENTORY_SLOT_HEAD,xPC); break;
case 10: xItem = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,xPC); break;
case 11: xItem = GetItemInSlot(INVENTORY_SLOT_LEFTRING,xPC); break;
case 12: xItem = GetItemInSlot(INVENTORY_SLOT_NECK,xPC); break;
case 13: xItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,xPC); break;
case 14: xItem = GetItemInSlot(INVENTORY_SLOT_RIGHTRING,xPC); break;
}
if (GetIsObjectValid(xItem))
{
AssignCommand(xCorpse,ActionTakeItem(xItem,xPC));
}
}
//Now drop half of player's gold.
xGold = (GetGold(xPC)/2);
AssignCommand(xItem,TakeGoldFromCreature(xGold,xPC,FALSE));
//Now let's pop the death GUI
DelayCommand(2.5, PopUpDeathGUIPanel(xPC,TRUE,TRUE));
}
object oPlayer = GetLastPlayerDied();
// * increment global tracking number of times that I died
//SetLocalInt(oPlayer, "NW_L_PLAYER_DIED", GetLocalInt(oPlayer, "NW_L_PLAYER_DIED") + 1);
// * BK: Automation Control. Autopcs ignore death
//if (GetLocalInt(oPlayer, "NW_L_AUTOMATION") == 10)
//{
Raise(oPlayer);
DelayCommand(1.0, ExecuteScript("crawl", OBJECT_SELF));
return; // Raise and return
}
// * Handle Spirit of the Wood Death
string sArea = GetTag(GetArea(oPlayer));
/*
if (sArea == "MAP_M2Q2F2" && GetDistanceBetweenLocations(GetLocation(GetObjectByTag("M2Q2F2_M2Q2G")), GetLocation(oPlayer)) < 5.0 && GetLocalInt(GetModule(),"NW_M2Q2E_WoodsFreed") == 0)
{
int bValid;
Raise(oPlayer);
string sDestTag = "WP_M2Q2GtoM2Q2F";
object oSpawnPoint = GetObjectByTag(sDestTag);
AssignCommand(oPlayer,JumpToLocation(GetLocation(oSpawnPoint)));
return;
}
*/
// * in last level of the Sourcestone, move the player to the beginning of the area
// * May 16 2002: or the main area of the Snowglobe (to prevent plot logic problems).
// * May 21 2002: or Castle Never
if (sArea == "M4Q1D2" || sArea == "M3Q3C" || sArea == "MAP_M1Q6A")
{
//Raise(oPlayer);
//string sDestTag = "M4QD07_ENTER";
//object oSpawnPoint = GetObjectByTag(sDestTag);
// AssignCommand(oPlayer, DelayCommand(1.0, JumpToLocation(GetLocation(oSpawnPoint))));
// * MAY 2002: Just popup the YOU ARE DEAD panel at this point
DelayCommand(2.5, PopUpDeathGUIPanel(oPlayer,FALSE, TRUE, 66487));
return;
}
// * 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(2.5, PopUpGUIPanel(oPlayer,GUI_PANEL_PLAYER_DEATH));
}