Difference between revisions of "EscortAI"

From Elite Wiki
m
(script example from Oolite -> scripting page)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This is a five-[[State engine|state engine]].
+
This is a five-[[State machine|state machine]].
  
 
Used states:  
 
Used states:  
Line 49: Line 49:
 
         ESCORTING = ("setDesiredRangeTo: 0.0", "setStateTo: FLYING_ESCORT");
 
         ESCORTING = ("setDesiredRangeTo: 0.0", "setStateTo: FLYING_ESCORT");
 
         "TARGET_FOUND" = (setTargetToFoundTarget, suggestEscort);  
 
         "TARGET_FOUND" = (setTargetToFoundTarget, suggestEscort);  
         "NOTHING_FOUND" = ("setStateMachine: route1patrolAI.plist");  
+
         "NOTHING_FOUND" = ("setAITo: route1patrolAI.plist");  
 
         UPDATE = (scanForFormationLeader, "pauseAI: 15.0");    };  
 
         UPDATE = (scanForFormationLeader, "pauseAI: 15.0");    };  
 
:
 
:
Line 59: Line 59:
  
 
'''[[AI|BACK]]'''
 
'''[[AI|BACK]]'''
 +
 +
 +
[[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