Battledale_PRC8/_module/nss/nw_c2_default5.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

75 lines
1.7 KiB
Plaintext

///////:://///////////////////////////////////////////////
//:: 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"
#include "jw_privates_inc"
void main()
{
object oTarget=GetLastAttacker();
ExecuteScript("prc_npc_physatt", OBJECT_SELF);
if (!GetLocalInt(GetModule(),"X3_NO_MOUNTED_COMBAT_FEAT"))
{ // set variables on target for mounted combat
SetLocalInt(OBJECT_SELF,"bX3_LAST_ATTACK_PHYSICAL",TRUE);
SetLocalInt(OBJECT_SELF,"nX3_HP_BEFORE",GetCurrentHitPoints(OBJECT_SELF));
} // set variables on target for mounted combat
if (GetStealthMode(OBJECT_SELF)==STEALTH_MODE_ACTIVATED)
{
ActionUseSkill(SKILL_HIDE,OBJECT_SELF);
}
if (GetDetectMode(OBJECT_SELF)==DETECT_MODE_ACTIVE)
{
ActionUseSkill(SKILL_SPOT,OBJECT_SELF);
}
if(GetFleeToExit())
{
// Run away!
ActivateFleeToExit();
}
SetTarget(oTarget);
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
if (!GetIsFighting(OBJECT_SELF))
{
ClearAllActions();
if (GetObjectSeen(oTarget))
{
DetermineCombatRound();
}
else
{
ActionMoveToObject(oTarget,TRUE,3.0);
}
//Shout that I was attacked
SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK);
}
if(GetSpawnInCondition(NW_FLAG_ATTACK_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_ATTACKED));
}
}