286 lines
10 KiB
Plaintext
286 lines
10 KiB
Plaintext
#include "nw_i0_plot"
|
|
|
|
// * Applies an XP and GP penalty
|
|
// * to the player respawning
|
|
void DeathPenalty(object oDead)
|
|
{
|
|
int nXP = GetXP(oDead);
|
|
int nPenalty = 12 * GetHitDice(oDead);
|
|
int nHD = GetHitDice(oDead);
|
|
|
|
if (nHD >= 3){
|
|
// * You can not lose a level with this respawning
|
|
int nMin = ((nHD * (nHD - 1)) / 2) * 1000;
|
|
int nNewXP = nXP - nPenalty;
|
|
// Store Death-Penalty
|
|
if (nNewXP < nMin)
|
|
nNewXP = nMin;
|
|
|
|
SetXP(oDead, nNewXP);}
|
|
else
|
|
FloatingTextStringOnCreature("*Your level is too low to lose any XP*", oDead);
|
|
|
|
int nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
|
|
// * a cap of 10 000gp taken from you
|
|
if (nGoldToTake > 5000)
|
|
{
|
|
nGoldToTake = 5000;
|
|
}
|
|
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
|
|
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
|
|
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
|
|
|
|
}
|
|
|
|
|
|
void DeathPenaltyGrave(object oDead)
|
|
{
|
|
|
|
int nXP = GetXP(oDead);
|
|
int nPenalty = 12 * GetHitDice(oDead);
|
|
int nHD = GetHitDice(oDead);
|
|
|
|
|
|
// * You can not lose a level with this respawning
|
|
int nMin = ((nHD * (nHD - 1)) / 2) * 1000;
|
|
|
|
int nNewXP = nXP - nPenalty;
|
|
|
|
// Store Death-Penalty
|
|
|
|
if (nNewXP < nMin) nNewXP = nMin;
|
|
int nEffectiveLoss = nXP - nNewXP;
|
|
int bCreateGrave = FALSE;
|
|
|
|
int nXPRegain = GetLocalInt(GetModule(),"T1_MODULE_CFG_GRAVEEXPREGAIN");
|
|
if (nXPRegain==0) nXPRegain = 50; //default = 50
|
|
if (nXPRegain==-1) nXPRegain = 0;
|
|
|
|
if (nEffectiveLoss>0)
|
|
{
|
|
bCreateGrave = TRUE;
|
|
nEffectiveLoss = (nEffectiveLoss* nXPRegain)/100;
|
|
SetLocalInt(oDead,"T1_PLAYER_GRAVEEXP", nEffectiveLoss);
|
|
}
|
|
|
|
SetXP(oDead, nNewXP);
|
|
int nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
|
|
// * a cap of 10 000gp taken from you
|
|
if (nGoldToTake > 5000)
|
|
{
|
|
nGoldToTake = 5000;
|
|
}
|
|
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
|
|
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
|
|
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
|
|
|
|
// Destroy Old Grave
|
|
if (GetIsObjectValid(GetLocalObject(oDead,"T1_PLAYER_LASTGRAVE")))
|
|
{
|
|
object oOldGrave = GetLocalObject(oDead,"T1_PLAYER_LASTGRAVE");
|
|
DestroyObject(oOldGrave,0.0f);
|
|
DeleteLocalObject(oDead,"T1_PLAYER_LASTGRAVE");
|
|
SendMessageToPC(oDead, "Your last grave has been destroyed");
|
|
}
|
|
|
|
if ( bCreateGrave == TRUE)
|
|
{
|
|
location lGraveLoc = GetLocation(oDead);
|
|
object oGrave = CreateObject(OBJECT_TYPE_PLACEABLE,"GZ_GRAVE_GENERIC",lGraveLoc);
|
|
SetLocalString(oGrave,"T1_OBJECT_GRAVEOWNER",GetName(oDead));
|
|
SetLocalObject(oGrave,"T1_OBJECT_PLAYER",oDead);
|
|
SetLocalObject(oDead,"T1_PLAYER_LASTGRAVE",oGrave);
|
|
int nDiceRoll = d100(1);
|
|
if(nDiceRoll <= 2)
|
|
{
|
|
SendMessageToPC(oDead, "Trying is the first step towards failure. --Homer Simpson");
|
|
}
|
|
else if(nDiceRoll <= 4)
|
|
{
|
|
SendMessageToPC(oDead, "One meets his destiny often in the road he takes to avoid it. - Unknown");
|
|
}
|
|
else if(nDiceRoll <= 7)
|
|
{
|
|
SendMessageToPC(oDead, "Experience is what you get when you don't get what you want. - Unknown");
|
|
}
|
|
else if(nDiceRoll <= 9)
|
|
{
|
|
SendMessageToPC(oDead, "Death is nothing, but to live defeated and inglorious is to die daily. - Napoleon Bonaparte");
|
|
}
|
|
else if(nDiceRoll <= 11)
|
|
{
|
|
SendMessageToPC(oDead, "When angry count four; when very angry, swear. - Mark Twain");
|
|
}
|
|
else if(nDiceRoll <= 13)
|
|
{
|
|
SendMessageToPC(oDead, "It is possible to fail in many ways...while to succeed is possible only in one way. - Aristotle");
|
|
}
|
|
else if(nDiceRoll <= 15)
|
|
{
|
|
SendMessageToPC(oDead, "Come lovely and soothing death, Undulate round the world, serenely arriving, arriving, In the day, in the night, to all, to each, Sooner or later, delicate death. - Walt Whitman ");
|
|
}
|
|
else if(nDiceRoll <= 18)
|
|
{
|
|
SendMessageToPC(oDead, "Friends applaud, the comedy is finished. - Ludwig van Beethoven");
|
|
}
|
|
else if(nDiceRoll <= 21)
|
|
{
|
|
SendMessageToPC(oDead, "Our doubts are traitors, and make us lose the good we oft might win, by fearing to attempt. - William Shakespeare");
|
|
}
|
|
else if(nDiceRoll <= 24)
|
|
{
|
|
SendMessageToPC(oDead, "If you're going through hell, keep going. - Winston Churchill");
|
|
}
|
|
else if(nDiceRoll <= 27)
|
|
{
|
|
SendMessageToPC(oDead, "After I'm dead I'd rather have people ask why I have no monument than why I have one. - Cato the Elder");
|
|
}
|
|
else if(nDiceRoll <= 30)
|
|
{
|
|
SendMessageToPC(oDead, "I am not afraid of death, I just don't want to be there when it happens. - Woody Allen");
|
|
}
|
|
else if(nDiceRoll <= 33)
|
|
{
|
|
SendMessageToPC(oDead, "I plan to live forever, or die trying. -Villa, Blake Seven");
|
|
}
|
|
else if(nDiceRoll <= 36)
|
|
{
|
|
SendMessageToPC(oDead, "O Captain! my Captain! Our fearful trip is done! -Walt Whitman");
|
|
}
|
|
else if(nDiceRoll <= 39)
|
|
{
|
|
SendMessageToPC(oDead, "In this world nothing is certain but death and taxes. -Benjamin Franklin");
|
|
}
|
|
else if(nDiceRoll <= 42)
|
|
{
|
|
SendMessageToPC(oDead, "To be idle is a short road to death -Buddha");
|
|
}
|
|
else if(nDiceRoll <= 45)
|
|
{
|
|
SendMessageToPC(oDead, "A single death is a tragedy, a million deaths is a statistic. -Joseph Stalin");
|
|
}
|
|
else if(nDiceRoll <= 48)
|
|
{
|
|
SendMessageToPC(oDead, "Death is Amon's way to tell you 'slow down'. - Snow Walker");
|
|
}
|
|
else if(nDiceRoll <= 51)
|
|
{
|
|
SendMessageToPC(oDead, "Just keep swimming, just keep swimming, just keep swimming... - Dory");
|
|
}
|
|
else if(nDiceRoll <= 54)
|
|
{
|
|
SendMessageToPC(oDead, "Oh!! I seem to have falen down again. -- Cold Bane");
|
|
}
|
|
else if(nDiceRoll <= 57)
|
|
{
|
|
SendMessageToPC(oDead, "It was... the salmon mousse! - Death");
|
|
}
|
|
else if(nDiceRoll <= 60)
|
|
{
|
|
SendMessageToPC(oDead, "I drank what? - Aristotle");
|
|
}
|
|
else if(nDiceRoll <= 63)
|
|
{
|
|
SendMessageToPC(oDead, "Between grief and nothing, I will take grief. - Wm Faulkner");
|
|
}
|
|
else if(nDiceRoll <= 66)
|
|
{
|
|
SendMessageToPC(oDead, "I'm not dead yet! I feel better, I feel happy! -Old Man");
|
|
}
|
|
else if(nDiceRoll <= 69)
|
|
{
|
|
SendMessageToPC(oDead, "He's only mostly dead - Miracle Max");
|
|
}
|
|
else if(nDiceRoll <= 72)
|
|
{
|
|
SendMessageToPC(oDead, "Life is pleasant. Death is peaceful. It's the transition that's troublesome. -Isaac Asimov");
|
|
}
|
|
else if(nDiceRoll <= 75)
|
|
{
|
|
SendMessageToPC(oDead, "Must not all things at the last be swallowed up in death? -Plato");
|
|
}
|
|
else if(nDiceRoll <= 78)
|
|
{
|
|
SendMessageToPC(oDead, "Dying is a very dull, dreary affair. And my advice to you is to have nothing whatsoever to do with it. -W. Somerset Maugham");
|
|
}
|
|
else if(nDiceRoll <= 81)
|
|
{
|
|
SendMessageToPC(oDead, "It is impossible to experience one's death objectively and still carry a tune. -Woody Allen");
|
|
}
|
|
else if(nDiceRoll <= 84)
|
|
{
|
|
SendMessageToPC(oDead, "On the plus side, death is one of the few things that can be done just as easily lying down. -Woody Allen");
|
|
}
|
|
else if(nDiceRoll <= 87)
|
|
{
|
|
SendMessageToPC(oDead, "Some days your the wolf, some days your the stump. -Irentat");
|
|
}
|
|
else if(nDiceRoll <= 91)
|
|
{
|
|
SendMessageToPC(oDead, "You should know better than to pick up a duck in a dungeon. -Duck of Doom Card");
|
|
}
|
|
else if(nDiceRoll <= 94)
|
|
{
|
|
SendMessageToPC(oDead, "Ob-la-di ob-la-da life goes on bra La-la how the life goes on -The Beatles");
|
|
}
|
|
else if(nDiceRoll <= 97)
|
|
{
|
|
SendMessageToPC(oDead, "I don't think your doing it right -Ren");
|
|
}
|
|
else
|
|
{
|
|
SendMessageToPC(oDead, "The difference between failure and success is doing a thing nearly right and doing a thing exactly right. --Edward Simmons ");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
DeleteLocalInt (oDead,"T1_PLAYER_GRAVEEXP"); // Destroy last GraveXP
|
|
SendMessageToPC(oDead, "You did not loose enough XP for a grave to be created");
|
|
}
|
|
}
|
|
|
|
|
|
void main()
|
|
{
|
|
object oRespawner = GetLastRespawnButtonPresser();
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
|
|
RemoveEffects(oRespawner);
|
|
|
|
//Determine which DeathMethod is being used
|
|
if (GetLocalInt(GetModule(), "T1_MODULE_CFG_NOGRAVES") == 0)
|
|
{
|
|
DeathPenaltyGrave(oRespawner);
|
|
}
|
|
else
|
|
{
|
|
DeathPenalty(oRespawner);
|
|
}
|
|
|
|
// No Bindpoint set, use the Waypoint or Object with the following Tag
|
|
string sDestTag = GetLocalString(oRespawner,"T1_PLAYER_LASTBINDPOINT");
|
|
|
|
|
|
if (sDestTag == "" || GetLocalInt(GetModule(),"T1_MODULE_NOBINDSTONES") == TRUE)
|
|
{ // NO Bindpoint Set
|
|
sDestTag = "T1_MODULE_RESPAWN";
|
|
|
|
}
|
|
|
|
if (GetIsObjectValid(GetObjectByTag(sDestTag)))
|
|
{
|
|
object oSpawnPoint = GetObjectByTag(sDestTag);
|
|
if (GetLocalInt(oSpawnPoint,"T1_OBJECT_DISABLED") == TRUE)
|
|
{
|
|
sDestTag = "T1_MODULE_RESPAWN";
|
|
object oSpawnPoint = GetObjectByTag(sDestTag);
|
|
}
|
|
event evL = EventUserDefined(2222);
|
|
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
|
|
ActionWait(2.0f);
|
|
effect eFx = EffectVisualEffect(VFX_IMP_AURA_HOLY);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eFx, oRespawner);
|
|
SignalEvent(oSpawnPoint,evL);
|
|
}
|
|
}
|