Initial upload
Initial upload
This commit is contained in:
127
_module/nss/forcerespawn.nss
Normal file
127
_module/nss/forcerespawn.nss
Normal file
@@ -0,0 +1,127 @@
|
||||
|
||||
#include "nw_i0_plot"
|
||||
|
||||
// * Applies an XP and GP penalty
|
||||
// * to the player respawning
|
||||
void ApplyPenalty(object oDead)
|
||||
{
|
||||
int nXP = GetXP(oDead);
|
||||
int nPenalty = 75 * GetHitDice(oDead);
|
||||
int nHD = GetHitDice(oDead);
|
||||
// * You can not lose a level with this respawning
|
||||
int nMin = ((nHD * (nHD - 1)) / 2) * 100;
|
||||
|
||||
int nNewXP = nXP - nPenalty;
|
||||
if (nNewXP < nMin)
|
||||
nNewXP = nMin;
|
||||
SetXP(oDead, nNewXP);
|
||||
int nGoldToTake = FloatToInt(0.15 * 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 main()
|
||||
{
|
||||
|
||||
object oRespawner = GetLocalObject(OBJECT_SELF, "respawn");
|
||||
|
||||
object oPC = oRespawner;
|
||||
if (GetCampaignInt("PoA", "immortalname", oRespawner) == 2){
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetIsDead(OBJECT_SELF)){
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int deathtime = GetLocalInt(GetModule(), "died"+GetName(oPC));
|
||||
int currenttime = GetLocalInt(GetModule(), "loadtimer");
|
||||
int timer = currenttime - deathtime;
|
||||
|
||||
if (timer < 54){return;}
|
||||
|
||||
|
||||
SetLocalInt(GetModule(), "died"+GetName(oPC), 9999999);
|
||||
|
||||
|
||||
|
||||
|
||||
// Define who respawned and ressurect them, clear effects
|
||||
if (GetIsDead(OBJECT_SELF) ){
|
||||
|
||||
|
||||
int hd = GetHitDice(oRespawner);
|
||||
int looted = (d8());
|
||||
|
||||
if (looted == 1 || looted == 2){
|
||||
switch (d20()) {
|
||||
case 1: DestroyObject(GetItemInSlot(INVENTORY_SLOT_ARMS, oRespawner)); break;
|
||||
case 2: DestroyObject( GetItemInSlot(INVENTORY_SLOT_ARROWS, oRespawner)); break;
|
||||
case 3: DestroyObject( GetItemInSlot(INVENTORY_SLOT_BELT, oRespawner)); break;
|
||||
case 4: DestroyObject(GetItemInSlot(INVENTORY_SLOT_BOLTS, oRespawner)); break;
|
||||
case 5: DestroyObject(GetItemInSlot(INVENTORY_SLOT_BOOTS, oRespawner)); break;
|
||||
case 6: DestroyObject(GetItemInSlot(INVENTORY_SLOT_BULLETS, oRespawner)); break;
|
||||
case 7: DestroyObject( GetItemInSlot(INVENTORY_SLOT_CHEST, oRespawner)); break;
|
||||
case 8: DestroyObject(GetItemInSlot(INVENTORY_SLOT_CLOAK, oRespawner)); break;
|
||||
case 9: DestroyObject(GetItemInSlot(INVENTORY_SLOT_HEAD, oRespawner)); break;
|
||||
case 10: DestroyObject( GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oRespawner)); break;
|
||||
case 11: DestroyObject( GetItemInSlot(INVENTORY_SLOT_LEFTRING, oRespawner)); break;
|
||||
case 12: DestroyObject(GetItemInSlot(INVENTORY_SLOT_NECK, oRespawner)); break;
|
||||
case 13: DestroyObject( GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oRespawner)); break;
|
||||
case 14: DestroyObject(GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oRespawner)); break;
|
||||
case 15:DestroyObject( GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oRespawner)); break;
|
||||
case 16: DestroyObject(GetItemInSlot(INVENTORY_SLOT_HEAD, oRespawner)); break;
|
||||
case 17: DestroyObject(GetItemInSlot(INVENTORY_SLOT_CHEST, oRespawner)); break;
|
||||
case 18: DestroyObject(GetItemInSlot(INVENTORY_SLOT_CLOAK, oRespawner)); break;
|
||||
case 19: DestroyObject( GetItemInSlot(INVENTORY_SLOT_NECK, oRespawner)); break;
|
||||
case 20: DestroyObject( GetItemInSlot(INVENTORY_SLOT_BELT, oRespawner));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
SendMessageToPC(oRespawner, "Someone or Something has looted your corpse!");
|
||||
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
|
||||
RemoveEffects(oRespawner);
|
||||
|
||||
// Take 10% gold and 10% xp
|
||||
|
||||
ApplyPenalty(oRespawner);
|
||||
if(GetGold(oRespawner)>= 7500000){
|
||||
int gold = GetGold(oRespawner) - 7400000;
|
||||
AssignCommand(oRespawner, TakeGoldFromCreature(gold, oRespawner, TRUE));
|
||||
SendMessageToPC(oRespawner, "Your soul has departed your body. Only the Immortals can grant you life again.");
|
||||
}
|
||||
|
||||
// Set the Local Integers that the NPC that teleports looks for
|
||||
// conversation purposes and to define the area that he teleports
|
||||
// the group to
|
||||
if ((GetArea(oRespawner)) == (GetArea(GetObjectByTag("Satan"))))
|
||||
{
|
||||
string sDestTag = "torture";
|
||||
object oSpawnPoint = GetObjectByTag(sDestTag);
|
||||
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
|
||||
}
|
||||
else{
|
||||
|
||||
string sDestTag = "DEATH";
|
||||
object oSpawnPoint = GetObjectByTag(sDestTag);
|
||||
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user