Amon_PRC8/_module/nss/js_onplayerdeath.nss

47 lines
1.9 KiB
Plaintext
Raw Permalink Normal View History

2025-04-03 19:00:46 -04:00
//:://////////////////////////////////////////////
//:: Name: OnPlayerDeath
//:: FileName: js_onplayerdeath
//:://////////////////////////////////////////////
/*
When a PC dies the GUI automatically pops up,
and we have to clear all the actions and delay
it so we can set local int of HPs and string.
*/
//:://////////////////////////////////////////////
//:: Created By: SPBTooL
//:: Created By: Jer Wolfe
//::
//:: Created On: Aug 04, 2002
//:://////////////////////////////////////////////
#include "js_include"
void main()
{
object oPC = GetLastPlayerDied();
AssignCommand(oPC, ClearAllActions());
location lWhereDied = GetLocation(oPC);
object oPCCorpse = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_corpse1", lWhereDied);
// Save their hit points in case they disconnect
SetLocalInt(oPC, "LastHitPoints", GetCurrentHitPoints(oPC));
// * make friendly to Each of the 3 common factions
AssignCommand(oPC, ClearAllActions());
// * Note: waiting for Sophia to make SetStandardFactionReptuation to clear all personal reputation
if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oPC) <= 10)
{ SetLocalInt(oPC, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oPC);
}
if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oPC) <= 10)
{ SetLocalInt(oPC, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oPC);
}
if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oPC) <= 10)
{ SetLocalInt(oPC, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPC);
}
//SetLocalInt(oPCCorpse, "PCCorpse" + GetName(oPC), 1);
DelayCommand(2.5, PopUpDeathGUIPanel(oPC, TRUE, TRUE, 0, sDeathGUIMessage));
}