Difference between revisions of "InterceptAI"

From Elite Wiki
m
(script example from Oolite -> scripting page)
 
Line 37: Line 37:
   
   
[[Category:Oolite]]
+
[[Category:Oolite scripting]]

Latest revision as of 13:23, 2 January 2011

A three-state machine, designed for interception and combat, will exit afterwards. Used mainly by policevipers (hence the reference to lights), but also by other attacking AI-scripts, such as the escortAI.

Used states:

  • ATTACK_SHIP: ->FLEE
  • FLEE: ->ATTACK_SHIP
  • GLOBAL: ->ATTACK_SHIP

No references to other AI's, will exit after completion.

{
   "ATTACK_SHIP" = {
       "ENERGY_LOW" = ("setStateTo: FLEE"); 
       ENTER = (performAttack); 
       EXIT = (); 
       "INCOMING_MISSILE" = (fightOrFleeMissile, "setStateTo: FLEE"); 
       "TARGET_DESTROYED" = (switchLightsOff, exitAI); 
       "TARGET_LOST" = (switchLightsOff, exitAI); 
       UPDATE = ();     };
   FLEE = {
       "ENERGY_FULL" = ("setStateTo: ATTACK_SHIP"); 
       "TARGET_LOST" = (switchLightsOff, exitAI); 
       "TARGET_DESTROYED" = (switchLightsOff, exitAI); 
       ENTER = ("setDesiredRangeTo: 25600", performFlee); 
       EXIT = (); 
       "INCOMING_MISSILE" = (fightOrFleeMissile, "setStateTo: FLEE"); 
       UPDATE = ();     }; 
   GLOBAL = {
       ENTER = (switchLightsOn, "setStateTo: ATTACK_SHIP"); 
       EXIT = (); 
       UPDATE = (); }; 
}

BACK