mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
124 lines
2.8 KiB
Plaintext
124 lines
2.8 KiB
Plaintext
include library.ai_lib;
|
|
include ai.ai_combat;
|
|
include library.factions;
|
|
include library.utils;
|
|
include library.attrib;
|
|
include library.chat;
|
|
|
|
const string CONVO_FILE = "theme_park/warren/warren";
|
|
|
|
const string ALERT_VOLUME_NAME = "alertVolume";
|
|
|
|
const string ACTION_ALERT = "alert";
|
|
const string ACTION_THREATEN = "threaten";
|
|
|
|
trigger OnAttach()
|
|
{
|
|
if ( !hasObjVar( self, "ai.diction") )
|
|
setObjVar( self, "ai.diction", "military" );
|
|
|
|
if ( getConfigSetting("GameServer", "disableAITriggerVolumes") == null )
|
|
createTriggerVolume( ALERT_VOLUME_NAME, 15.0f, true );
|
|
|
|
setObjVar( self, "ai.rangedOnly", true );
|
|
|
|
if ( !hasObjVar( self, "ai.grenadeType" ))
|
|
{
|
|
setObjVar( self, "ai.grenadeType", "object/weapon/ranged/grenade/grenade_fragmentation" );
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnTriggerVolumeEntered( string volumeName, obj_id breacher )
|
|
{
|
|
if ( hasObjVar( breacher, "gm") )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( ai_lib.isInCombat( self ) || ai_lib.isInCombat( breacher))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( breacher == self )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( isIncapacitated(self) || ai_lib.isAiDead( breacher ))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( !isPlayer( breacher) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( utils.hasScriptVar( breacher, "warren.flaggedImperial" ) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( volumeName == ALERT_VOLUME_NAME && !ai_lib.isInCombat( self ))
|
|
{
|
|
if ( rand(1,10)==1 )
|
|
{
|
|
int yourGender = getGender( breacher );
|
|
if ( yourGender == GENDER_MALE )
|
|
chat.chat( self, new string_id( CONVO_FILE, "trooper_greeting_m" ));//Get Him!
|
|
else
|
|
chat.chat( self, new string_id( CONVO_FILE, "trooper_greeting_f" ));//Get Her!
|
|
}
|
|
startCombat( self, breacher );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnSawAttack(obj_id defender, obj_id[] attackers)
|
|
{
|
|
if ( getConfigSetting("GameServer", "disableAICombat")!=null )
|
|
{
|
|
setWantSawAttackTriggers(self, false);
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
|
|
if ( ai_lib.isAiDead( self ) || isInvulnerable( self ) )
|
|
{
|
|
setWantSawAttackTriggers(self, false);
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
|
|
|
|
if ( ai_lib.isInCombat( self ) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
//if the defender is a me, then attack one of the attacker:
|
|
if ( hasScript( defender, "theme_park.warren.trooper" ) )
|
|
{
|
|
startCombat( self, attackers[rand(0,attackers.length-1)] );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//if one of the attackers is my bud, then attack the defender:
|
|
for ( int i = 0; i < attackers.length; i++ )
|
|
{
|
|
if ( hasScript( attackers[i], "theme_park.warren.trooper" ) )
|
|
{
|
|
startCombat( self, defender );
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnMoveMoving()
|
|
{
|
|
aiEquipPrimaryWeapon( self );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnMovePathComplete()
|
|
{
|
|
aiEquipPrimaryWeapon( self );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnLoiterWaiting(modifiable_float time)
|
|
{
|
|
aiEquipPrimaryWeapon( self );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|