Route1patrolAI

From Elite Wiki

This is another good example how plotting waypoints leads to hellishly complex scripts.

States defined:

  • GLOBAL: →HEAD_FOR_WITCHPOINT
  • DOCKING_PLANET: →HEAD_FOR_PLANET
  • DOCKING_WITCHPOINT: →HEAD_FOR_WITCHPOINT, →ATTACK_TARGET
  • HEAD_FOR_PLANET: →DOCKING_PLANET, →GO_TO_WAYPOINT1, →HEAD_FOR_WITCHPOINT, →INBOUND_LOOT
  • GO_TO_WAYPOINT1: →DOCKING_PLANET, →HEAD_FOR_PLANET, →INBOUND_LOOT
  • HEAD_FOR_WITCHPOINT: →DOCKING_WITCHPOINT, →GO_TO_WAYPOINT2, →HEAD_FOR_PLANET, →OUTBOUND_LOOT
  • GO_TO_WAYPOINT2: →DOCKING_WITCHPOINT, →HEAD_FOR_WITCHPOINT, →OUTBOUND_LOOT
  • OUTBOUND_LOOT: →DOCKING_WITCHPOINT, →OUTBOUND_LOOT
  • INBOUND_LOOT: →DOCKING_PLANET, →INBOUND_LOOT
  • OUTBOUND_CHECK: →HEAD_FOR_WITCHPOINT, →HYPER_OUT, →OUTBOUND_LOOT
  • INBOUND_CHECK: →HEAD_FOR_PLANET, →HYPER_OUT, →INBOUND_LOOT
  • HYPER_OUT: →

Refers to AI's: interceptAI.plist, collectLootAI.plist

The following ships use this AI: Viper, viper-interceptor, viper-pursuit.

{
   "DOCKING_PLANET" = {
       ENTER = ("setSpeedFactorTo: 0.0", performIdle);
       "DOCKING_COMPLETE" = ("setStateTo: HEAD_FOR_PLANET");
       "GROUP_ATTACK_TARGET" = (setTargetToFoundTarget); 
       ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget); 
       "INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, groupAttackTarget); 
       "TARGET_FOUND" = (setTargetToFoundTarget, groupAttackTarget); 
       EXIT = ();
       UPDATE = (scanForHostiles, "pauseAI: 10.0");	}; 
   "DOCKING_WITCHPOINT" = {
       ENTER = ("setSpeedFactorTo: 0.0", performIdle);
       "DOCKING_COMPLETE" = ("setStateTo: HEAD_FOR_WITCHPOINT");
       "GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setStateTo: ATTACK_TARGET"); 
       ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget); 
       "INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, launchDefenseShip, groupAttackTarget, "setStateTo: ATTACK_TARGET"); 
       "TARGET_FOUND" = (setTargetToFoundTarget, launchDefenseShip, groupAttackTarget); 
       EXIT = ();
       UPDATE = (scanForHostiles, "pauseAI: 10.0");	}; 
   "HEAD_FOR_PLANET" = {
       ENTER = (setCourseToPlanet, "setDesiredRangeTo: 50000.0", checkCourseToDestination);
       "DOCKING_REQUESTED" = ("setSpeedFactorTo: 0.0", "setStateTo: DOCKING_PLANET"); 
       "COURSE_OK" = ("setSpeedFactorTo: 0.8", performFlyToRangeFromDestination);
       "WAYPOINT_SET" = ("setStateTo: GO_TO_WAYPOINT1");
       "DESIRED_RANGE_ACHIEVED" = ("setStateTo: HEAD_FOR_WITCHPOINT");
       "GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist"); 
       ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget); 
       "INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, deployEscorts, groupAttackTarget, "setAITo: interceptAI.plist"); 
       "TARGET_FOUND" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget); 
       "ACCEPT_DISTRESS_CALL" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget); 
       EXIT = ();
       UPDATE = (scanForOffenders, "pauseAI: 10.0");
       RESTARTED = ("setStateTo: INBOUND_LOOT");	}; 
   "GO_TO_WAYPOINT1" = {
       ENTER = ("setDesiredRangeTo: 50.0", checkCourseToDestination);
       "DOCKING_REQUESTED" = ("setSpeedFactorTo: 0.0", "setStateTo: DOCKING_PLANET"); 
       "COURSE_OK" = ("setSpeedFactorTo: 0.8", performFlyToRangeFromDestination);
       "WAYPOINT_SET" = ("setDesiredRangeTo: 50.0", checkCourseToDestination);
       "DESIRED_RANGE_ACHIEVED" = ("setStateTo: HEAD_FOR_PLANET");
       "ACCEPT_DISTRESS_CALL" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget); 
       "GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist"); 
       ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget); 
       "INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, deployEscorts, groupAttackTarget, "setAITo: interceptAI.plist", "setStateTo: INBOUND_LOOT"); 
       EXIT = ();
       UPDATE = ();
       RESTARTED = ("setStateTo: INBOUND_LOOT");	}; 
   "HEAD_FOR_WITCHPOINT" = {
       ENTER = (setCourseToWitchpoint, checkCourseToDestination);
       "DOCKING_REQUESTED" = ("setSpeedFactorTo: 0.0", "setStateTo: DOCKING_WITCHPOINT"); 
       "COURSE_OK" = ("setSpeedFactorTo: 0.8", performFlyToRangeFromDestination);
       "WAYPOINT_SET" = ("setStateTo: GO_TO_WAYPOINT2");
       "DESIRED_RANGE_ACHIEVED" = ("setStateTo: HEAD_FOR_PLANET");
       "GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist"); 
       ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget); 
       "INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, deployEscorts, groupAttackTarget, "setAITo: interceptAI.plist", "setStateTo: OUTBOUND_LOOT"); 
       "TARGET_FOUND" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget); 
       "ACCEPT_DISTRESS_CALL" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
       FRUSTRATED = ("setStateTo: HEAD_FOR_WITCHPOINT");
       EXIT = ();
       UPDATE = (scanForOffenders, "pauseAI: 10.0");
       RESTARTED = ("setStateTo: OUTBOUND_LOOT");	}; 
   "GO_TO_WAYPOINT2" = {
       ENTER = ("setDesiredRangeTo: 50.0", checkCourseToDestination);
       "DOCKING_REQUESTED" = ("setSpeedFactorTo: 0.0", "setStateTo: DOCKING_WITCHPOINT"); 
       "COURSE_OK" = ("setSpeedFactorTo: 0.8", performFlyToRangeFromDestination);
       "WAYPOINT_SET" = ("setDesiredRangeTo: 50.0", checkCourseToDestination);
       "DESIRED_RANGE_ACHIEVED" = ("setStateTo: HEAD_FOR_WITCHPOINT");
       "ACCEPT_DISTRESS_CALL" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget); 
       "GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist"); 
       ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget); 
       "INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, deployEscorts, groupAttackTarget, "setAITo: interceptAI.plist", "setStateTo: OUTBOUND_LOOT"); 
       EXIT = ();
       UPDATE = ();
       RESTARTED = ("setStateTo: OUTBOUND_LOOT");	}; 
   "OUTBOUND_LOOT" = {
       "GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist"); 
       "DOCKING_REQUESTED" = ("setSpeedFactorTo: 0.0", "setStateTo: DOCKING_WITCHPOINT"); 
       ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget); 
       ENTER = ("setSpeedTo: 0.0", performIdle); 
       EXIT = (); 
       "INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, deployEscorts, groupAttackTarget, "setAITo: interceptAI.plist", "setStateTo: OUTBOUND_LOOT"); 
       "TARGET_FOUND" = (setTargetToFoundTarget, "setAITo: collectLootAI.plist"); 
       "NOTHING_FOUND" = ("setStateTo: OUTBOUND_CHECK"); 
       UPDATE = (scanForLoot, "pauseAI: 10.0");     }; 
   "INBOUND_LOOT" = {
       "GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist"); 
       "DOCKING_REQUESTED" = ("setSpeedFactorTo: 0.0", "setStateTo: DOCKING_PLANET"); 
       ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget); 
       ENTER = ("setSpeedTo: 0.0", performIdle); 
       EXIT = (); 
       "INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, deployEscorts, groupAttackTarget, "setAITo: interceptAI.plist", "setStateTo: INBOUND_LOOT"); 
       "TARGET_FOUND" = (setTargetToFoundTarget, "setAITo: collectLootAI.plist"); 
       "NOTHING_FOUND" = ("setStateTo: INBOUND_CHECK"); 
       UPDATE = (scanForLoot, "pauseAI: 10.0");     }; 
   "INBOUND_CHECK" = {
       ENTER = (scanForOffenders, checkForNormalSpace); 
       EXIT = (); 
       "TARGET_FOUND" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget); 
       "GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist"); 
       RESTARTED = ("setStateTo: INBOUND_LOOT");
       "NORMAL_SPACE" = ("setStateTo: HEAD_FOR_PLANET"); 
       "INTERSTELLAR_SPACE" = ("setSpeedFactorTo: 1.0", "pauseAI: 15.0", "setStateTo: HYPER_OUT"); 
       UPDATE = ();     }; 
   "OUTBOUND_CHECK" = {
       ENTER = (scanForOffenders, checkForNormalSpace); 
       EXIT = (); 
       "TARGET_FOUND" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget); 
       "GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist"); 
       RESTARTED = ("setStateTo: OUTBOUND_LOOT");
       "NORMAL_SPACE" = ("setStateTo: HEAD_FOR_WITCHPOINT"); 
       "INTERSTELLAR_SPACE" = ("setSpeedFactorTo: 1.0", "pauseAI: 15.0", "setStateTo: HYPER_OUT"); 
       UPDATE = ();     }; 
   "HYPER_OUT" = {
       ENTER = (); 
       EXIT = (); 
       UPDATE = (performHyperSpaceExit); }; 
   GLOBAL = {
       ENTER = ("setStateTo: HEAD_FOR_WITCHPOINT"); 
       EXIT = (); 
       UPDATE = (); }; 
}

BACK