2025/07/21 Update

Added PEPS AI
Full compile.
This commit is contained in:
Jaysyn904
2025-07-21 12:33:56 -04:00
parent 2d0a7a8a89
commit 87608ac499
2806 changed files with 44346 additions and 557 deletions

View File

@@ -1,81 +1,34 @@
//::///////////////////////////////////////////////
//:: 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"
/*//////////////////////////////////////////////////////////////////////////////
Script: nw_c2_default6
Programmer: Philos
////////////////////////////////////////////////////////////////////////////////
Monster OnDamaged event script;
Does not fire if the creature dies from the damage.
Does not fire for plot creatures as they take no damage.
May fire before or after OnPhysicalAttacked event.
Fires when EffectDamage is applied to oCreature even if 0 damage.
Fires when a weapon damages a oCreature, but not if resisted.
*///////////////////////////////////////////////////////////////////////////////
#include "0i_actions"
void main()
{
ExecuteScript("prc_npc_damaged", OBJECT_SELF);
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()))
{
/*
if (GetFactionEqual(GetLastDamager())) {
Jug_MaintainAllyStatus(GetLastDamager());
}
else
{
*/
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) ) )
{
/*
if (GetFactionEqual(GetLastAttacker())) {
Jug_MaintainAllyStatus(GetLastAttacker());
} else {
*/
DetermineCombatRound(oAttacker);
// }
}
}
}
}
object oCreature = OBJECT_SELF;
ExecuteScript("prc_npc_damaged", oCreature);
// Send the user-defined event signal
if(GetSpawnInCondition(NW_FLAG_DAMAGED_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1006));
SignalEvent(oCreature, EventUserDefined(EVENT_DAMAGED));
return;
}
if(ai_Disabled(oCreature)) return;
// Make sure to clear wounded shout limit if we take damage. See ai_TryHealing.
DeleteLocalInt(oCreature, "AI_WOUNDED_SHOUT_LIMIT");
object oDamager = GetLastDamager(oCreature);
if(AI_DEBUG) ai_Debug("nw_c2_default6", "23", GetName(oCreature) + " has been damaged by " + GetName(oDamager));
if(ai_GetFleeToExit(oCreature)) return;
if(GetObjectType(oDamager) == OBJECT_TYPE_AREA_OF_EFFECT &&
ai_IsInADangerousAOE(oCreature, AI_RANGE_BATTLEFIELD, TRUE)) return;
if(ai_GetIsBusy(oCreature) || ai_GetIsInCombat(oCreature)) return;
if(GetDistanceBetween(oCreature, oDamager) < AI_RANGE_CLOSE) ai_DoMonsterCombatRound(oCreature);
else ActionMoveToObject(oDamager, TRUE, AI_RANGE_CLOSE - 1.0);
}