HiddenTradition_PRC8/_module/nss/troll_on_heart.nss
2024-06-20 15:47:42 -04:00

56 lines
1.4 KiB
Plaintext

////////////////////////////////
//
// Troll (Acurate for 3E)
//
// By\ Invizible420
// Created\ 11.28.04
//
// ScriptName\ troll_on_heart
//
// Location for script\
// To be placed in the
// Heartbeat event of the
// troll.
//
//
// See troll_on_dmg for mor
//
////////////////////////////////
#include "NW_I0_GENERIC"
#include "inc_utility"
void main()
{
object oSelf = OBJECT_SELF;
// Get the Amount of SD then regen -5 each turn
if (GetLocalInt(oSelf,"AMOUNT_SUBDMG") > 0)
{
int oSDMG = GetLocalInt(oSelf,"AMOUNT_SUBDMG")-5;
SetLocalInt(oSelf,"AMOUNT_SUBDMG",oSDMG);
}
// Check that creature is ready for restore
if (GetLocalInt(oSelf,"AMOUNT_SUBDMG") <= GetMaxHitPoints())
{
// Get the Sleep effect (sleep meaning unconsciouseness)
if (PRCGetHasEffect(EFFECT_TYPE_SLEEP))
{
effect eSleep = GetFirstEffect(oSelf);
while (GetIsEffectValid(eSleep))
{
// Remove the sleep effects and immobility
if ((GetEffectType(eSleep) == EFFECT_TYPE_SLEEP &&
GetEffectSpellId(eSleep) != SPELL_SLEEP) ||
GetEffectType(eSleep) == EFFECT_TYPE_CUTSCENEIMMOBILIZE)
{
RemoveEffect(oSelf, eSleep);
}
eSleep = GetNextEffect(oSelf);
}
}
}
}