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

BIN
_removed/nw_c2_default1.ncs Normal file

Binary file not shown.

103
_removed/nw_c2_default1.nss Normal file
View File

@@ -0,0 +1,103 @@
//::///////////////////////////////////////////////
//:: Default On Heartbeat
//:: NW_C2_DEFAULT1
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This script will have people perform default
animations.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Nov 23, 2001
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
#include "inc_utility"
void main()
{
ExecuteScript("prc_npc_hb", OBJECT_SELF);
if(GetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY))
{
if(TalentAdvancedBuff(40.0))
{
SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY, FALSE);
return;
}
}
if(GetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING))
{
int nDay = FALSE;
if(GetIsDay() || GetIsDawn())
{
nDay = TRUE;
}
if(GetLocalInt(OBJECT_SELF, "NW_GENERIC_DAY_NIGHT") != nDay)
{
if(nDay == TRUE)
{
SetLocalInt(OBJECT_SELF, "NW_GENERIC_DAY_NIGHT", TRUE);
}
else
{
SetLocalInt(OBJECT_SELF, "NW_GENERIC_DAY_NIGHT", FALSE);
}
WalkWayPoints();
}
}
if(!PRCGetHasEffect(EFFECT_TYPE_SLEEP))
{
if(!GetIsPostOrWalking())
{
if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget()))
{
if(!GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN)))
{
if(!GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL) && !IsInConversation(OBJECT_SELF))
{
if(GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS) || GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS_AVIAN))
{
PlayMobileAmbientAnimations();
}
else if(GetIsEncounterCreature() &&
!GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN)))
{
PlayMobileAmbientAnimations();
}
else if(GetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS) &&
!GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN)))
{
PlayImmobileAmbientAnimations();
}
}
else
{
DetermineSpecialBehavior();
}
}
else
{
//DetermineCombatRound();
}
}
}
}
else
{
if(GetSpawnInCondition(NW_FLAG_SLEEPING_AT_NIGHT))
{
effect eVis = EffectVisualEffect(VFX_IMP_SLEEP);
if(d10() > 6)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF);
}
}
}
if(GetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1001));
}
}

BIN
_removed/nw_c2_default2.ncs Normal file

Binary file not shown.

127
_removed/nw_c2_default2.nss Normal file
View File

@@ -0,0 +1,127 @@
//:://////////////////////////////////////////////////
//:: NW_C2_DEFAULT2
/*
Default OnPerception event handler for NPCs.
Handles behavior when perceiving a creature for the
first time.
*/
//:://////////////////////////////////////////////////
#include "inc_utility"
#include "nw_i0_generic"
void main()
{
ExecuteScript("prc_npc_percep", OBJECT_SELF);
object oPC = GetLastPerceived();
if (!GetIsPC(oPC)) return;
if (!GetLastPerceptionSeen()) return;
// * if not runnning normal or better Ai then exit for performance reasons
// * if not runnning normal or better Ai then exit for performance reasons
if (GetAILevel() == AI_LEVEL_VERY_LOW) return;
object oPercep = GetLastPerceived();
int bSeen = GetLastPerceptionSeen();
// This will cause the NPC to speak their one-liner
// conversation on perception even if they are already
// in combat.
if(GetSpawnInCondition(NW_FLAG_SPECIAL_COMBAT_CONVERSATION)
&& GetIsPC(oPercep)
&& bSeen)
{
SpeakOneLinerConversation();
}
// March 5 2003 Brent
// Had to add this section back in, since modifications were not taking this specific
// example into account -- it made invisibility basically useless.
//If the last perception event was hearing based or if someone vanished then go to search mode
if ((GetLastPerceptionVanished()) && GetIsEnemy(GetLastPerceived()))
{
object oGone = GetLastPerceived();
if((GetAttemptedAttackTarget() == GetLastPerceived() ||
GetAttemptedSpellTarget() == GetLastPerceived() ||
GetAttackTarget() == GetLastPerceived()) && GetArea(GetLastPerceived()) != GetArea(OBJECT_SELF))
{
//SpeakString("dude...like disappeared.");
ClearAllActions();
DetermineCombatRound();
}
}
// This section has been heavily revised while keeping the
// pre-existing behavior:
// - If we're in combat, keep fighting.
// - If not and we've perceived an enemy, start to fight.
// Even if the perception event was a 'vanish', that's
// still what we do anyway, since that will keep us
// fighting any visible targets.
// - If we're not in combat and haven't perceived an enemy,
// see if the perception target is a PC and if we should
// speak our attention-getting one-liner.
if (GetIsFighting(OBJECT_SELF)) {
// don't do anything else, we're busy
MyPrintString("GetIsFighting: TRUE");
}
// * BK FEB 2003 Only fight if you can see them. DO NOT RELY ON HEARING FOR ENEMY DETECTION
else if (GetIsEnemy(oPercep) && bSeen) {
MyPrintString("GetIsEnemy: TRUE");
// We spotted an enemy and we're not already fighting
if(!PRCGetHasEffect(EFFECT_TYPE_SLEEP)) {
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL)) {
MyPrintString("DetermineSpecialBehavior");
DetermineSpecialBehavior();
} else {
MyPrintString("DetermineCombatRound");
SetFacingPoint(GetPosition(oPercep));
SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK);
DetermineCombatRound();
}
}
} else {
if (bSeen) {
MyPrintString("GetLastPerceptionSeen: TRUE");
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL)) {
DetermineSpecialBehavior();
} else if (GetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION)
&& GetIsPC(oPercep))
{
// The NPC will speak their one-liner conversation
// This should probably be:
// SpeakOneLinerConversation(oPercep);
// instead, but leaving it as is for now.
ActionStartConversation(OBJECT_SELF);
}
}
// activate ambient animations or walk waypoints if appropriate
if (!IsInConversation(OBJECT_SELF)) {
if (GetIsPostOrWalking()) {
WalkWayPoints();
} else if (GetIsPC(oPercep) &&
(GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS)
|| GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS_AVIAN)
|| GetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS)
|| GetIsEncounterCreature()))
{
SetAnimationCondition(NW_ANIM_FLAG_IS_ACTIVE);
}
}
}
// Send the user-defined event if appropriate
if(GetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT) && GetLastPerceptionSeen())
{
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_PERCEIVE));
}
}

BIN
_removed/nw_c2_default3.ncs Normal file

Binary file not shown.

View File

@@ -0,0 +1,33 @@
//::///////////////////////////////////////////////
//:: Default: End of Combat Round
//:: NW_C2_DEFAULT3
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Calls the end of combat script every round
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 16, 2001
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
void main()
{
ExecuteScript("prc_npc_combat", OBJECT_SELF);
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
{
DetermineSpecialBehavior();
}
else if(!GetSpawnInCondition(NW_FLAG_SET_WARNINGS))
{
DetermineCombatRound();
}
if(GetSpawnInCondition(NW_FLAG_END_COMBAT_ROUND_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1003));
}
}

BIN
_removed/nw_c2_default4.ncs Normal file

Binary file not shown.

View File

@@ -0,0 +1,68 @@
//::///////////////////////////////////////////////
//:: 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"
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")))
{
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.");
}
else if (nMatch == -1 && GetCommandable(OBJECT_SELF) && !GetLocalInt(GetModule(), "dmfi_AllMute") && !GetLocalInt(OBJECT_SELF, "dmfi_Mute"))
{
SetLocalObject(oShouter, "hls_MyNPCSpeaker", OBJECT_SELF);
ClearAllActions();
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);
}
if(GetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1004));
}
}

BIN
_removed/nw_c2_default5.ncs Normal file

Binary file not shown.

View File

@@ -0,0 +1,65 @@
//::///////////////////////////////////////////////
//:: Default On Attacked
//:: NW_C2_DEFAULT5
//:: 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()
{
ExecuteScript("prc_npc_physatt", OBJECT_SELF);
if(!GetFleeToExit())
{
if(!GetSpawnInCondition(NW_FLAG_SET_WARNINGS))
{
if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget()))
{
if(GetIsObjectValid(GetLastAttacker()))
{
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
{
//AdjustReputation(GetLastAttacker(), OBJECT_SELF, -100);
SetSummonHelpIfAttacked();
DetermineSpecialBehavior(GetLastAttacker());
}
else
{
if(GetArea(GetLastAttacker()) == GetArea(OBJECT_SELF))
{
SetSummonHelpIfAttacked();
DetermineCombatRound();
}
}
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
//Shout that I was attacked
SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK);
}
}
}
else
{
//Put a check in to see if this attacker was the last attacker
//Possibly change the GetNPCWarning function to make the check
SetSpawnInCondition(NW_FLAG_SET_WARNINGS, FALSE);
}
}
else
{
ActivateFleeToExit();
}
if(GetSpawnInCondition(NW_FLAG_ATTACK_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1005));
}
}

BIN
_removed/nw_c2_default6.ncs Normal file

Binary file not shown.

View File

@@ -0,0 +1,81 @@
//::///////////////////////////////////////////////
//:: 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()
{
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);
// }
}
}
}
}
if(GetSpawnInCondition(NW_FLAG_DAMAGED_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1006));
}
}

BIN
_removed/nw_c2_default8.ncs Normal file

Binary file not shown.

View File

@@ -0,0 +1,37 @@
//::///////////////////////////////////////////////
//:: Default: On Disturbed
//:: NW_C2_DEFAULT8
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Calls the end of combat script every round
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 16, 2001
//::///////////////////////////////////////////
// * Make me hostile the faction of my last attacker (TEMP)
// AdjustReputation(OBJECT_SELF,GetFaction(GetLastAttacker()),-100);
// * Determined Combat Round
#include "NW_I0_GENERIC"
void main()
{
object oTarget = GetLastDisturbed();
ExecuteScript("prc_npc_disturb", OBJECT_SELF);
if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget()))
{
if(GetIsObjectValid(oTarget))
{
DetermineCombatRound(oTarget);
}
}
if(GetSpawnInCondition(NW_FLAG_DISTURBED_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1008));
}
}

BIN
_removed/nw_c2_defaulta.ncs Normal file

Binary file not shown.

View File

@@ -0,0 +1,20 @@
//::///////////////////////////////////////////////
//:: Default: On Rested
//:: NW_C2_DEFAULTA
//:: Copyright (c) 2002 Bioware Corp.
//:://////////////////////////////////////////////
/*
Determines the course of action to be taken
after having just rested.
*/
//:://////////////////////////////////////////////
//:: Created By: Don Moar
//:: Created On: April 28, 2002
//:://////////////////////////////////////////////
void main()
{
ExecuteScript("prc_npc_rested", OBJECT_SELF);
return;
}

BIN
_removed/nw_c2_defaultb.ncs Normal file

Binary file not shown.

View File

@@ -0,0 +1,50 @@
//::///////////////////////////////////////////////
//:: Default: On Spell Cast At
//:: NW_C2_DEFAULTB
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This determines if the spell just cast at the
target is harmful or not.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Dec 6, 2001
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
void main()
{
object oCaster = GetLastSpellCaster();
ExecuteScript("prc_npc_spellat", OBJECT_SELF);
if(GetLastSpellHarmful())
{
if(
!GetIsObjectValid(GetAttackTarget()) &&
!GetIsObjectValid(GetAttemptedSpellTarget()) &&
!GetIsObjectValid(GetAttemptedAttackTarget()) &&
GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN))
)
{
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
{
DetermineSpecialBehavior(oCaster);
}
else
{
DetermineCombatRound(oCaster);
}
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
//Shout that I was attacked
SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK);
}
}
if(GetSpawnInCondition(NW_FLAG_SPELL_CAST_AT_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1011));
}
}

BIN
_removed/nw_c2_defaulte.ncs Normal file

Binary file not shown.

View File

@@ -0,0 +1,51 @@
//::///////////////////////////////////////////////
//:: Default On Blocked
//:: NW_C2_DEFAULTE
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This will cause blocked creatures to open
or smash down doors depending on int and
str.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Nov 23, 2001
//:://////////////////////////////////////////////
void main()
{
ExecuteScript("prc_npc_blocked", OBJECT_SELF);
object oDoor = GetBlockingDoor();
if (GetObjectType(oDoor) == OBJECT_TYPE_CREATURE)
{
// * Increment number of times blocked
/*SetLocalInt(OBJECT_SELF, "X2_NUMTIMES_BLOCKED", GetLocalInt(OBJECT_SELF, "X2_NUMTIMES_BLOCKED") + 1);
if (GetLocalInt(OBJECT_SELF, "X2_NUMTIMES_BLOCKED") > 3)
{
SpeakString("Blocked by creature");
SetLocalInt(OBJECT_SELF, "X2_NUMTIMES_BLOCKED",0);
ClearAllActions();
object oEnemy = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY);
if (GetIsObjectValid(oEnemy) == TRUE)
{
ActionEquipMostDamagingRanged(oEnemy);
ActionAttack(oEnemy);
}
return;
} */
return;
}
if(GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 5)
{
if(GetIsDoorActionPossible(oDoor, DOOR_ACTION_OPEN) && GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 7 )
{
DoDoorAction(oDoor, DOOR_ACTION_OPEN);
}
else if(GetIsDoorActionPossible(oDoor, DOOR_ACTION_BASH))
{
DoDoorAction(oDoor, DOOR_ACTION_BASH);
}
}
}