PWE_PRC8/_module/nss/damagedragon.nss
Jaysyn904 ee1dc35889 Initial Commit
Initial Commit
2025-04-03 10:29:41 -04:00

98 lines
2.9 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Default On Damaged
//:: NW_C2_DEFAULT6
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
If already fighting then ignore, else determine
combat round
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 16, 2001
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
void main()
{
if(!GetFleeToExit())
{
if(!GetSpawnInCondition(NW_FLAG_SET_WARNINGS))
{
if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget()))
{
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
{
DetermineSpecialBehavior(GetLastDamager());
}
else if(GetIsObjectValid(GetLastDamager()))
{
DetermineCombatRound();
if(!GetIsFighting(OBJECT_SELF))
{
object oTarget = GetLastDamager();
if(!GetObjectSeen(oTarget) && GetArea(OBJECT_SELF) == GetArea(oTarget))
{
ActionMoveToLocation(GetLocation(oTarget), TRUE);
ActionDoCommand(DetermineCombatRound());
}
}
}
}
else if (!GetIsObjectValid(GetAttemptedSpellTarget()))
{
object oTarget = GetAttackTarget();
if(!GetIsObjectValid(oTarget))
{
oTarget = GetAttemptedAttackTarget();
}
object oAttacker = GetLastHostileActor();
if (GetIsObjectValid(oAttacker) && oTarget != oAttacker && GetIsEnemy(oAttacker) &&
(GetTotalDamageDealt() > (GetMaxHitPoints(OBJECT_SELF) / 4) ||
(GetHitDice(oAttacker) - 2) > GetHitDice(oTarget) ) )
{
DetermineCombatRound(oAttacker);
}
}
}
}
if(GetSpawnInCondition(NW_FLAG_DAMAGED_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1006));
}
/* Script generated by
Lilac Soul's NWN Script Generator, v. 1.2
For download info, please visit:
http://www.angelfire.com/space/lilacsoul */
//Can go OnDamaged, OnDisturbed, OnSpellCastAt, creature heartbeats, etc.
object oPC = GetLastHostileActor();
if (!GetIsPC(oPC)) return;
object oTarget;
object oSpawn;
oTarget = oPC;
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "nw_mepfire", GetLocation(oTarget));
oTarget = oSpawn;
SetIsTemporaryEnemy(oPC, oTarget);
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
oTarget = oSpawn;
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), GetLocation(oTarget));
}