The Old Death System
Posted: Thu Aug 01, 2002 12:55 am
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 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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
return;
}
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos <=19)
// Send PC to Arborea
{
location lArborea = GetLocation(GetObjectByTag("WP_CGDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lArborea)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
return;
}
if (nAlignmentGoodEvil <= 31 && nAlignmentLawChaos <= 19)
// Send PC to The Abyss
{
location lAbyss = GetLocation(GetObjectByTag("WP_CEDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lAbyss)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
return;
}
if (nAlignmentGoodEvil <= 20 && nAlignmentLawChaos >=80)
// Send PC to Baator
{
location lBaator = GetLocation(GetObjectByTag("WP_LEDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lBaator)));
oDeathArea = GetArea(oDeadPC);
return;
}
if (nAlignmentGoodEvil >= 21 && nAlignmentGoodEvil <= 40 && nAlignmentLawChaos >=61)
// Send PC to Acheron
{
location lBaator = GetLocation(GetObjectByTag("WP_LNEDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lBaator)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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 iNumberInStack = GetNumStackedItems(oItem);
oItemCopy = CreateItemOnObject(GetTag(oItem), oRecipient, iNumberInStack);
if (GetIdentified(oItem) == TRUE){
SetIdentified(oItemCopy, TRUE);
}
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);
}
///////////////////////
////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 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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
return;
}
if (nAlignmentGoodEvil >= 70 && nAlignmentLawChaos <=19)
// Send PC to Arborea
{
location lArborea = GetLocation(GetObjectByTag("WP_CGDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lArborea)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
return;
}
if (nAlignmentGoodEvil <= 31 && nAlignmentLawChaos <= 19)
// Send PC to The Abyss
{
location lAbyss = GetLocation(GetObjectByTag("WP_CEDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lAbyss)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
return;
}
if (nAlignmentGoodEvil <= 20 && nAlignmentLawChaos >=80)
// Send PC to Baator
{
location lBaator = GetLocation(GetObjectByTag("WP_LEDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lBaator)));
oDeathArea = GetArea(oDeadPC);
return;
}
if (nAlignmentGoodEvil >= 21 && nAlignmentGoodEvil <= 40 && nAlignmentLawChaos >=61)
// Send PC to Acheron
{
location lBaator = GetLocation(GetObjectByTag("WP_LNEDEAD"));
AssignCommand(oDeadPC, DelayCommand(0.5,ActionJumpToLocation(lBaator)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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)));
oDeathArea = GetArea(oDeadPC);
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 iNumberInStack = GetNumStackedItems(oItem);
oItemCopy = CreateItemOnObject(GetTag(oItem), oRecipient, iNumberInStack);
if (GetIdentified(oItem) == TRUE){
SetIdentified(oItemCopy, TRUE);
}
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);
}