RoT2_PRC8/_module/nss/xx_cb_bleed.nss
Jaysyn904 499aba4eb3 Initial upload
Initial upload
2023-09-25 18:13:22 -04:00

91 lines
3.0 KiB
Plaintext

//Credits: Scott Thorne's bleed script (bleed function)
//Regen occurs, 1 regen is a bad situation.
//Save % line 35 (>random means lower % to save)
void bleed(int iBleedAmt)
{ effect eBleedEff;
/* keep executing recursively until character is dead or at +1 hit points */
if (GetCurrentHitPoints() <= 0)
{ /* a positive bleeding amount means damage, otherwise heal the character */
if (iBleedAmt > 0)
{
eBleedEff = EffectDamage(iBleedAmt);
}
else
{
eBleedEff = EffectHeal(-iBleedAmt); /* note the negative sign */
}
ApplyEffectToObject(DURATION_TYPE_INSTANT, eBleedEff, OBJECT_SELF);
/* -10 hit points is the death threshold, at or beyond it the character dies */
if (GetCurrentHitPoints() <= -10)
{ PlayVoiceChat(VOICE_CHAT_DEATH); /* scream one last time */
//ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), OBJECT_SELF); /* make death dramatic */
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), OBJECT_SELF); /* now kill them */
return;
}
if (iBleedAmt > 0)
{ /* only check if character has not stablized */
// increase random number if needed, 5% each round bleeding
if (Random(20) == 1)
{
iBleedAmt = -iBleedAmt*2; /* reverse the bleeding process */
PlayVoiceChat(VOICE_CHAT_LAUGH); /* laugh at death -- this time */
}
else
{
switch (d6())
{
case 1: PlayVoiceChat(VOICE_CHAT_PAIN1); break;
case 2: PlayVoiceChat(VOICE_CHAT_PAIN2); break;
case 3: PlayVoiceChat(VOICE_CHAT_PAIN3); break;
case 4: PlayVoiceChat(VOICE_CHAT_HEALME); break;
case 5: PlayVoiceChat(VOICE_CHAT_NEARDEATH); break;
case 6: PlayVoiceChat(VOICE_CHAT_HELP);
}
}
}
DelayCommand(8.0,bleed(iBleedAmt)); /* do this again next round */
}
}
void main()
{
object oDying = GetLastPlayerDying();
object oMaster = GetMaster(oDying);
if (oMaster != OBJECT_INVALID)
{
effect Deathstroke = EffectDeath(TRUE);
ApplyEffectToObject(DURATION_TYPE_INSTANT,Deathstroke,oDying);
return;
}
AssignCommand(oDying, ClearAllActions());
PopUpDeathGUIPanel(oDying, TRUE, TRUE, 0,
"You are bleeding to death, wait for help or respawn.");
AssignCommand(oDying, bleed(1));
}
/* returns TRUE if oCreature is a <span class="highlight">familiar</span>
int GetIsFamiliar(object oCreature)
{
// declare
int nResult = FALSE;
object oMaster = GetMaster(oCreature);
if (oMaster != OBJECT_INVALID)
{
// compare master's <span class="highlight">familiar</span> associate with creature
if(oCreature == GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oMaster))
nResult = TRUE;
}
// return
return nResult;
}