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,68 +1,70 @@
//::///////////////////////////////////////////////
//:: SetListeningPatterns
//:: NW_C2_DEFAULT4
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Determines the course of action to be taken
by the generic script after dialogue or a
shout is initiated.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 24, 2001
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
/*//////////////////////////////////////////////////////////////////////////////
Script: 0e_c2_4_convers
Programmer: Philos
////////////////////////////////////////////////////////////////////////////////
Monster OnConversation;
Fires when oCreature has been clicked on for conversation.
Fires when oCreature hears a shout from another creature.
If SetListening is FALSE then oCreature will not "hear" anything.
*///////////////////////////////////////////////////////////////////////////////
#include "0i_associates"
void ai_MonsterCommands(object oCreature, object oSpeaker, int nMatch);
void main()
{
int nMatch = GetListenPatternNumber();
object oShouter = GetLastSpeaker();
object oIntruder;
ExecuteScript("prc_npc_conv", OBJECT_SELF);
ExecuteScript("dmfi_voice_exe", OBJECT_SELF);
if (nMatch == -1 && GetIsPC(oShouter) &&(GetLocalInt(GetModule(), "dmfi_AllMute") || GetLocalInt(OBJECT_SELF, "dmfi_Mute")))
object oCreature = OBJECT_SELF;
ExecuteScript("prc_npc_conv", oCreature);
if(AI_DEBUG) ai_Debug("nw_c2_default4", "15", GetName(oCreature) + " listens " +
IntToString(GetListenPatternNumber()) + " to " + GetName(GetLastSpeaker()) + "." +
" AI_AM_I_SEARCHING: " + IntToString(GetLocalInt(oCreature, AI_AM_I_SEARCHING)));
if(ai_GetIsBusy(oCreature) || ai_Disabled(oCreature) || GetLocalInt(oCreature, AI_AM_I_SEARCHING)) return;
if(ai_GetIsInCombat(oCreature))
{
SendMessageToAllDMs(GetName(oShouter) + " is trying to speak to a muted NPC, " + GetName(OBJECT_SELF) + ", in area " + GetName(GetArea(OBJECT_SELF)));
SendMessageToPC(oShouter, "This NPC is muted. A DM will be here shortly.");
ai_DoMonsterCombatRound(oCreature);
return;
}
else if (nMatch == -1 && GetCommandable(OBJECT_SELF) && !GetLocalInt(GetModule(), "dmfi_AllMute") && !GetLocalInt(OBJECT_SELF, "dmfi_Mute"))
object oLastSpeaker = GetLastSpeaker();
int nMatch = GetListenPatternNumber();
if(nMatch != -1)
{
SetLocalObject(oShouter, "hls_MyNPCSpeaker", OBJECT_SELF);
ClearAllActions();
if(GetFactionEqual(oLastSpeaker, oCreature)) ai_MonsterCommands(oCreature, oLastSpeaker, nMatch);
}
else
{
ai_ClearCreatureActions();
BeginConversation();
}
else if(nMatch != -1 && GetIsObjectValid(oShouter) && !GetIsPC(oShouter) && GetIsFriend(oShouter))
{
if(nMatch == 4)
{
oIntruder = GetLocalObject(oShouter, "NW_BLOCKER_INTRUDER");
}
else if (nMatch == 5)
{
oIntruder = GetLastHostileActor(oShouter);
if(!GetIsObjectValid(oIntruder))
{
oIntruder = GetAttemptedAttackTarget();
if(!GetIsObjectValid(oIntruder))
{
oIntruder = GetAttemptedSpellTarget();
if(!GetIsObjectValid(oIntruder))
{
oIntruder = OBJECT_INVALID;
}
}
}
}
RespondToShout(oShouter, nMatch, oIntruder);
}
// Send the user-defined event if appropriate
if(GetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1004));
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_DIALOGUE));
}
}
void ai_MonsterCommands(object oCreature, object oSpeaker, int nMatch)
{
object oTarget = GetLocalObject(oSpeaker, AI_MY_TARGET);
if(nMatch == AI_ALLY_SEES_AN_ENEMY || nMatch == AI_ALLY_HEARD_AN_ENEMY)
{
if(AI_DEBUG) ai_Debug("nw_c2_default4", "46", GetName(oCreature) + " heard " +
GetName(oSpeaker) + " has seen an enemy!");
if(ai_CanIAttack(oCreature)) ai_FindTheEnemy(oCreature, oSpeaker, oTarget, TRUE);
}
else if(nMatch == AI_ALLY_ATKED_BY_WEAPON ||
nMatch == AI_ALLY_ATKED_BY_SPELL)
{
if(AI_DEBUG) ai_Debug("nw_c2_default4", "53", GetName(oCreature) + " heard " +
GetName(oSpeaker) + " has been attacked by " +
GetName(GetLocalObject(oSpeaker, AI_MY_TARGET)) + "!");
if(ai_CanIAttack(oCreature)) ai_FindTheEnemy(oCreature, oSpeaker, oTarget, TRUE);
}
else if(nMatch == AI_ALLY_IS_WOUNDED)
{
if(AI_DEBUG) ai_Debug("nw_c2_default4", "60", GetName(oCreature) + " heard " +
GetName(oSpeaker) + " is wounded!");
if(ai_GetIsInCombat(oCreature)) ai_TryHealingTalent(oCreature, ai_GetNumOfEnemiesInRange(oCreature), oSpeaker);
else ai_TryHealing(oCreature, oSpeaker);
}
/*else if(nMatch == AI_ALLY_IS_DEAD)
{
} */
}