137 lines
4.2 KiB
Plaintext
137 lines
4.2 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 = 50 * 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;
|
|
|
|
SetXP(oDead, nNewXP);
|
|
int nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
|
|
// * a cap of 10 000gp taken from you
|
|
if (nGoldToTake > 10000)
|
|
{
|
|
nGoldToTake = 10000;
|
|
}
|
|
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 = 50 * 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 > 10000)
|
|
{
|
|
nGoldToTake = 10000;
|
|
}
|
|
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);
|
|
SendMessageToPC(oDead, "A grave has been erected where you have been slain. Go back and pray to get back some experience");
|
|
}
|
|
else
|
|
{
|
|
DeleteLocalInt (oDead,"T1_PLAYER_GRAVEEXP"); // Destroy last GraveXP
|
|
SendMessageToPC(oDead, "You did not lose enough XP for a grave to be created");
|
|
}
|
|
}
|
|
|
|
|
|
void main()
|
|
{
|
|
object oRespawner = GetPCSpeaker();
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
|
|
RemoveEffects(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);
|
|
}
|
|
|
|
|
|
}
|
|
|