Thanks Eric. Basically the problem I had was, as I was using the same attack state both in response to detecting a target to kill and in responding to an attack on the bar itself, the launch que would be filled with ships waiting to launch, but none was actually launched as the bar would be busy in performAttack, so it just waggels its turrets at attackers too far away to hit and didn't launch ships. When its attacker eventually comes in range its is blasted with the turrets and destroyed. Then a load of hunters steam out, after the attackers have been blasted, as the bar has added loads of them to the que whilst waving its turrets impertently at tragets too far away to hit!
Redone it now this way, which produces a rather nice effect! I'm using a general scanning state for targets, which the station enters on spawning and returns to every 35 seconds after a target is detected. If it spots a target it first launches a hunter and waits 15 seconds. If attacked it uses its turrets for 10 seconds. 15 seconds after the hunter was launches it then uses turrets against any thargoids / criminals it spots for a further 10 seconds. Then it looks for targets again. In game this produces a much nicer effect, as I only have one hunter adder to the launch que at a time, a hunter is launched every 35 seconds if targets are by the bar and in between launches the gunners fire two 10 second bursts of turret fire at attackers. I think the excessive launches of hunters should be fixed by this. "The guns; they've stopped."
Code: Select all
"SCAN_FOR_CRIMINAL_PLAYER" = {
"ENTER" = ("commsMessage: scan criminal player", setTargetToSystemStation, performIdle, decreaseAlertLevel, "scanForNearestShipWithRole: player");
"EXIT" = ();
"NOTHING_FOUND" = (setTargetToSystemStation, performIdle, "setStateTo: LOOK_FOR_ALL_TARGETS");
"TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: CHECK_PLAYER_RAP_SHEET");
"UPDATE" = ("scanForNearestShipWithRole: player"); };
"CHECK_PLAYER_RAP_SHEET" = {
ENTER = ("commsMessage: check player rap sheet", checkTargetLegalStatus);
"TARGET_CLEAN" = (setTargetToSystemStation, performIdle, decreaseAlertLevel, "setStateTo: LOOK_FOR_ALL_TARGETS");
"TARGET_MINOR_OFFENDER" = (setTargetToSystemStation, performIdle, "setStateTo: LOOK_FOR_ALL_TARGETS");
"TARGET_OFFENDER" = ("sendTargetCommsMessage: [spacebar-warning]", increaseAlertLevel, "setStateTo: LAUNCH_HUNTERS");
"TARGET_FUGITIVE" = ("sendTargetCommsMessage: [spacebar-warning]", increaseAlertLevel, "setStateTo: LAUNCH_HUNTERS");
"NO_TARGET" = (setTargetToSystemStation, performIdle, decreaseAlertLevel, "setStateTo: LOOK_FOR_ALL_TARGETS");
"TARGET_LOST" = (setTargetToSystemStation, performIdle, decreaseAlertLevel, "setStateTo: LOOK_FOR_ALL_TARGETS");
"TARGET_DESTROYED" = (setTargetToSystemStation, performIdle, decreaseAlertLevel, "setStateTo: LOOK_FOR_ALL_TARGETS");
UPDATE = (checkTargetLegalStatus);
EXIT = (); };
"LOOK_FOR_ALL_TARGETS" = {
ENTER = ("commsMessage: look for all targets", "scanForNearestShipWithAnyRole: pirate hardpirate random_hits_big_boss random_hits_big_boss_guard thargoid terroriser thargoid-thargorn thargoid-escort thargoid-mothership", scanForOffenders, scanForThargoid);
"ENEMY_ATTACK" = (setTargetToFoundTarget, "sendTargetCommsMessage: [spacebar-warning]", "markTargetForOffence: 51", increaseAlertLevel, "setStateTo: TURRETT_ATTACK");
"INCOMING_MISSILE" = (fireECM, setTargetToFoundTarget, "sendTargetCommsMessage: [spacebar-warning]", "markTargetForOffence: 51", increaseAlertLevel, "setStateTo: TURRETT_ATTACK");
"NOTHING_FOUND" = (setTargetToSystemStation, performIdle, "setStateTo: LOOK_FOR_ALL_THARGOIDS");
"TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: LAUNCH_HUNTERS");
"OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 15", increaseAlertLevel, "sendTargetCommsMessage: [spacebar-warning]", "setStateTo: LAUNCH_HUNTERS");
"ACCEPT_DISTRESS_CALL" = (setTargetToFoundTarget, increaseAlertLevel, "setStateTo: LAUNCH_HUNTERS");
UPDATE = ("scanForNearestShipWithAnyRole: pirate hardpirate random_hits_big_boss random_hits_big_boss_guard thargoid terroriser thargoid-thargorn thargoid-escort thargoid-mothership", scanForOffenders, scanForThargoid);
EXIT = (); };
"TURRETT_ATTACK" = {
"ENTER" = ("commsMessage: Returning fire against an attacker - no launches", performAttack, "pauseAI: 10.0");
"TARGET_CLEAN" = ("sendTargetCommsMessage: [random_hits_bar_sorry_for_friendly_fire]", setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"ENEMY_ATTACK" = (setTargetToFoundTarget, "sendTargetCommsMessage: [spacebar-warning]", "markTargetForOffence: 51", increaseAlertLevel, performIdle, performAttack);
"INCOMING_MISSILE" = (fireECM, setTargetToFoundTarget, "sendTargetCommsMessage: [spacebar-warning]", "markTargetForOffence: 51", increaseAlertLevel, performIdle, performAttack);
"LAWFULL_ATTACK" = (setTargetToFoundTarget, "safeScriptActionOnTarget: setAITo: randomhitsbreakoffAI.plist", setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"NO_TARGET" = (setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"CONDITION_GREEN" = (setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"TARGET_DESTROYED" = (setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"TARGET_LOST" = (setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"FRUSTRATED" = ("commsMessage: frustrated in attack", setTargetToSystemStation, performIdle, "setStateTo: LAUNCH_HUNTERS");
UPDATE = ("commsMessage: Stopping turret attack", "setStateTo: LAUNCH_HUNTERS");
"EXIT" = (); };
"LAUNCH_HUNTERS" = {
"ENTER" = ("commsMessage: Launch mode - no turrets unless attacked again", performIdle, "launchShipWithRole: random_hits_patrol", "pauseAI: 15.0");
"TARGET_CLEAN" = ("sendTargetCommsMessage: [random_hits_bar_sorry_for_friendly_fire]", setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"ENEMY_ATTACK" = (setTargetToFoundTarget, "sendTargetCommsMessage: [spacebar-warning]", "markTargetForOffence: 51", increaseAlertLevel, performIdle, performAttack);
"INCOMING_MISSILE" = (fireECM, setTargetToFoundTarget, "sendTargetCommsMessage: [spacebar-warning]", "markTargetForOffence: 51", increaseAlertLevel, performIdle, performAttack);
"LAWFULL_ATTACK" = (setTargetToFoundTarget, "safeScriptActionOnTarget: setAITo: randomhitsbreakoffAI.plist", setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"NO_TARGET" = (setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"CONDITION_GREEN" = (setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"TARGET_DESTROYED" = (setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"TARGET_LOST" = (setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
UPDATE = ("commsMessage: Stopping launches, looking for targets to shoot with turrets", "setStateTo: SHOOT_SELECTED_TARGET");
"EXIT" = (); };
"SHOOT_SELECTED_TARGET" = {
"ENTER" = ("commsMessage: Trying to shoot Thargoid / Criminal with turrets - no launches", performAttack, "pauseAI: 10.0");
"TARGET_CLEAN" = ("sendTargetCommsMessage: [random_hits_bar_sorry_for_friendly_fire]", setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"ENEMY_ATTACK" = (setTargetToFoundTarget, "sendTargetCommsMessage: [spacebar-warning]", "markTargetForOffence: 51", increaseAlertLevel, performIdle, performAttack);
"INCOMING_MISSILE" = (fireECM, setTargetToFoundTarget, "sendTargetCommsMessage: [spacebar-warning]", "markTargetForOffence: 51", increaseAlertLevel, performIdle, performAttack);
"LAWFULL_ATTACK" = (setTargetToFoundTarget, "safeScriptActionOnTarget: setAITo: randomhitsbreakoffAI.plist", setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"NO_TARGET" = (setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"CONDITION_GREEN" = (setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"TARGET_DESTROYED" = (setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"TARGET_LOST" = (setTargetToSystemStation, performIdle, "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"FRUSTRATED" = ("commsMessage: frustrated in attack", setTargetToSystemStation, performIdle, "setStateTo: LAUNCH_HUNTERS");
UPDATE = ("commsMessage: Stopping turret attack. Shutting down Launches and turrets and looking for targets.", "setStateTo: SCAN_FOR_CRIMINAL_PLAYER");
"EXIT" = (); };