Avlis include file:
///////////////////////
////avlis_include
//// by Josh Simon & Adam Colon
//// This file contains Avlis specific functions and variables.
///////////////////////
// July 4th, 2002
//////////////////////
// Gets PC alignment and sends them to the appropriate plane.
object oDeadPC;
object oDeathArea;
location lDiedHere;
object oContainer;
int nDestroyOriginal;
object oItemCopy;
object oDeathCorpse;
int PLAYER_STATE_ALIVE = 0;
int PLAYER_STATE_STABLE = 1;
int PLAYER_STATE_DISABLED = 2;
int PLAYER_STATE_DYING = 3;
void GoToPlaneOfAlignment()
{
// Determine Good/Evil and Law/Chaos values of PC's Alignment.
int nAlignmentGoodEvil = GetGoodEvilValue(oDeadPC);
int nAlignmentLawChaos = GetLawChaosValue(oDeadPC);
string sLawChaos = IntToString(nAlignmentLawChaos);
string sGoodEvil = IntToString(nAlignmentGoodEvil);
SendMessageToPC(oDeadPC, "L/C: "+sLawChaos); // Tell PC what align is
SendMessageToPC(oDeadPC, "G/E: "+sGoodEvil);
// Apply a set of rules that govern where the PC goes depending on their
// alignment values.
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos >= 80)
// Send PC to Seven Heavens
{
location lSevenHeavens = GetLocation(GetObjectByTag("WP_LGDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lSevenHeavens)));
SetLocalLocation(oDeadPC, "My Death Plane", lSevenHeavens);
return;
}
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos >=60 && nAlignmentLawChaos <= 79)
// Send PC to Bytopia
{
location lBytopia = GetLocation(GetObjectByTag("WP_LGNDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lBytopia)));
SetLocalLocation(oDeadPC, "My Death Plane", lBytopia);
return;
}
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos >=40 && nAlignmentLawChaos <= 59)
// Send PC to Elysium
{
location lElysium = GetLocation(GetObjectByTag("WP_NGDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lElysium)));
SetLocalLocation(oDeadPC, "My Death Plane", lElysium);
return;
}
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos >=20 && nAlignmentLawChaos <= 39)
// Send PC to Beastlands
{
location lBeastlands = GetLocation(GetObjectByTag("WP_NGCDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lBeastlands)));
SetLocalLocation(oDeadPC, "My Death Plane", lBeastlands);
return;
}
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos <=19)
// Send PC to Arborea
{
location lArborea = GetLocation(GetObjectByTag("WP_CGDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lArborea)));
SetLocalLocation(oDeadPC, "My Death Plane", lArborea);
return;
}
if (nAlignmentGoodEvil >= 31 && nAlignmentGoodEvil <=40 && nAlignmentLawChaos <= 39)
// Send PC to Ysgard
{
location lYsgard = GetLocation(GetObjectByTag("WP_CGNDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lYsgard)));
SetLocalLocation(oDeadPC, "My Death Plane", lYsgard);
return;
}
if (nAlignmentGoodEvil >= 41 && nAlignmentGoodEvil <=60 && nAlignmentLawChaos <= 39)
// Send PC to Limbo
{
location lLimbo = GetLocation(GetObjectByTag("WP_CNDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lLimbo)));
SetLocalLocation(oDeadPC, "My Death Plane", lLimbo);
return;
}
if (nAlignmentGoodEvil >= 30 && nAlignmentGoodEvil <=40 && nAlignmentLawChaos <= 39)
// Send PC to Pandemonium
{
location lPandemonium = GetLocation(GetObjectByTag("WP_CNEDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lPandemonium)));
SetLocalLocation(oDeadPC, "My Death Plane", lPandemonium);
return;
}
if (nAlignmentGoodEvil <= 31 && nAlignmentLawChaos <= 19)
// Send PC to The Abyss
{
location lAbyss = GetLocation(GetObjectByTag("WP_CEDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lAbyss)));
SetLocalLocation(oDeadPC, "My Death Plane", lAbyss);
return;
}
if (nAlignmentGoodEvil <= 31 && nAlignmentLawChaos >= 20 && nAlignmentLawChaos <=39)
// Send PC to Tarterus
{
location lTarterus = GetLocation(GetObjectByTag("WP_CENDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lTarterus)));
SetLocalLocation(oDeadPC, "My Death Plane", lTarterus);
return;
}
if (nAlignmentGoodEvil <= 31 && nAlignmentLawChaos >= 40 && nAlignmentLawChaos <=59)
// Send PC to Hades
{
location lHades = GetLocation(GetObjectByTag("WP_NEDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lHades)));
SetLocalLocation(oDeadPC, "My Death Plane", lHades);
return;
}
if (nAlignmentGoodEvil <= 31 && nAlignmentLawChaos >= 60 && nAlignmentLawChaos <=79)
// Send PC to Gehenna
{
location lGehenna = GetLocation(GetObjectByTag("WP_NELDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lGehenna)));
SetLocalLocation(oDeadPC, "My Death Plane", lGehenna);
return;
}
if (nAlignmentGoodEvil <= 20 && nAlignmentLawChaos >=80)
// Send PC to Baator
{
location lBaator = GetLocation(GetObjectByTag("WP_LEDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lBaator)));
SetLocalLocation(oDeadPC, "My Death Plane", lBaator);
return;
}
if (nAlignmentGoodEvil >= 21 && nAlignmentGoodEvil <= 40 && nAlignmentLawChaos >=61)
// Send PC to Acheron
{
location lAcheron = GetLocation(GetObjectByTag("WP_LNEDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lAcheron)));
SetLocalLocation(oDeadPC, "My Death Plane", lAcheron);
return;
}
if (nAlignmentGoodEvil >= 61 && nAlignmentGoodEvil <= 69 && nAlignmentLawChaos >=61)
// Send PC to Arcadia
{
location lArcadia = GetLocation(GetObjectByTag("WP_LNGDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lArcadia)));
SetLocalLocation(oDeadPC, "My Death Plane", lArcadia);
return;
}
if (nAlignmentGoodEvil >= 41 && nAlignmentGoodEvil <= 60 && nAlignmentLawChaos >=61)
// Send PC to Mechanus
{
location lMechanus = GetLocation(GetObjectByTag("WP_LNDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lMechanus)));
SetLocalLocation(oDeadPC, "My Death Plane", lMechanus);
return;
}
if (nAlignmentGoodEvil >= 30 && nAlignmentGoodEvil <= 70 &&
nAlignmentLawChaos >= 40 && nAlignmentLawChaos <=59)
// Send PC to Concordant Opposition
{
location lConcordantOpp = GetLocation(GetObjectByTag("WP_NDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lConcordantOpp)));
SetLocalLocation(oDeadPC, "My Death Plane", lConcordantOpp);
return;
}
return;
}
//Kill the target, forcing it to leave a corpse behind
//taken from Bioware's KillAndReplace()
void killandreplace()
{
SetPlotFlag(oDeadPC, FALSE);
AssignCommand(oDeadPC, SetIsDestroyable(FALSE, FALSE));
AssignCommand(oDeadPC, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oDeadPC));
}
// Copy item in a player's inventory and give it to the corpse.
void CopyItem(object oItem, object oRecipient, int nDestroyOriginal)
{
int iNumberInStack = GetNumStackedItems(oItem);
oItemCopy = CreateItemOnObject(GetTag(oItem), oRecipient, iNumberInStack);
if (GetIdentified(oItem) == TRUE){
SetIdentified(oItemCopy, TRUE);
}
if (nDestroyOriginal == TRUE)
DestroyObject(oItem);
return;
}
// Function to make player unequip and destroy items called from the main()
// function(thanks Jhenne)
void strip_equiped(object oPlayer, object oEquip)
{
if(GetIsObjectValid(oEquip))
AssignCommand(oPlayer, ActionUnequipItem(oEquip));
DestroyObject(oEquip);
}
location GetDeathPlaneLocation(object oPlayer)
{
// Determine Good/Evil and Law/Chaos values of PC's Alignment.
location lDeathLocation;
int nAlignmentGoodEvil = GetGoodEvilValue(oDeadPC);
int nAlignmentLawChaos = GetLawChaosValue(oDeadPC);
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos >= 80)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_LGDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos >=60 && nAlignmentLawChaos <= 79)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_LGNDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos >=40 && nAlignmentLawChaos <= 59)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_NGDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos >=20 && nAlignmentLawChaos <= 39)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_NGCDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos <=19)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_CGDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil >= 31 && nAlignmentGoodEvil <=40 && nAlignmentLawChaos <= 39)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_CGNDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil >= 41 && nAlignmentGoodEvil <=60 && nAlignmentLawChaos <= 39)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_CNDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil >= 30 && nAlignmentGoodEvil <=40 && nAlignmentLawChaos <= 39)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_CNEDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil <= 31 && nAlignmentLawChaos <= 19)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_CEDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil <= 31 && nAlignmentLawChaos >= 20 && nAlignmentLawChaos <=39)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_CENDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil <= 31 && nAlignmentLawChaos >= 40 && nAlignmentLawChaos <=59)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_NEDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil <= 31 && nAlignmentLawChaos >= 60 && nAlignmentLawChaos <=79)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_NELDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil <= 20 && nAlignmentLawChaos >=80)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_LEDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil >= 21 && nAlignmentGoodEvil <= 40 && nAlignmentLawChaos >=61)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_LNEDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil >= 61 && nAlignmentGoodEvil <= 69 && nAlignmentLawChaos >=61)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_LNGDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil >= 41 && nAlignmentGoodEvil <= 60 && nAlignmentLawChaos >=61)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_LNDEAD"));
return lDeathLocation;
}
if (nAlignmentGoodEvil >= 30 && nAlignmentGoodEvil <= 70 &&
nAlignmentLawChaos >= 40 && nAlignmentLawChaos <=59)
{
lDeathLocation = GetLocation(GetObjectByTag("WP_NDEAD"));
return lDeathLocation;
}
return lDeathLocation;
}
The New Death System... in progress
Moderator: Event DM
-
- World Advisor, Co-founder
- Posts: 15149
- Joined: Fri Sep 14, 2001 9:48 pm
- Timezone: GMT-5
- Contact:
The New Death System... in progress
"Truth has no form."
--Idries Shah
--Idries Shah
-
- World Advisor, Co-founder
- Posts: 15149
- Joined: Fri Sep 14, 2001 9:48 pm
- Timezone: GMT-5
- Contact:
New OnDeath Script
///////////////////////////////////////////////
///Avlis death script.
///By Josh Simon and Adam Colon
///July 5th, 2002
//////////////////////////////////////////////
#include "avlis_include"
#include "nw_i0_plot"
//::///////////////////////////////////////////////
//:: 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 Raise(object oPlayer) // Not yet used, but keeping it just in case
{
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()
{
object oPlayer = GetLastPlayerDied();
location lDiedHere = GetLocation(oPlayer);
// If the player went strait to DEAD without going through DYING then we
// need to make a Death Corpse to put things in
if(GetIsObjectValid(oDeathCorpse) == FALSE )
{
oDeathCorpse=CreateObject(OBJECT_TYPE_PLACEABLE, "DeathCorpse", lDiedHere);
SetLocalObject(oDeathCorpse,"Owner",oPlayer);
SetLocalObject(oPlayer,"DeathCorpse",oDeathCorpse);
// Now that they are DEAD, make a Player Corpse Token that others can use
// to drag their carcass to a cleric, and put the token on the DeathCorpse.
object oDeadMan=CreateItemOnObject("PlayerCorpse", oDeathCorpse);
SetLocalObject(oDeadMan,"Owner",oPlayer);
SetLocalObject(oDeadMan,"DeathCorpse",oDeathCorpse);
SetLocalObject(oDeathCorpse,"PlayerCorpse",oDeadMan);
SetLocalObject(oPlayer,"PlayerCorpse",oDeadMan);
// Copy the player's items into a sac that will be waiting for
// them on their death plane when they get there.
// Then copy the player's items onto the death corpse and destroy
// the originals.
// But don't do this if the player was already on their outer plane when
//they died.
if (GetArea(oPlayer) != GetObjectByTag("SevenHeavens") ||
GetArea(oPlayer) != GetObjectByTag("Bytopia") ||
GetArea(oPlayer) != GetObjectByTag("Elysium") ||
GetArea(oPlayer) != GetObjectByTag("Beastlands") ||
GetArea(oPlayer) != GetObjectByTag("Arborea") ||
GetArea(oPlayer) != GetObjectByTag("Ysgard") ||
GetArea(oPlayer) != GetObjectByTag("Limbo") ||
GetArea(oPlayer) != GetObjectByTag("Pandemonium") ||
GetArea(oPlayer) != GetObjectByTag("TheNineHellsofBaator") ||
GetArea(oPlayer) != GetObjectByTag("TheAbyss") ||
GetArea(oPlayer) != GetObjectByTag("Tarterus") ||
GetArea(oPlayer) != GetObjectByTag("Hades") ||
GetArea(oPlayer) != GetObjectByTag("Gehenna") ||
GetArea(oPlayer) != GetObjectByTag("Acheron") ||
GetArea(oPlayer) != GetObjectByTag("Arcadia") ||
GetArea(oPlayer) != GetObjectByTag("ConcordantOpp") ||
GetArea(oPlayer) != GetObjectByTag("Mechanus") &&
!GetIsDM(oPlayer))
{
// Copy items into Bag of Items
object oItemBag = CreateObject(OBJECT_TYPE_ITEM, "ItemBag", lDiedHere);
CopyItem(GetItemInSlot(INVENTORY_SLOT_ARMS, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_ARROWS, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BELT, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BOLTS, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BOOTS, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BULLETS, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_CHEST, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_CLOAK, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_HEAD, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_NECK, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPlayer), oItemBag, FALSE);
// Copy items into Death Corpse
CopyItem(GetItemInSlot(INVENTORY_SLOT_ARMS, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_ARROWS, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BELT, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BOLTS, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BOOTS, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BULLETS, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_CHEST, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_CLOAK, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_HEAD, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_NECK, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPlayer), oDeathCorpse, TRUE);
// Now place the inventory items onto the Death Corpse,
// and place copies into the Bag of Items.
object oEquip = GetFirstItemInInventory(oPlayer);
while(GetIsObjectValid(oEquip))
{
CopyItem(oEquip, oItemBag, FALSE);
CopyItem(oEquip, oDeathCorpse, TRUE);
oEquip = GetNextItemInInventory(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(2.5, PopUpDeathGUIPanel(oPlayer,TRUE, FALSE, 0,
"You have died, and now you will journey to the afterlife you deserve."));
}
///Avlis death script.
///By Josh Simon and Adam Colon
///July 5th, 2002
//////////////////////////////////////////////
#include "avlis_include"
#include "nw_i0_plot"
//::///////////////////////////////////////////////
//:: 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 Raise(object oPlayer) // Not yet used, but keeping it just in case
{
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()
{
object oPlayer = GetLastPlayerDied();
location lDiedHere = GetLocation(oPlayer);
// If the player went strait to DEAD without going through DYING then we
// need to make a Death Corpse to put things in
if(GetIsObjectValid(oDeathCorpse) == FALSE )
{
oDeathCorpse=CreateObject(OBJECT_TYPE_PLACEABLE, "DeathCorpse", lDiedHere);
SetLocalObject(oDeathCorpse,"Owner",oPlayer);
SetLocalObject(oPlayer,"DeathCorpse",oDeathCorpse);
// Now that they are DEAD, make a Player Corpse Token that others can use
// to drag their carcass to a cleric, and put the token on the DeathCorpse.
object oDeadMan=CreateItemOnObject("PlayerCorpse", oDeathCorpse);
SetLocalObject(oDeadMan,"Owner",oPlayer);
SetLocalObject(oDeadMan,"DeathCorpse",oDeathCorpse);
SetLocalObject(oDeathCorpse,"PlayerCorpse",oDeadMan);
SetLocalObject(oPlayer,"PlayerCorpse",oDeadMan);
// Copy the player's items into a sac that will be waiting for
// them on their death plane when they get there.
// Then copy the player's items onto the death corpse and destroy
// the originals.
// But don't do this if the player was already on their outer plane when
//they died.
if (GetArea(oPlayer) != GetObjectByTag("SevenHeavens") ||
GetArea(oPlayer) != GetObjectByTag("Bytopia") ||
GetArea(oPlayer) != GetObjectByTag("Elysium") ||
GetArea(oPlayer) != GetObjectByTag("Beastlands") ||
GetArea(oPlayer) != GetObjectByTag("Arborea") ||
GetArea(oPlayer) != GetObjectByTag("Ysgard") ||
GetArea(oPlayer) != GetObjectByTag("Limbo") ||
GetArea(oPlayer) != GetObjectByTag("Pandemonium") ||
GetArea(oPlayer) != GetObjectByTag("TheNineHellsofBaator") ||
GetArea(oPlayer) != GetObjectByTag("TheAbyss") ||
GetArea(oPlayer) != GetObjectByTag("Tarterus") ||
GetArea(oPlayer) != GetObjectByTag("Hades") ||
GetArea(oPlayer) != GetObjectByTag("Gehenna") ||
GetArea(oPlayer) != GetObjectByTag("Acheron") ||
GetArea(oPlayer) != GetObjectByTag("Arcadia") ||
GetArea(oPlayer) != GetObjectByTag("ConcordantOpp") ||
GetArea(oPlayer) != GetObjectByTag("Mechanus") &&
!GetIsDM(oPlayer))
{
// Copy items into Bag of Items
object oItemBag = CreateObject(OBJECT_TYPE_ITEM, "ItemBag", lDiedHere);
CopyItem(GetItemInSlot(INVENTORY_SLOT_ARMS, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_ARROWS, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BELT, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BOLTS, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BOOTS, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BULLETS, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_CHEST, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_CLOAK, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_HEAD, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_NECK, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPlayer), oItemBag, FALSE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPlayer), oItemBag, FALSE);
// Copy items into Death Corpse
CopyItem(GetItemInSlot(INVENTORY_SLOT_ARMS, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_ARROWS, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BELT, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BOLTS, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BOOTS, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BULLETS, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_CHEST, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_CLOAK, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_HEAD, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_NECK, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPlayer), oDeathCorpse, TRUE);
CopyItem(GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPlayer), oDeathCorpse, TRUE);
// Now place the inventory items onto the Death Corpse,
// and place copies into the Bag of Items.
object oEquip = GetFirstItemInInventory(oPlayer);
while(GetIsObjectValid(oEquip))
{
CopyItem(oEquip, oItemBag, FALSE);
CopyItem(oEquip, oDeathCorpse, TRUE);
oEquip = GetNextItemInInventory(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(2.5, PopUpDeathGUIPanel(oPlayer,TRUE, FALSE, 0,
"You have died, and now you will journey to the afterlife you deserve."));
}
"Truth has no form."
--Idries Shah
--Idries Shah
<snip>
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos >= 80)
// Send PC to Seven Heavens
{
location lSevenHeavens = GetLocation(GetObjectByTag("WP_LGDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lSevenHeavens)));
SetLocalLocation(oDeadPC, "My Death Plane", lSevenHeavens);
return;
}
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos >=60)
// Send PC to Bytopia
{
location lBytopia = GetLocation(GetObjectByTag("WP_LGNDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lBytopia)));
SetLocalLocation(oDeadPC, "My Death Plane", lBytopia);
return;
}
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos >=40)
// Send PC to Elysium
{
location lElysium = GetLocation(GetObjectByTag("WP_NGDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lElysium)));
SetLocalLocation(oDeadPC, "My Death Plane", lElysium);
return;
}
</snip>
You don't need those extra logic checks,
Plus, I think it would be more conventional to use an If Then Else If Then Else kind of interface instead of returning within each If statement.
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos >= 80)
// Send PC to Seven Heavens
{
location lSevenHeavens = GetLocation(GetObjectByTag("WP_LGDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lSevenHeavens)));
SetLocalLocation(oDeadPC, "My Death Plane", lSevenHeavens);
return;
}
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos >=60)
// Send PC to Bytopia
{
location lBytopia = GetLocation(GetObjectByTag("WP_LGNDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lBytopia)));
SetLocalLocation(oDeadPC, "My Death Plane", lBytopia);
return;
}
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos >=40)
// Send PC to Elysium
{
location lElysium = GetLocation(GetObjectByTag("WP_NGDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lElysium)));
SetLocalLocation(oDeadPC, "My Death Plane", lElysium);
return;
}
</snip>
You don't need those extra logic checks,
Plus, I think it would be more conventional to use an If Then Else If Then Else kind of interface instead of returning within each If statement.