scottb613 284 Posted August 23 Hi Folks, As a SP - tired of your CAS helicopter gunships not following orders to leave the area - or - charging headlong into an area saturated with deadly AA oblivious to the danger - then this script is for you. Bad Pilot disables the "autocombat" sequence for the AI pilot and orders him back to his "Safe Space" - lol - for a mental break. Once clear of combat you can order another attack run - move - or RTB without issue. I use a Radio Trigger to call it on demand when I see my gunships not responding to commands. I know this place is kind of dead - not sure if it's worthwhile or of any benefit - to clean up my little scripts and post them. NOTE: I see that a new and improved Development build of Simplex Support Services has its source shared on GitHub. Honestly - a bit too complicated for my needs. QUESTION: Does anyone know if the source for the original version of Simplex Support Services was shared as well? I'd love to be able to modify that version. // OVERVIEW: Intended for use with [SP] Simplex Support Service - CAS Helicopter Module - easily used anywhere. // OVERVIEW: Force a break in the "autocombat" sequence of CAS helicopter and send it to a safe zone to regroup. // REQUIRES: Scripts\SCObadPilot.sqf // REQUIRES: Marker - Variable Name - "SAFEZONE" must exist - at least 1500m from expected combat. // REQUIRES: Helicopter - Variable Name - must match the name used at the start of this script. // GIVEN: Disables all AI Combat of pilot to break contact. "Bad Pilot". // GIVEN: Clears all existing waypoints - creates new waypoint at marker "SAFEZONE". // GIVEN: Once the helicopter moves 1500m towards "SAFEZONE" pilot resets AI and group behavior. "Good Pilot". // GIVEN: Once given the Good Pilot message - aircraft is ready for further tasking via Simplex Support Module. // GIVEN: If the aircraft takes longer than 60 sec to travel the 1500m - the program will abort and reset. // GIVEN: The script won't run if the aircraft is on the ground. // GIVEN: The script has a run flag to prevent running more than one occurrence at a time. // SUGGESTED: Radio Trigger to call script set to repeatable: [] execVM "Scripts\SCObadPilot.sqf"; SCObadPilot.sqf /////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // FILE NAME: SCObadPilot.sqf // ARGS: None // AUTHOR: Scottb613 // OVERVIEW: Intended for use with [SP] Simplex Support Service - CAS Helicopter Module - easily used anywhere. // OVERVIEW: Force a break in the "autocombat" sequence of CAS helicopter and send it to a safe zone to regroup. // REQUIRES: Scripts\SCObadPilot.sqf // REQUIRES: Marker - Variable Name - "SAFEZONE" must exist - at least 1500m from expected combat. // REQUIRES: Helicopter - Variable Name - "CASheli" - must match the name used at the start of this script. // GIVEN: Disables all AI Combat of pilot to break contact. "Bad Pilot". // GIVEN: Clears all existing waypoints - creates new waypoint at marker "SAFEZONE". // GIVEN: Once the helicopter moves 1500m towards "SAFEZONE" pilot resets AI and group behavior. "Good Pilot". // GIVEN: Once given the Good Pilot message - aircraft is ready for further tasking via Simplex Support. // GIVEN: If the aircraft takes longer than 60 sec to travel the 1500m - the program will abort and reset. // GIVEN: The script won't run if the aircraft is on the ground. // GIVEN: The script has a run flag to prevent running more than one occurrence at a time. // SUGGESTED: Radio Trigger to call script set to repeatable: [] execVM "Scripts\SCObadPilot.sqf"; /////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // CHANGE ME || "CASheli" assigned to Helicopter || User Assigned || Confirm Before Testing || CHANGE ME private _helicopter = missionNamespace getVariable ["CASheli", nil]; /////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Check if the variable is assigned, and if it references a valid object in the mission if (isNil "_helicopter" || {!alive _helicopter} || {typeName _helicopter != "OBJECT"}) exitWith { hint parseText "<t color='#fdfd96' size='1.25'>No PILOT</t>"; }; // Check if the marker "SAFEZONE" exists and get its position private _markerPos = getMarkerPos "SAFEZONE"; if (_markerPos isEqualTo [0,0,0]) exitWith { hint parseText "<t color='#fdfd96' size='1.25'>No SAFEZONE</t>"; SCOscriptRun = nil; // Clear the global flag }; // Check if the script is already running if (!isNil "SCOscriptRun") exitWith { hint parseText "<t color='#fdfd96' size='1.25'>Running PILOT</t>"; }; // Check if the helicopter is touching the ground if (isTouchingGround _helicopter) exitWith { hint parseText "<t color='#fdfd96' size='1.25'>Grounded PILOT</t>"; SCOscriptRun = nil; // Clear the global flag }; // Set the global flag to indicate the script is running SCOscriptRun = true; sleep 2; hint parseText "<t color='#fdfd96' size='1.25'>Bad PILOT</t>"; sleep 2; // Set vars for Pilot and Group private _group = group _helicopter; private _pilot = driver _helicopter; // Disable AI features for all units in the group of the helicopter { _x disableAI "AUTOCOMBAT"; _x disableAI "TARGET"; _x disableAI "AUTOTARGET"; _x disableAI "SUPPRESSION"; _x disableAI "CHECKVISIBLE"; _x setBehaviour "CARELESS"; _x setCombatMode "BLUE"; } forEach units _pilot; // Remove all existing waypoints for the group { deleteWaypoint _x; } forEach waypoints _group; sleep 2; // Add a new LOITER waypoint at the marker "SAFEZONE" with a 300-meter radius private _wp = _group addWaypoint [_markerPos, 0]; _wp setWaypointType "LOITER"; _wp setWaypointLoiterRadius 300; // Set the loiter radius to 300 meters _wp setWaypointLoiterType "CIRCLE"; // Loiter in a circular pattern _wp setWaypointLoiterAltitude 100; // Optional: Set the loiter altitude // Ensure the new waypoint is set as the current waypoint _group setCurrentWaypoint _wp; // Record the initial position of the helicopter private _initialPos = getPosASL _helicopter; // Initialize the check counter private _checkCounter = 0; // Periodically check if the helicopter has moved 1500 meters from the initial position while {true} do { sleep 5; // Check every 5 seconds private _currentPos = getPosASL _helicopter; private _distance = _initialPos distance _currentPos; _checkCounter = _checkCounter + 1; // Increment the check counter if (_distance > 1500) then { // Re-enable AI features for all units in the group of the helicopter { _x enableAI "AUTOCOMBAT"; _x enableAI "TARGET"; _x enableAI "AUTOTARGET"; _x enableAI "SUPPRESSION"; _x enableAI "CHECKVISIBLE"; _x setBehaviour "AWARE"; _x setCombatMode "YELLOW"; } forEach units _pilot; hint parseText "<t color='#fdfd96' size='1.25'>Good PILOT</t>"; // Clear the global flag when the script completes SCOscriptRun = nil; break; // Exit the loop once the distance condition is met }; if (_checkCounter >= 12) then { // Timeout after 12 checks (60 seconds) hint parseText "<t color='#fdfd96' size='1.25'>Abort PILOT</t>"; sleep 2; // Clear the global flag when the script completes SCOscriptRun = nil; // Exit the loop break; }; }; Regards, Scott 1 Share this post Link to post Share on other sites