151 lines
3.3 KiB
Plaintext
151 lines
3.3 KiB
Plaintext
//Created by Guile 1/01/07 (Hapyy New Years :)
|
|
//Goes OnPlayerRespawn of the module properties
|
|
object oItem;
|
|
location lTarget;
|
|
object oTarget;
|
|
|
|
#include "nw_i0_plot"
|
|
void RemoveXPFromParty(int nXP, object oPC, int bAllParty=FALSE)
|
|
{
|
|
|
|
if (!bAllParty)
|
|
{
|
|
nXP=(GetXP(oPC)-nXP)>=0 ? GetXP(oPC)-nXP : 0;
|
|
SetXP(oPC, nXP);
|
|
}
|
|
else
|
|
{
|
|
object oMember=GetFirstFactionMember(oPC, TRUE);
|
|
|
|
while (GetIsObjectValid(oMember))
|
|
{
|
|
nXP=(GetXP(oMember)-nXP)>=0 ? GetXP(oMember)-nXP : 0;
|
|
SetXP(oMember, nXP);
|
|
oMember=GetNextFactionMember(oPC, TRUE);
|
|
}
|
|
}
|
|
}
|
|
void main()
|
|
{
|
|
|
|
object oPC = GetLastRespawnButtonPresser();
|
|
|
|
if (!GetIsPC(oPC)) return;
|
|
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPC);
|
|
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPC)), oPC);
|
|
|
|
RemoveEffects(oPC);
|
|
|
|
|
|
|
|
if (GetItemPossessedBy(oPC, "arenatoken")!= OBJECT_INVALID)
|
|
{
|
|
object oTarget = GetWaypointByTag("arenaspawnpt");
|
|
DelayCommand(0.5, AssignCommand(oPC, JumpToObject(oTarget)));
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPC);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPC)), oPC);
|
|
|
|
}
|
|
|
|
else
|
|
{
|
|
if (GetHitDice(oPC) >= 21)
|
|
{
|
|
oTarget = GetWaypointByTag("home2");
|
|
|
|
lTarget = GetLocation(oTarget);
|
|
|
|
|
|
if (GetArea(GetAreaFromLocation(lTarget))==OBJECT_INVALID) return;
|
|
|
|
SetLocalLocation(oPC, "ls_stored_loc", GetLocation(oPC));
|
|
|
|
AssignCommand(oPC, ClearAllActions());
|
|
|
|
AssignCommand(oPC, ActionJumpToLocation(lTarget));
|
|
|
|
RemoveXPFromParty(1000, oPC, FALSE);
|
|
|
|
oItem = GetFirstItemInInventory(oPC);
|
|
|
|
while (GetIsObjectValid(oItem))
|
|
{
|
|
if (GetTag(oItem)=="death") DestroyObject(oItem);
|
|
|
|
oItem = GetNextItemInInventory(oPC);
|
|
}
|
|
|
|
AssignCommand(oPC, TakeGoldFromCreature(5000, oPC, TRUE));
|
|
|
|
FloatingTextStringOnCreature("Someone or something has looted your corpse!", oPC);
|
|
|
|
}
|
|
else if (GetHitDice(oPC) >= 10)
|
|
{
|
|
oTarget = GetWaypointByTag("home");
|
|
|
|
lTarget = GetLocation(oTarget);
|
|
|
|
|
|
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
|
|
|
|
SetLocalLocation(oPC, "ls_stored_loc", GetLocation(oPC));
|
|
|
|
AssignCommand(oPC, ClearAllActions());
|
|
|
|
AssignCommand(oPC, ActionJumpToLocation(lTarget));
|
|
|
|
FloatingTextStringOnCreature("Someone or something has looted your corpse!", oPC);
|
|
|
|
RemoveXPFromParty(500, oPC, FALSE);
|
|
|
|
oItem = GetFirstItemInInventory(oPC);
|
|
|
|
while (GetIsObjectValid(oItem))
|
|
{
|
|
if (GetTag(oItem)=="death") DestroyObject(oItem);
|
|
|
|
oItem = GetNextItemInInventory(oPC);
|
|
}
|
|
|
|
AssignCommand(oPC, TakeGoldFromCreature(3000, oPC, TRUE));
|
|
|
|
}
|
|
else
|
|
{
|
|
oTarget = GetWaypointByTag("home");
|
|
|
|
lTarget = GetLocation(oTarget);
|
|
|
|
|
|
if (GetArea(GetAreaFromLocation(lTarget))==OBJECT_INVALID) return;
|
|
|
|
SetLocalLocation(oPC, "ls_stored_loc", GetLocation(oPC));
|
|
|
|
AssignCommand(oPC, ClearAllActions());
|
|
|
|
AssignCommand(oPC, ActionJumpToLocation(lTarget));
|
|
|
|
FloatingTextStringOnCreature("Someone or something has looted your corpse!", oPC);
|
|
|
|
RemoveXPFromParty(300, oPC, FALSE);
|
|
|
|
oItem = GetFirstItemInInventory(oPC);
|
|
|
|
while (GetIsObjectValid(oItem))
|
|
{
|
|
if (GetTag(oItem)=="death") DestroyObject(oItem);
|
|
|
|
oItem = GetNextItemInInventory(oPC);
|
|
}
|
|
|
|
AssignCommand(oPC, TakeGoldFromCreature(1000, oPC, TRUE));
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|