So the idea is to use the AEGIS_CLOSE_TO_PLANET as turning point, instead of waiting for DESIRED_RANGE_ACHIEVED?
That's nice. Will try it out. Also saves me from the trouble that, when there was an obstacle and the AI comes back from goToWaypointAI, it gets a DESIRED_RANGE_ACHIEVED too early. (Edit: Could get rid of that by inserting a RESTARTED into HEAD_FOR_SUN in route2patrolAI, which sets the sunSkimCoordinates like in the ENTER-state.)
Just for your interest: Currently my AIs look like this: route1patrolAI isn't changed except for the small bugfix with OUTBOUND_LOOT, and adding two additional _DECISION-stated at the endpoints:
Code: Select all
{
GLOBAL = {ENTER = ("setStateTo: HEAD_FOR_WITCHPOINT"); };
"HEAD_FOR_PLANET" = {
"ACCEPT_DISTRESS_CALL" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget);
"COURSE_OK" = ("setSpeedFactorTo: 0.8", performFlyToRangeFromDestination);
"DESIRED_RANGE_ACHIEVED" = ("setStateTo: PLANET_DECISION");
"DOCKING_REQUESTED" = ("setAITo: receiveDockingAI.plist");
ENTER = (setCourseToPlanet, "setDesiredRangeTo: 50000.0", checkCourseToDestination);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist");
"INCOMING_MISSILE" = (
fightOrFleeMissile,
setTargetToPrimaryAggressor,
deployEscorts,
"setStateTo: INBOUND_LOOT",
groupAttackTarget
);
"OFFENCE_COMMITTED" = (
setTargetToFoundTarget,
"markTargetForOffence: 7",
deployEscorts,
groupAttackTarget
);
"TARGET_FOUND" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
UPDATE = (
setCourseToPlanet,
"setDesiredRangeTo: 50000.0",
checkCourseToDestination,
scanForOffenders,
"pauseAI: 10.0"
);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
};
"HEAD_FOR_WITCHPOINT" = {
"ACCEPT_DISTRESS_CALL" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget);
"COURSE_OK" = ("setSpeedFactorTo: 0.8", performFlyToRangeFromDestination);
"DESIRED_RANGE_ACHIEVED" = ("setStateTo: WITCHPOINT_DECISION");
"DOCKING_REQUESTED" = ("setAITo: receiveDockingAI.plist");
ENTER = (setCourseToWitchpoint, checkCourseToDestination);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist");
"INCOMING_MISSILE" = (
fightOrFleeMissile,
setTargetToPrimaryAggressor,
deployEscorts,
"setStateTo: OUTBOUND_LOOT",
groupAttackTarget
);
"OFFENCE_COMMITTED" = (
setTargetToFoundTarget,
"markTargetForOffence: 7",
deployEscorts,
groupAttackTarget
);
"TARGET_FOUND" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
UPDATE = (
setCourseToWitchpoint,
checkCourseToDestination,
scanForOffenders,
"pauseAI: 10.0"
);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
};
"HYPER_OUT" = {UPDATE = (performHyperSpaceExit); };
"INBOUND_CHECK" = {
ENTER = (scanForOffenders, checkForNormalSpace);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist");
"INTERSTELLAR_SPACE" = ("setSpeedFactorTo: 1.0", "pauseAI: 15.0", "setStateTo: HYPER_OUT");
"NORMAL_SPACE" = ("setStateTo: HEAD_FOR_PLANET");
"OFFENCE_COMMITTED" = (
setTargetToFoundTarget,
"markTargetForOffence: 7",
deployEscorts,
groupAttackTarget
);
RESTARTED = ("setStateTo: INBOUND_LOOT");
"TARGET_FOUND" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
};
"INBOUND_LOOT" = {
ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget);
"DOCKING_REQUESTED" = ("setSpeedFactorTo: 0.0", "setAITo: receivingDockingAI.plist");
ENTER = ("setSpeedTo: 0.0", performIdle);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist");
"INCOMING_MISSILE" = (
fightOrFleeMissile,
setTargetToPrimaryAggressor,
deployEscorts,
groupAttackTarget
);
"NOTHING_FOUND" = ("setStateTo: INBOUND_CHECK");
"TARGET_FOUND" = (setTargetToFoundTarget, "setAITo: collectLootAI.plist");
UPDATE = (scanForLoot, "pauseAI: 10.0");
};
"OUTBOUND_CHECK" = {
ENTER = (scanForOffenders, checkForNormalSpace);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist");
"INTERSTELLAR_SPACE" = ("setSpeedFactorTo: 1.0", "pauseAI: 15.0", "setStateTo: HYPER_OUT");
"NORMAL_SPACE" = ("setStateTo: HEAD_FOR_WITCHPOINT");
"OFFENCE_COMMITTED" = (
setTargetToFoundTarget,
"markTargetForOffence: 7",
deployEscorts,
groupAttackTarget
);
RESTARTED = ("setStateTo: OUTBOUND_LOOT");
"TARGET_FOUND" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
};
"OUTBOUND_LOOT" = {
ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget);
"DOCKING_REQUESTED" = ("setSpeedFactorTo: 0.0", "setAITo: receivingDockingAI.plist");
ENTER = ("setSpeedTo: 0.0", performIdle);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist");
"INCOMING_MISSILE" = (
fightOrFleeMissile,
setTargetToPrimaryAggressor,
deployEscorts,
groupAttackTarget
);
"NOTHING_FOUND" = ("setStateTo: OUTBOUND_CHECK");
"TARGET_FOUND" = (setTargetToFoundTarget, "setAITo: collectLootAI.plist");
UPDATE = (scanForLoot, "pauseAI: 10.0");
};
"PLANET_DECISION" = {
ENTER = ("rollD: 3");
"ROLL_1" = ("setStateTo: HEAD_FOR_WITCHPOINT");
"ROLL_2" = ("setStateTo: HEAD_FOR_WITCHPOINT");
"ROLL_3" = ("switchAITo: route2patrolAI.plist");
};
"WITCHPOINT_DECISION" = {
ENTER = ("rollD: 3");
"ROLL_1" = ("setStateTo: HEAD_FOR_PLANET");
"ROLL_2" = ("setStateTo: HEAD_FOR_PLANET");
"ROLL_3" = ("switchAITo: route2patrolAI.plist");
};
route2PatrolAI has basically become a copy of route1patrolAI, so it now uses goToWaypointAI as well, instead of internal WAYPOINT-states:
Code: Select all
{
GLOBAL = {ENTER = ("setStateTo: HEAD_FOR_SUN"); };
"HEAD_FOR_PLANET" = {
"ACCEPT_DISTRESS_CALL" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget);
"COURSE_OK" = ("setSpeedFactorTo: 0.8", performFlyToRangeFromDestination);
"DESIRED_RANGE_ACHIEVED" = ("setStateTo: PLANET_DECISION");
"DOCKING_REQUESTED" = ("setAITo: receiveDockingAI.plist");
ENTER = (setCourseToPlanet, "setDesiredRangeTo: 50000.0", checkCourseToDestination);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist");
"INCOMING_MISSILE" = (
fightOrFleeMissile,
setTargetToPrimaryAggressor,
deployEscorts,
"setStateTo: INBOUND_LOOT",
groupAttackTarget
);
"OFFENCE_COMMITTED" = (
setTargetToFoundTarget,
"markTargetForOffence: 7",
deployEscorts,
groupAttackTarget
);
"TARGET_FOUND" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
UPDATE = (
setCourseToPlanet,
"setDesiredRangeTo: 50000.0",
checkCourseToDestination,
scanForOffenders,
"pauseAI: 10.0"
);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
};
"HEAD_FOR_SUN" = {
"ACCEPT_DISTRESS_CALL" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
"APPROACH_COORDINATES" = (
setDestinationFromCoordinates,
"setDesiredRangeTo: 125000",
checkCourseToDestination
);
ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget);
"COURSE_OK" = ("setSpeedFactorTo: 0.80", performFlyToRangeFromDestination);
"DESIRED_RANGE_ACHIEVED" = ("setStateTo: SUN_DECISION");
"DOCKING_REQUESTED" = ("setAITo: receiveDockingAI.plist");
ENTER = (setSunSkimStartCoordinates);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist");
"INCOMING_MISSILE" = (
fightOrFleeMissile,
setTargetToPrimaryAggressor,
deployEscorts,
"setStateTo: OUTBOUND_LOOT",
groupAttackTarget
);
"OFFENCE_COMMITTED" = (
setTargetToFoundTarget,
"markTargetForOffence: 7",
deployEscorts,
groupAttackTarget
);
RESTARTED = (setSunSkimStartCoordinates);
"TARGET_FOUND" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
UPDATE = (checkCourseToDestination, scanForOffenders, "pauseAI: 10.0");
"WAIT_FOR_SUN" = ("pauseAI: 10.0", setSunSkimStartCoordinates);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
};
"HYPER_OUT" = {UPDATE = (performHyperSpaceExit); };
"INBOUND_CHECK" = {
ENTER = (scanForOffenders, checkForNormalSpace);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist");
"INTERSTELLAR_SPACE" = ("setSpeedFactorTo: 1.0", "pauseAI: 15.0", "setStateTo: HYPER_OUT");
"NORMAL_SPACE" = ("setStateTo: HEAD_FOR_PLANET");
"OFFENCE_COMMITTED" = (
setTargetToFoundTarget,
"markTargetForOffence: 7",
deployEscorts,
groupAttackTarget
);
RESTARTED = ("setStateTo: INBOUND_LOOT");
"TARGET_FOUND" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
};
"INBOUND_LOOT" = {
ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget);
"DOCKING_REQUESTED" = ("setSpeedFactorTo: 0.0", "setAITo: receivingDockingAI.plist");
ENTER = ("setSpeedTo: 0.0", performIdle);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist");
"INCOMING_MISSILE" = (
fightOrFleeMissile,
setTargetToPrimaryAggressor,
deployEscorts,
groupAttackTarget
);
"NOTHING_FOUND" = ("setStateTo: INBOUND_CHECK");
"TARGET_FOUND" = (setTargetToFoundTarget, "setAITo: collectLootAI.plist");
UPDATE = (scanForLoot, "pauseAI: 10.0");
};
"OUTBOUND_CHECK" = {
ENTER = (scanForOffenders, checkForNormalSpace);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist");
"INTERSTELLAR_SPACE" = ("setSpeedFactorTo: 1.0", "pauseAI: 15.0", "setStateTo: HYPER_OUT");
"NORMAL_SPACE" = ("setStateTo: HEAD_FOR_SUN");
"OFFENCE_COMMITTED" = (
setTargetToFoundTarget,
"markTargetForOffence: 7",
deployEscorts,
groupAttackTarget
);
RESTARTED = ("setStateTo: OUTBOUND_LOOT");
"TARGET_FOUND" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
};
"OUTBOUND_LOOT" = {
ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget);
"DOCKING_REQUESTED" = ("setSpeedFactorTo: 0.0", "setAITo: receivingDockingAI.plist");
ENTER = ("setSpeedTo: 0.0", performIdle);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist");
"INCOMING_MISSILE" = (
fightOrFleeMissile,
setTargetToPrimaryAggressor,
deployEscorts,
groupAttackTarget
);
"NOTHING_FOUND" = ("setStateTo: OUTBOUND_CHECK");
"TARGET_FOUND" = (setTargetToFoundTarget, "setAITo: collectLootAI.plist");
UPDATE = (scanForLoot, "pauseAI: 10.0");
};
"PLANET_DECISION" = {
ENTER = ("rollD: 2");
"ROLL_1" = ("setStateTo: HEAD_FOR_SUN");
"ROLL_2" = ("switchAITo: route1patrolAI.plist");
};
"SUN_DECISION" = {
ENTER = ("rollD: 2");
"ROLL_1" = ("setStateTo: HEAD_FOR_PLANET");
"ROLL_2" = ("switchAITo: route1patrolAI.plist");
};
}
Of course in the final OXP I still can put all this in only one AI with a different name, and just give that AI to all police ships (and hunters).