RATDOG/_module/nss/ed3_troll_custom.nss
Jaysyn904 e870de8a20 File Reorganization
File Reorganization.  Initialized ratdog_creature hak & added Project Q overrides & other models.  Continued dynamic swapover & upgrade.
2021-10-02 03:15:34 -04:00

95 lines
2.7 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Custom User Defined Event
//:: ed3_troll_custom
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
*/
//:://////////////////////////////////////////////
//:: Created By: Gordon Bergstrom
//:: Created On: Dec 4, 2002
//:://////////////////////////////////////////////
void main()
{
int nUser = GetUserDefinedEventNumber();
int nFireDamage = 0;
int nAcidDamage = 0;
effect eSleep = EffectSleep();
effect eSlow = EffectSlow();
if(nUser == 1001) //HEARTBEAT
{
if(GetLocalInt(OBJECT_SELF, "nSubDual") > 0)
{
SetLocalInt(OBJECT_SELF, "nSubDual", GetLocalInt(OBJECT_SELF, "nSubDual") - 5);
if(GetLocalInt(OBJECT_SELF, "nSubDual") < GetCurrentHitPoints(OBJECT_SELF))
RemoveEffect(OBJECT_SELF, eSleep);
//SpeakString("My Subdual is now " + IntToString(GetLocalInt(OBJECT_SELF, "nSubDual")));
}
}
else if(nUser == 1002) // PERCEIVE
{
}
else if(nUser == 1003) // END OF COMBAT
{
}
else if(nUser == 1004) // ON DIALOGUE
{
}
else if(nUser == 1005) // ATTACKED
{
}
else if(nUser == 1006) // DAMAGED
{
int nTotalDamage = GetTotalDamageDealt();
if(GetDamageDealtByType(DAMAGE_TYPE_FIRE) > 0)
nFireDamage = GetDamageDealtByType(DAMAGE_TYPE_FIRE);
if(GetDamageDealtByType(DAMAGE_TYPE_ACID) > 0)
nAcidDamage = GetDamageDealtByType(DAMAGE_TYPE_ACID);
int nSubDmg = nTotalDamage - (nFireDamage + nAcidDamage);
int nActDmg = nFireDamage + nAcidDamage;
effect eHeal = EffectHeal(nSubDmg);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, OBJECT_SELF, 0.0f);
if(GetLocalInt(OBJECT_SELF, "nSubDual") <= GetCurrentHitPoints(OBJECT_SELF))
SetLocalInt(OBJECT_SELF, "nSubDual", nSubDmg + GetLocalInt(OBJECT_SELF, "nSubDual"));
int nSD = GetLocalInt(OBJECT_SELF, "nSubDual");
int nCH = GetCurrentHitPoints(OBJECT_SELF);
/*SpeakString("SD: " + IntToString(nSD));
SpeakString("CH: " + IntToString(nCH));*/
if(nSD > nCH)
{
//SpeakString("I am unconscious!");
SetIsDestroyable(FALSE, TRUE, TRUE);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSleep, OBJECT_SELF, 6.0f);
}
else if(nSD == nCH)
{
//SpeakString("I am staggered!");
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSlow, OBJECT_SELF, 6.0f);
}
}
else if(nUser == 1007) // DEATH
{
SetIsDestroyable(TRUE, FALSE, FALSE);
}
else if(nUser == 1008) // DISTURBED
{
}
}