Aschbourne_PRC8/_module/nss/perc_battle.nss
Jaysyn904 5d27edafba Major update
Fixed CCOH, Fixed starting GP, Fixed DMFI languages, Fix cep weapon appearances, Fixed new player start up system.  Added PC deleter.  Added ACP 4.1.  Full compile.  Updated release archive.
2024-09-16 23:40:48 -04:00

67 lines
2.5 KiB
Plaintext

// Modification of NW_C2_DEFAULT2
// NPC Will not get too far from the waypoint named DefensePoint
#include "prc_inc_spells"
#include "NW_I0_GENERIC"
#include "i_battle"
void main()
{
// Ignore everything and return to the waypoint once we get away from it
if (InBattle() &&
TooFarFrom("DefensePoint"))
{
return;
}
// Otherwise do default behavior
//This is the equivalent of a force conversation bubble, should only be used if you want an NPC
//to say something while he is already engaged in combat.
if(GetSpawnInCondition(NW_FLAG_SPECIAL_COMBAT_CONVERSATION) && GetIsPC(GetLastPerceived()) && GetLastPerceptionSeen())
{
SpeakOneLinerConversation();
}
//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))
{
ClearAllActions();
DetermineCombatRound();
}
}
//Do not bother checking the last target seen if already fighting
else if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget()))
{
//Check if the last percieved creature was actually seen
if(GetLastPerceptionSeen())
{
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
{
DetermineSpecialBehavior();
}
else if(GetIsEnemy(GetLastPerceived()))
{
if(!PRCGetHasEffect(EFFECT_TYPE_SLEEP))
{
SetFacingPoint(GetPosition(GetLastPerceived()));
SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK);
DetermineCombatRound();
}
}
//Linked up to the special conversation check to initiate a special one-off conversation
//to get the PCs attention
else if(GetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION) && GetIsPC(GetLastPerceived()))
{
ActionStartConversation(OBJECT_SELF);
}
}
}
if(GetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT) && GetLastPerceptionSeen())
{
SignalEvent(OBJECT_SELF, EventUserDefined(1002));
}
}