RATDOG/_module/nss/userdef_troll.nss
Jaysyn904 a5138d8cd7 Dragonmarsh Lowlands cleanup
Dragonmarsh Lowlands cleanup, this area now spawns per PnP.  Made new, dire wolf, monstrous spider, troll, patrol sheriff, patrol footman, patrol knight, displacer beast, dire boat, dire rat & outlaw creatures.  Added several new ProjectQ & CEP models for the above creatures.  Initial pass on Level 9: Displacer Beast Lair.  Added missing portraits to portraits.2da.
2022-01-16 01:28:18 -05:00

105 lines
2.9 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Custom User Defined Event
//:: userdef_troll
//:: Copyright (c) 2022 Project RATDOG
//:://////////////////////////////////////////////
/*
*/
//:://////////////////////////////////////////////
//:: Created By: Gordon Bergstrom
//:: Created On: Dec 4, 2002
//:://////////////////////////////////////////////
//:: Modified By: Jaysyn
//:: Modified On: 2022/01/15
//:://////////////////////////////////////////////
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
{
}
//:: Execute the PRC NPC OnUserDef script
ExecuteScript("prc_npc_userdef", OBJECT_SELF);
}