Server Totals
Mikona - (1)
Le'Or - (0)
Ferrell - (0)
Elysia - (0)
M'Chek - (0)
Deglos - (0)
Wilderness - (0)
Visimontium - (0)
Underdark - (0)
Total players: 1
Gallery

Links Menu

The Old Death System

Moderators: Nighthawk4, Dungeon Masters

The Old Death System

PostAuthor: Orleron » 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);
}
"Truth has no form."
--Idries Shah

World of Avlis Page

Avlis Project FAQ
User avatar
Orleron
World Advisor, Co-founder
World Advisor, Co-founder
 
Posts: 14938
Joined: Fri Sep 14, 2001 9:48 pm
Timezone: GMT-5

Avlis OnDeath script for the Module event list:

PostAuthor: Orleron » Thu Aug 01, 2002 12:57 am

///////////////////////////////////////////////
///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);

// Now strip the player and cycle through the worn items and put copies of
//them on the death corpse.
// 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))
{
CopyItem(GetItemInSlot(INVENTORY_SLOT_ARMS, oPlayer), oDeathCorpse);
CopyItem(GetItemInSlot(INVENTORY_SLOT_ARROWS, oPlayer), oDeathCorpse);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BELT, oPlayer), oDeathCorpse);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BOLTS, oPlayer), oDeathCorpse);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BOOTS, oPlayer), oDeathCorpse);
CopyItem(GetItemInSlot(INVENTORY_SLOT_BULLETS, oPlayer), oDeathCorpse);
CopyItem(GetItemInSlot(INVENTORY_SLOT_CHEST, oPlayer), oDeathCorpse);
CopyItem(GetItemInSlot(INVENTORY_SLOT_CLOAK, oPlayer), oDeathCorpse);
CopyItem(GetItemInSlot(INVENTORY_SLOT_HEAD, oPlayer), oDeathCorpse);
CopyItem(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPlayer), oDeathCorpse);
CopyItem(GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPlayer), oDeathCorpse);
CopyItem(GetItemInSlot(INVENTORY_SLOT_NECK, oPlayer), oDeathCorpse);
CopyItem(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPlayer), oDeathCorpse);
CopyItem(GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPlayer), oDeathCorpse);

// Now copy the inventory items onto the Death Corpse.
object oEquip = GetFirstItemInInventory(oPlayer);
while(GetIsObjectValid(oEquip))
{

CopyItem(oEquip, oDeathCorpse);
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

World of Avlis Page

Avlis Project FAQ
User avatar
Orleron
World Advisor, Co-founder
World Advisor, Co-founder
 
Posts: 14938
Joined: Fri Sep 14, 2001 9:48 pm
Timezone: GMT-5

Avlis OnRespawn script....

PostAuthor: Orleron » Thu Aug 01, 2002 12:59 am

//::///////////////////////////////////////////////
//:: Generic On Pressed Respawn Button
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
// * June 1: moved RestoreEffects into plot include
*/
//:://////////////////////////////////////////////
//:: Created By: Brent
//:: Created On: November
//:://////////////////////////////////////////////
#include "nw_i0_plot"
#include "avlis_subrace"
#include "avlis_include"
#include "avlis_flags"

// * Applies an XP and GP penalty
// * to the player respawning
void ApplyPenalty(object oDead) // Not used, but keeping just in case
{
// * You can not lose a level with this respawning
int nHD = GetHitDice(oDead);
int nNewXP = ((nHD * (nHD - 1)) / 2) * 1000;

int nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
// * a cap of 10 000gp taken from you
if (nGoldToTake > 10000){
nGoldToTake = 10000;
}

SetXP(oDead, nNewXP);
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
}


void main(){
object oRespawner = GetLastRespawnButtonPresser();

// Ressurect PC
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(10), oRespawner);
RemoveEffects(oRespawner);
// Set Player state to alive
SetLocalInt(oRespawner, "PlayerState", PLAYER_STATE_ALIVE);

// Reapply Subrace

if (SUBRACESYSTEM == TRUE){
if (GetIsObjectValid(oRespawner) == TRUE){
ActivateSubrace(oRespawner);
}else{
PrintString("Entering object is not a PC.");
}
}else{
SendMessageToPC(oRespawner, "The subrace system is not running.");
}

// Send to plane of alignment if DEADSYSTEM is turned on in avlis_flags.
if(DEADSYSTEM == TRUE){
oDeadPC = oRespawner;
GoToPlaneOfAlignment();
}else{
SendMessageToPC(oRespawner, "Deadsystem is not running.");
}


if (GetIsObjectValid(oRespawner) == TRUE){
int iPlotFlag = GetPlotFlag(oRespawner);

// Turn off plot flags of people who are cheating.
if (iPlotFlag == TRUE){
SetPlotFlag(oRespawner, FALSE);
}
}else{
PrintString("* Entering object is not valid : " + GetTag(oRespawner));
}
}
"Truth has no form."
--Idries Shah

World of Avlis Page

Avlis Project FAQ
User avatar
Orleron
World Advisor, Co-founder
World Advisor, Co-founder
 
Posts: 14938
Joined: Fri Sep 14, 2001 9:48 pm
Timezone: GMT-5


Return to NWN Scripting

Who is online

Registered users: Bing [Bot]