Difference between revisions of "EscortAI"

From Elite Wiki
(Changed setStateMachine: into setAITo:)
(script example from Oolite -> scripting page)
 
Line 61: Line 61:
  
  
[[Category:Oolite]]
+
[[Category:Oolite scripting]]

Latest revision as of 12:10, 2 January 2011

This is a five-state machine.

Used states:

  • FLYING_ESCORT: ->BEGIN_BUSINESS, ->LOOK_FOR_BUSINESS
  • BEGIN_BUSINESS: ->CLEAR_STATION, ->LOOK_FOR_BUSINESS
  • CLEAR_STATION: -> LOOK_FOR_BUSINESS, ->FLYING_ESCORT
  • LOOK_FOR_BUSINESS: ->BEGIN_BUSINESS, ->FLYING_ESCORT
  • GLOBAL: -> BEGIN_BUSINESS

Refered to AI's: interceptAI.plist, route1patrolAI.plist


{
   "FLYING_ESCORT" = {
       ENTER = (performEscort); 
       "GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist"); 
       RESTARTED = ("setStateTo: BEGIN_BUSINESS");
       ESCORTING = ("setDesiredRangeTo: 0.0", performEscort);
       "INCOMING_MISSILE" = ("messageMother: INCOMING_MISSILE"); 
       "ATTACKED" = ("messageMother: ATTACKED"); 
       "NOT_ESCORTING" = ("setStateTo: LOOK_FOR_BUSINESS"); 
       "TARGET_LOST" = ("setStateTo: LOOK_FOR_BUSINESS"); 
       "TARGET_DESTROYED" = ("setStateTo: LOOK_FOR_BUSINESS"); 
       EXIT = ();
       UPDATE = (escortCheckMother, "pauseAI: 15");     }; 
   "BEGIN_BUSINESS" = {
       ATTACKED = (setTargetToPrimaryAggressor, "setAITo: interceptAI.plist");
       ENTER = (escortCheckMother); 
       EXIT = ();
       ESCORTING = ("setDesiredRangeTo: 0.0", performEscort);
       "NOT_ESCORTING" = ("setStateTo: LOOK_FOR_BUSINESS");
       "LAUNCHED_OKAY" = ("setStateTo: CLEAR_STATION");
       UPDATE = ();     }; 
   "CLEAR_STATION" = {
       ENTER = (setTargetToStation, "setDesiredRangeTo: 5000.0", "setSpeedFactorTo: 0.5", performFlyToRangeFromDestination);
       "DESIRED_RANGE_ACHIEVED" = ("setStateTo: LOOK_FOR_BUSINESS");
       UPDATE = (scanForFormationLeader, "pauseAI: 15.0"); 
       "TARGET_FOUND" = (setTargetToFoundTarget, suggestEscort); 
       ESCORTING = ("setDesiredRangeTo: 0.0", "setStateTo: FLYING_ESCORT");
       EXIT = ();    }; 
   "LOOK_FOR_BUSINESS" = {
       ATTACKED = (setTargetToPrimaryAggressor, "setAITo: interceptAI.plist");
       RESTARTED = ("setStateTo: BEGIN_BUSINESS");
       ENTER = ("setSpeedTo: 0.0", performIdle); 
       EXIT = ();
       ESCORTING = ("setDesiredRangeTo: 0.0", "setStateTo: FLYING_ESCORT");
       "TARGET_FOUND" = (setTargetToFoundTarget, suggestEscort); 
       "NOTHING_FOUND" = ("setAITo: route1patrolAI.plist"); 
       UPDATE = (scanForFormationLeader, "pauseAI: 15.0");     }; 
   GLOBAL = {
       ENTER = ("setStateTo: BEGIN_BUSINESS"); 
       EXIT = (); 
       UPDATE = (); }; 
}

BACK