Difference between revisions of "Route1traderAI"

From Elite Wiki
m
(script example from Oolite -> scripting page)
 
(4 intermediate revisions by 2 users not shown)
Line 8: Line 8:
   
 
Refered to AI's:
 
Refered to AI's:
[[dockingAI]]
+
[[dockingAI]], [[gotoWaypointAI]]
   
   
Line 33: Line 33:
 
"TARGET_LOST" = ("setStateTo: HEAD_FOR_PLANET");
 
"TARGET_LOST" = ("setStateTo: HEAD_FOR_PLANET");
 
UPDATE = (); };
 
UPDATE = (); };
:
 
"GO_TO_WAYPOINT" = {
 
ENTER = ("setDesiredRangeTo: 50.0", checkCourseToDestination);
 
"COURSE_OK" = ("setSpeedFactorTo: 0.5", performFlyToRangeFromDestination);
 
"WAYPOINT_SET" = ("setDesiredRangeTo: 50.0", checkCourseToDestination);
 
"DESIRED_RANGE_ACHIEVED" = ("setStateTo: GO_TO_STATION");
 
ATTACKED = (fightOrFleeHostiles);
 
"INCOMING_MISSILE" = (setTargetToPrimaryAggressor, broadcastDistressMessage, fightOrFleeMissile, fightOrFleeHostiles, "setStateTo: FLEE");
 
EXIT = ();
 
"TARGET_FOUND" = (fightOrFleeHostiles);
 
FIGHTING = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
 
FLEEING = (setTargetToPrimaryAggressor, "setStateTo: FLEE");
 
UPDATE = (scanForHostiles, "pauseAI: 10.0"); };
 
 
:
 
:
 
"GO_TO_STATION" = {
 
"GO_TO_STATION" = {
Line 59: Line 46:
 
FIGHTING = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
 
FIGHTING = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
 
FLEEING = (setTargetToPrimaryAggressor, "setStateTo: FLEE");
 
FLEEING = (setTargetToPrimaryAggressor, "setStateTo: FLEE");
UPDATE = (scanForHostiles, "pauseAI: 10.0"); };
+
UPDATE = (setTargetToSystemStation, "setDesiredRangeTo: 5000.0", setDestinationToTarget, checkCourseToDestination, scanForHostiles, "pauseAI: 10.0"); };
 
:
 
:
 
"HEAD_FOR_PLANET" = {
 
"HEAD_FOR_PLANET" = {
ENTER = (setCourseToPlanet, "setDesiredRangeTo: 30000.0", "setSpeedFactorTo: 0.5", performFlyToRangeFromDestination);
+
ENTER = (setCourseToPlanet, "setDesiredRangeTo: 30000.0", "setSpeedFactorTo: 0.35", checkCourseToDestination);
  +
"COURSE_OK" = ("setSpeedFactorTo: 0.65", performFlyToRangeFromDestination);
  +
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
 
"AEGIS_CLOSE_TO_PLANET" = ("setStateTo: GO_TO_STATION");
 
"AEGIS_CLOSE_TO_PLANET" = ("setStateTo: GO_TO_STATION");
 
"AEGIS_IN_DOCKING_RANGE" = (dockEscorts, "setStateTo: GO_TO_STATION");
 
"AEGIS_IN_DOCKING_RANGE" = (dockEscorts, "setStateTo: GO_TO_STATION");
 
"DESIRED_RANGE_ACHIEVED" = ("setStateTo: GO_TO_STATION");
 
"DESIRED_RANGE_ACHIEVED" = ("setStateTo: GO_TO_STATION");
  +
"TARGET_FOUND" = (fightOrFleeHostiles);
  +
"INCOMING_MISSILE" = (setTargetToPrimaryAggressor, broadcastDistressMessage, fightOrFleeMissile, fightOrFleeHostiles, "setStateTo: FLEE");
 
ATTACKED = (fightOrFleeHostiles);
 
ATTACKED = (fightOrFleeHostiles);
"INCOMING_MISSILE" = (setTargetToPrimaryAggressor, broadcastDistressMessage, fightOrFleeMissile, fightOrFleeHostiles, "setStateTo: FLEE");
+
FIGHTING = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
EXIT = ();
+
FLEEING = (setTargetToPrimaryAggressor, "setStateTo: FLEE");
"TARGET_FOUND" = (fightOrFleeHostiles);
+
UPDATE = (setCourseToPlanet, "setDesiredRangeTo: 30000.0", checkCourseToDestination, scanForHostiles, "pauseAI: 10.0");
FIGHTING = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
+
EXIT = ();};
FLEEING = (setTargetToPrimaryAggressor, "setStateTo: FLEE");
 
UPDATE = (scanForHostiles, "pauseAI: 10.0"); };
 
 
:
 
:
 
GLOBAL = {
 
GLOBAL = {
Line 79: Line 68:
   
 
[[AI|BACK]]
 
[[AI|BACK]]
  +
  +
  +
[[Category:Oolite scripting]]

Latest revision as of 13:17, 2 January 2011

Defined states:

  • GLOBAL: →HEAD_FOR_PLANET
  • HEAD_FOR_PLANET: →GO_TO_STATION, →FLEE, →ATTACK_SHIP
  • GO_TO_WAYPOINT: →GO_TO_STATION, →FLEE, →ATTACK_SHIP
  • GO_TO_STATION: →GO_TO_WAYPOINT, →FLEE, →ATTACK_SHIP
  • FLEE: →FLEE, →ATTACK_SHIP, →GLOBAL
  • ATTACK_SHIP": →FLEE, →HEAD_FOR_PLANET

Refered to AI's: dockingAI, gotoWaypointAI


{
   FLEE = {
       ATTACKED = (fightOrFleeHostiles); 
       FIGHTING = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
       FLEEING = (setTargetToPrimaryAggressor, "setStateTo: FLEE");
       "TARGET_LOST" = (performIdle, "setStateTo: GLOBAL"); 
       "TARGET_DESTROYED" = (performIdle, "setStateTo: GLOBAL"); 
       ENTER = ("setDesiredRangeTo: 25600", performFlee); 
       EXIT = (); 
       "INCOMING_MISSILE" = (setTargetToPrimaryAggressor, broadcastDistressMessage, fightOrFleeMissile, fightOrFleeHostiles); 
       "REACHED_SAFETY" = (performIdle, "setStateTo: GLOBAL"); 
       UPDATE = ();     }; 
   "ATTACK_SHIP" = {
       "ENERGY_LOW" = (setTargetToPrimaryAggressor, broadcastDistressMessage, "setStateTo: FLEE"); 
       ENTER = (broadcastDistressMessage, performAttack); 
       EXIT = (); 
       "INCOMING_MISSILE" = (setTargetToPrimaryAggressor, broadcastDistressMessage, fightOrFleeMissile, "setStateTo: FLEE"); 
       "TARGET_DESTROYED" = ("setStateTo: HEAD_FOR_PLANET"); 
       "TARGET_LOST" = ("setStateTo: HEAD_FOR_PLANET"); 
       UPDATE = ();     }; 
   "GO_TO_STATION" = {
       ENTER = (setTargetToStation, "setDesiredRangeTo: 5000.0", setDestinationToTarget, checkCourseToDestination);
       "COURSE_OK" = ("setSpeedFactorTo: 0.5", performFlyToRangeFromDestination);
       "WAYPOINT_SET" = ("setStateTo: GO_TO_WAYPOINT");
       "DESIRED_RANGE_ACHIEVED" = (dockEscorts, "setAITo: dockingAI.plist");
       "AEGIS_IN_DOCKING_RANGE" = (dockEscorts, "setAITo: dockingAI.plist");
       EXIT = ();
       ATTACKED = (fightOrFleeHostiles); 
       "INCOMING_MISSILE" = (setTargetToPrimaryAggressor, broadcastDistressMessage, fightOrFleeMissile, fightOrFleeHostiles, "setStateTo: FLEE"); 
       "TARGET_FOUND" = (fightOrFleeHostiles); 
       FIGHTING = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
       FLEEING = (setTargetToPrimaryAggressor, "setStateTo: FLEE");
       UPDATE = (setTargetToSystemStation, "setDesiredRangeTo: 5000.0", setDestinationToTarget, checkCourseToDestination, scanForHostiles, "pauseAI: 10.0");	}; 
   "HEAD_FOR_PLANET" = {
       ENTER = (setCourseToPlanet, "setDesiredRangeTo: 30000.0", "setSpeedFactorTo: 0.35", checkCourseToDestination);
       "COURSE_OK" = ("setSpeedFactorTo: 0.65", performFlyToRangeFromDestination);
       "WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
       "AEGIS_CLOSE_TO_PLANET" = ("setStateTo: GO_TO_STATION");
       "AEGIS_IN_DOCKING_RANGE" = (dockEscorts, "setStateTo: GO_TO_STATION");
       "DESIRED_RANGE_ACHIEVED" = ("setStateTo: GO_TO_STATION");
       "TARGET_FOUND" = (fightOrFleeHostiles);
       "INCOMING_MISSILE" = (setTargetToPrimaryAggressor, broadcastDistressMessage, fightOrFleeMissile, fightOrFleeHostiles, "setStateTo: FLEE"); 
       ATTACKED = (fightOrFleeHostiles); 
               FIGHTING = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
               FLEEING = (setTargetToPrimaryAggressor, "setStateTo: FLEE");
       UPDATE = (setCourseToPlanet, "setDesiredRangeTo: 30000.0", checkCourseToDestination, scanForHostiles, "pauseAI: 10.0");
       EXIT = ();}; 
   GLOBAL = {
       ENTER = ("setStateTo: HEAD_FOR_PLANET"); 
       EXIT = (); 
       UPDATE = (); }; 
}

BACK