LoD_PRC8/_module/nss/deathonheartbeat.nss
Jaysyn904 94990edc60 Initial Upload
Initial Upload
2023-09-21 21:20:34 -04:00

52 lines
1.9 KiB
Plaintext

/*Created by Fadedshadow 8/28/02. Feel free to modify,pirate,or whatever to suit your needs. */
void main()
{
object oPC = GetLastPlayerDying();
int nHitPoints = GetCurrentHitPoints(oPC);
effect eHeal = EffectHeal(1);
effect eDamage = EffectDamage(1,DAMAGE_TYPE_MAGICAL,DAMAGE_POWER_PLUS_FIVE);
string sDying = "Help ! I'm dying !";
string sStable = "I've stablized.";
string sRecover = "I have recovered.";
/* You can make this 0 so the pc will stay unconcious until healed by someone else. */
if (nHitPoints < 1)
{
if (nHitPoints > -10)
{
int nRoll = (Random(100));
if (GetLocalString(oPC,"sBleeding") == "True" && nRoll <=10)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oPC);
AssignCommand(oPC,SpeakString(sStable));
SetLocalString(oPC, "sBleeding","False");
if (GetCurrentHitPoints(oPC) >= 1)
{
SetLocalString(oPC, "sBleeding","True");
}
}
if (GetLocalString(oPC,"sBleeding") == "True" && nRoll > 10)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC);
AssignCommand(oPC,SpeakString(sDying));
}
if (nRoll <=33 && GetLocalString(oPC,"sBleeding") =="False")
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oPC);
}
if (GetCurrentHitPoints(oPC) >= 1)
{
SetLocalString(oPC, "sBleeding","True");
AssignCommand(oPC,SpeakString(sRecover));
}
}
}
if(GetCurrentHitPoints(oPC) <= -10)
{
effect eDeath = EffectDeath(FALSE, FALSE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, GetLastPlayerDying());
}
}