NWScript:
void pcdying (object oPC)
{
string sName = GetName (oPC);
if (GetCurrentHitPoints (oPC) > GetLocalInt( oPC, "iCurrhp"))
{
SetLocalInt ( oPC, "iDying", 0) ;
string sCurrhp = IntToString ( GetCurrentHitPoints(oPC));
FloatingTextStringOnCreature( sName + " Has Stabilized By Healing at " + sCurrhp + " HPs", oPC, TRUE) ;
if (( GetCurrentHitPoints (oPC) <= 0) && (GetLocalInt( oPC, "iDying") == 0 ))
{
DelayCommand(2.5, PopUpDeathGUIPanel( oPC, TRUE, TRUE, 0, "You Stabilized By Healing, If You Respawn You Will Lose Some Experience!"));
}
}
if (GetLocalInt ( oPC, "iDying") == 1)
{
int oDieroll = d100 (1) ;
string sDieroll = IntToString (oDieroll);
SendMessageToPC ( oPC, " Stabilize Roll: " + sDieroll);
if ( oDieroll <=10 && GetLocalInt ( oPC, "iDying") == 1 )
{
SetLocalInt ( oPC, "iDying", 0) ;
string sCurrhp = IntToString ( GetCurrentHitPoints(oPC));
FloatingTextStringOnCreature ( sName + " Has Self Stabilized at " + sCurrhp + " HPs", oPC, TRUE) ;
DelayCommand ( 2.5, PopUpDeathGUIPanel(oPC,TRUE, TRUE, 0, "You Self Stabilized, If You Respawn You Will Lose Some Experience!"));
}
}
if (GetLocalInt ( oPC, "iDying") == 1)
{
effect eDamage = EffectDamage ( 1, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_FIVE);
ApplyEffectToObject ( DURATION_TYPE_INSTANT, eDamage, oPC);
SetLocalInt( oPC, "iCurrhp", GetCurrentHitPoints (oPC));
string sCurrhp = IntToString ( GetCurrentHitPoints(oPC));
if ( GetCurrentHitPoints (oPC) > -10)
{
FloatingTextStringOnCreature( sName + ": is Bleeding! Hitpoints currently at " + sCurrhp, oPC, TRUE) ;
}
}
}
void main()
{
object oPC = GetFirstPC ();
while ( GetIsObjectValid (oPC))
{
if (GetLocalInt ( oPC, "iDying") == 1)
{
pcdying (oPC);
}
oPC = GetNextPC ();
}
}