I need a trader AI but for a ship which avoids combat at all costs. Below is a blend of route1traderAI and traderinterceptAI which I hope will do this, but I do sometimes get bogged down with AIs.
If anyone would be kind enough to look this over for me, I'd be really grateful.
Code: Select all
{
GLOBAL =
{
ENTER = ("setStateTo: HEAD_FOR_PLANET");
};
"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_MAIN_PLANET" = ("setStateTo: GO_TO_STATION");
"CLOSE_TO_SECONDARY_PLANET" = ("setStateTo: GO_TO_SUB_STATION");
"AEGIS_IN_DOCKING_RANGE" = (dockEscorts, "setStateTo: GO_TO_STATION");
"DESIRED_RANGE_ACHIEVED" = ("setStateTo: GO_TO_STATION");
"TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: FLEE");
"INCOMING_MISSILE" = ("setStateTo: INCOMING_MISSILE", "randomPauseAI: 0.5 2.0");
ATTACKED = ("setStateTo: FLEE");
RESTARTED = (checkAegis);
UPDATE =
(
setCourseToPlanet,
"setDesiredRangeTo: 30000.0",
checkCourseToDestination,
scanForHostiles,
"pauseAI: 10.0"
);
};
"GO_TO_STATION" =
{
ENTER = (setTargetToSystemStation, "setDesiredRangeTo: 5000.0", setDestinationToTarget, checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 0.5", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"DESIRED_RANGE_ACHIEVED" = (dockEscorts, setTargetToSystemStation, "setAITo: dockingAI.plist");
"AEGIS_IN_DOCKING_RANGE" = (dockEscorts, setTargetToSystemStation, "setAITo: dockingAI.plist");
"NO_STATION_FOUND" = ("setAITo: exitingTraderAI.plist");
"TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: FLEE");
"INCOMING_MISSILE" = ("setStateTo: INCOMING_MISSILE", "randomPauseAI: 0.5 2.0");
ATTACKED = ("setStateTo: FLEE");
UPDATE =
(
setTargetToSystemStation,
"setDesiredRangeTo: 5000.0",
setDestinationToTarget,
checkCourseToDestination,
scanForHostiles,
"pauseAI: 10.0"
);
};
"GO_TO_SUB_STATION" =
{
ENTER = (setTargetToStation, "setDesiredRangeTo: 5000.0", setDestinationToTarget, checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 0.5", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"DESIRED_RANGE_ACHIEVED" = (dockEscorts, setTargetToStation, "setAITo: dockingAI.plist");
"AEGIS_IN_DOCKING_RANGE" = (dockEscorts, setTargetToSystemStation, "setAITo: dockingAI.plist");
"NO_STATION_FOUND" = ("setAITo: exitingTraderAI.plist");
"TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: FLEE");
"INCOMING_MISSILE" = ("setStateTo: INCOMING_MISSILE", "randomPauseAI: 0.5 2.0");
ATTACKED = ("setStateTo: FLEE");
UPDATE =
(
setTargetToStation,
"setDesiredRangeTo: 5000.0",
setDestinationToTarget,
checkCourseToDestination,
scanForHostiles,
"pauseAI: 10.0"
);
};
FLEE =
{
ENTER = ("setDesiredRangeTo: 25600", performFlee);
ATTACKED = (fightOrFleeHostiles);
FIGHTING = (setTargetToPrimaryAggressor, "setStateTo: FLEE");
FLEEING = (setTargetToPrimaryAggressor, "setStateTo: FLEE", "pauseAI: 10");
DEPLOYING_ESCORTS = (setTargetToPrimaryAggressor, "setStateTo: FLEE_WITH_ESCORTS");
"TARGET_LOST" = ("setStateTo: GLOBAL");
"TARGET_DESTROYED" = ("setStateTo: GLOBAL");
"INCOMING_MISSILE" = ("setStateTo: INCOMING_MISSILE", "randomPauseAI: 0.25 0.75");
"REACHED_SAFETY" = (performIdle, exitAI);
};
"FLEE_FOR_MISSILE" =
{
ENTER = ("setDesiredRangeTo: 25600", broadcastDistressMessage, performFlee, "pauseAI: 5");
ATTACKED = ("setStateTo: GLOBAL", fightOrFleeHostiles);
"TARGET_LOST" = (scanForHostiles);
"TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: GLOBAL", fightOrFleeHostiles);
"NOTHING_FOUND" = (exitAI);
"TARGET_DESTROYED" = (performIdle, exitAI);
"INCOMING_MISSILE" = ("setStateTo: INCOMING_MISSILE", "randomPauseAI: 0.25 0.75");
"REACHED_SAFETY" = (performIdle, exitAI);
"UPDATE" = (fightOrFleeMissile, "pauseAI: 10");
};
"INCOMING_MISSILE" =
{
ATTACKED = ("setStateTo: GLOBAL", fightOrFleeMissile, fightOrFleeHostiles);
"UPDATE" = (setTargetToPrimaryAggressor, fightOrFleeMissile, "setStateTo: FLEE_FOR_MISSILE");
};
}