Battledale_PRC8/_removed/nw_c2_default2.nss
Jaysyn904 7b9e44ebbb Initial upload
Initial upload.  PRC8 has been added.  Module compiles, PRC's default AI & treasure scripts have been integrated.  Started work on top hak for SLA / Ability / Scripting modifications.
2024-03-11 23:44:08 -04:00

64 lines
2.2 KiB
Plaintext

/////////:://///////////////////////////////////////////////
//:: Default On Percieve
//:: NW_C2_DEFAULT2
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Checks to see if the perceived target is an
enemy and if so fires the Determine Combat
Round function
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 16, 2001
//:://///////////////////////////////////////////////////////////////
#include "NW_I0_GENERIC"
void main()
{
//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(GetLastPerceptionSeen()&&GetIsEnemy(GetLastPerceived()))
{
if(!GetHasEffect(EFFECT_TYPE_SLEEP))
{
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
if(!GetIsFighting(OBJECT_SELF))
{
if ((GetStealthMode(OBJECT_SELF)!=TRUE)&&(!GetIsInCombat())&&(d3()==1)&&(GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_FRIEND,OBJECT_SELF,1,CREATURE_TYPE_PERCEPTION,PERCEPTION_SEEN))))
{
PlayVoiceChat(VOICE_CHAT_ENEMIES);
}
SetTarget(GetLastPerceived());
SetFacingPoint(GetPosition(GetLastPerceived()));
DetermineCombatRound();
}
}
}
if(GetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT) && GetLastPerceptionSeen())
{
SignalEvent(OBJECT_SELF, EventUserDefined(1002));
}
}