2025/07/20 Afternoon Update

Updated PEPS AI.
This commit is contained in:
Jaysyn904
2025-07-20 12:36:58 -04:00
parent df58b1a133
commit ac076efc50
77 changed files with 981 additions and 703 deletions

View File

@@ -11,35 +11,12 @@
Fires when ever one of these states changes from TRUE to FALSE or FALSE to TRUE.
*///////////////////////////////////////////////////////////////////////////////
#include "0i_associates"
#include "anph_inc"
int DruidIsNear(object PC)
{
if (GetLevelByClass(CLASS_TYPE_DRUID, PC) > 0)
return 1;
int Nth = 1;
object Druid;
Druid = GetNearestCreature(CREATURE_TYPE_CLASS, CLASS_TYPE_DRUID, PC, Nth);
// Search friendly druid
while (GetIsEnemy(Druid, PC) && GetIsObjectValid(Druid) && GetDistanceBetween(PC, Druid) < 50.0)
{
Nth++;
Druid = GetNearestCreature(CREATURE_TYPE_CLASS, CLASS_TYPE_DRUID, GetLastPerceived(), Nth);
}
if (!GetIsEnemy(Druid, PC) && GetIsObjectValid(Druid) && GetDistanceBetween(PC, Druid) < 50.0)
return 1;
return 0;
}
void main()
{
// * if not runnning normal or better AI then exit for performance reasons
//if (GetAILevel() == AI_LEVEL_VERY_LOW) return;
object oCreature = OBJECT_SELF;
ExecuteScript("prc_npc_percep", OBJECT_SELF);
ExecuteScript("prc_npc_percep", oCreature);
if(AI_DEBUG) ai_Debug("nw_c2_default2", "19", "AI_ONSPAWN_EVENT: " + IntToString(GetLocalInt(oCreature, AI_ONSPAWN_EVENT)));
if(!GetLocalInt(oCreature, AI_ONSPAWN_EVENT)) return;
if(GetLastPerceptionSeen())
@@ -86,35 +63,6 @@ void main()
// ************************** ENEMY SEEN *******************************
if(bSeen)
{
if(!GetHasEffect(EFFECT_TYPE_SLEEP))
{
// Blow fa horn if we have one. The NPC in question MUST have the faction ring of
// his faction somewhere in his inventory AND an item with the tag "NPCHorn"
object oHorn = GetItemPossessedBy(oCreature, "NPCHorn");
object oPercep = GetLastPerceived();
if (GetIsObjectValid(oHorn) &&
GetIsPC(oPercep) &&
!GetIsDM(oPercep) &&
GetLocalInt(oCreature, "HornSounded") == FALSE)
{
AnphSendWarningCall(oCreature);
SetLocalInt(oCreature, "HornSounded", TRUE);
AssignCommand(GetModule(), DelayCommand(60.0f, DeleteLocalInt(oCreature, "HornSounded")));
}
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
{
//MyPrintString("DetermineSpecialBehavior");
DetermineSpecialBehavior();
} else if ((GetLevelByClass(CLASS_TYPE_ANIMAL) == 0) ||
(GetLevelByClass(CLASS_TYPE_ANIMAL) > 0 && !DruidIsNear(oPercep)))
{
//MyPrintString("DetermineCombatRound");
SetFacingPoint(GetPosition(oPercep));
SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK);
DetermineCombatRound();
}
}
// If the creature we are perceiving was our invisible creature then
// remove that they are invisible.
if(oLastPerceived == GetLocalObject(oCreature, AI_IS_INVISIBLE))