2021-08-30 17:31:44 -04:00
|
|
|
/*/////////////////////// [On Disturbed] ///////////////////////////////////////
|
|
|
|
Filename: J_AI_OnDisturbed or nw_c2_default8
|
|
|
|
///////////////////////// [On Disturbed] ///////////////////////////////////////
|
2021-08-29 23:34:48 -04:00
|
|
|
This will attack pickpockets, and inventory disturbers. Note: Stupidly, Bioware
|
|
|
|
made this only affect the creature by stealing. Still, oh well :-(
|
|
|
|
|
|
|
|
This means that the only event which fires it is pickpocketing.
|
2021-08-30 17:31:44 -04:00
|
|
|
///////////////////////// [History] ////////////////////////////////////////////
|
2021-08-29 23:34:48 -04:00
|
|
|
1.3 - Changed why we determine combat round
|
|
|
|
- Any change in inventory will trigger appropriate SetWeapons again.
|
|
|
|
- Added turn of hide things.
|
2021-08-30 17:31:44 -04:00
|
|
|
1.4 - Cleaned up a bit. Removed unused declared variable.
|
|
|
|
///////////////////////// [Workings] ///////////////////////////////////////////
|
2021-08-29 23:34:48 -04:00
|
|
|
Only fired by stealing, great. Oh well, it will attack any disturber anyway.
|
|
|
|
|
|
|
|
It *might* not be fired if the natural spot check to notice a theft doesn't
|
|
|
|
work. No idea personally.
|
2021-08-30 17:31:44 -04:00
|
|
|
///////////////////////// [Arguments] //////////////////////////////////////////
|
2021-08-29 23:34:48 -04:00
|
|
|
Arguments: GetInventoryDisturbItem, GetLastDisturbed,
|
|
|
|
GetInventoryDisturbType (I think it is always be stolen :-( ).
|
2021-08-30 17:31:44 -04:00
|
|
|
///////////////////////// [On Disturbed] /////////////////////////////////////*/
|
2021-08-29 23:34:48 -04:00
|
|
|
|
2021-08-30 17:31:44 -04:00
|
|
|
#include "J_INC_OTHER_AI"
|
2021-08-29 23:34:48 -04:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2021-08-30 17:31:44 -04:00
|
|
|
// Pre-disturbed-event. Returns TRUE if we interrupt this script call.
|
|
|
|
if(FirePreUserEvent(AI_FLAG_UDE_DISTURBED_PRE_EVENT, EVENT_DISTURBED_PRE_EVENT)) return;
|
2021-08-29 23:34:48 -04:00
|
|
|
|
|
|
|
// AI status check. Is the AI on?
|
|
|
|
if(GetAIOff()) return;
|
|
|
|
|
2021-08-30 17:31:44 -04:00
|
|
|
// Declare major variables
|
|
|
|
object oDisturber = GetLastDisturbed();
|
2021-08-29 23:34:48 -04:00
|
|
|
object oItem = GetInventoryDisturbItem();
|
2021-08-30 17:31:44 -04:00
|
|
|
int nType = GetInventoryDisturbType();
|
2021-08-29 23:34:48 -04:00
|
|
|
int nBase = GetBaseItemType(oItem);
|
2021-08-30 17:31:44 -04:00
|
|
|
|
|
|
|
// We will reset weapons if it is a weapon.
|
2021-08-29 23:34:48 -04:00
|
|
|
// Reset weapons, or specifically healers kits.
|
|
|
|
if(GetIsObjectValid(oItem))
|
|
|
|
{
|
|
|
|
// Kits
|
|
|
|
if(nBase == BASE_ITEM_HEALERSKIT)
|
|
|
|
{
|
2021-08-30 17:31:44 -04:00
|
|
|
SetLocalInt(OBJECT_SELF, AI_WEAPONSETTING_SETWEAPONS, 2);
|
2021-08-29 23:34:48 -04:00
|
|
|
ExecuteScript(FILE_RE_SET_WEAPONS, OBJECT_SELF);
|
|
|
|
}
|
|
|
|
else // Think it is a weapon. Saves time :-)
|
|
|
|
{
|
2021-08-30 17:31:44 -04:00
|
|
|
SetLocalInt(OBJECT_SELF, AI_WEAPONSETTING_SETWEAPONS, 1);
|
2021-08-29 23:34:48 -04:00
|
|
|
ExecuteScript(FILE_RE_SET_WEAPONS, OBJECT_SELF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Fight! Or search!
|
2021-08-30 17:31:44 -04:00
|
|
|
if(!GetIgnoreNoFriend(oDisturber) &&
|
|
|
|
(nType == INVENTORY_DISTURB_TYPE_STOLEN || GetIsEnemy(oDisturber)))
|
2021-08-29 23:34:48 -04:00
|
|
|
{
|
|
|
|
// Turn of hiding, a timer to activate Hiding in the main file. This is
|
|
|
|
// done in each of the events, with the opposition checking seen/heard.
|
|
|
|
TurnOffHiding(oDisturber);
|
2021-08-30 17:31:44 -04:00
|
|
|
|
|
|
|
// Can we attack?
|
2021-08-29 23:34:48 -04:00
|
|
|
if(!CannotPerformCombatRound())
|
|
|
|
{
|
2021-08-30 17:31:44 -04:00
|
|
|
// Someone specific to attack
|
|
|
|
AISpeakString(AI_SHOUT_I_WAS_ATTACKED);
|
|
|
|
|
2021-08-29 23:34:48 -04:00
|
|
|
// One debug speak. We always do one.
|
|
|
|
// 65: "[Disturbed] (pickpocket) Attacking Enemy Distrube [Disturber] " + GetName(oTarget) + " [Type] " + IntToString(iType)
|
2021-08-30 17:31:44 -04:00
|
|
|
DebugActionSpeakByInt(65, oDisturber, nType);
|
|
|
|
|
|
|
|
// Attack the disturber
|
2021-08-29 23:34:48 -04:00
|
|
|
DetermineCombatRound(oDisturber);
|
|
|
|
}
|
2021-08-30 17:31:44 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Get allies interested.
|
|
|
|
AISpeakString(AI_SHOUT_CALL_TO_ARMS);
|
|
|
|
}
|
2021-08-29 23:34:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Fire End-heartbeat-UDE
|
|
|
|
FireUserEvent(AI_FLAG_UDE_DISTURBED_EVENT, EVENT_DISTURBED_EVENT);
|
|
|
|
}
|