-
Content Count
807 -
Joined
-
Last visited
-
Medals
Everything posted by scottb613
-
Riddle Me This - AI Group Spans Two Vehicles - Formation Keeping?
scottb613 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Folks, The overall goal is to have some control over a pair of AI APC's - for better combat performance - while I am riding as a passenger in the lead. I have an AI Squad that spans the crew of two AI controlled vehicles [APC] - without player crew - - - I want these vehicles to keep proper formation - which I may change on occasion change via script [column, line, flank left, flank right]. Now - just getting one to follow the other [column] in reliable consistent fashion proves difficult. Is there some way to do it? I've tried all the usual suspects I can think of. Sometimes it seems to work - others - the vehicle does not follow - one time - it turned around and departed. I am assuming - I can control - "autocombat" for the drivers - by disabling AI as I do for helicopters but I'm not even there yet. While these two vehicles are AI commanded - I would like them to behave as they would if the player was the leader. Any help appreciated. Regards, Scott -
Riddle Me This - AI Group Spans Two Vehicles - Formation Keeping?
scottb613 replied to scottb613's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Folks, OK - I'm an idiot - I need to DISABLE those features. DOH. It always helps to write a post to problem solve. Regards, Scott -
Riddle Me This - AI Group Spans Two Vehicles - Formation Keeping?
scottb613 replied to scottb613's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Folks, Well - I figured out my main issue - never test scripts on mods while developing. It seems the CUP Humvee's are bugged and won't follow a formation - swapped to RHS and it worked MUCH better with station keeping. That said - I kind of have the basic station keeping and speed control working - same group crews both vehicles - Group Leader in V1. Sometimes V2 just stops - have no idea why - sometimes it seems to abandon the WP and goes off with a mind of its own - sometimes towards combat - sometimes away (a group can only be heading to a single WP - right?). I seem to be able to wrangle #2 back to formation - but - it's not always reliable and not always fast - - - using doFollow. I've tried to insure all the autocombat routines are disabled (part of the "Regroup" case 5). Any thoughts? /////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // FILE NAME: SCOsetSpeed.sqf // AUTHOR: scottb613 // REQUIRES: Simplex Support Modules addon. // REQUIRES: "initTransport.sqf" in root of mission folder. // REQUIRES: "Scripts\SCOsetSpeed.sqf" in root of mission folder. // REQUIRES: Simplex Transport Module - Custom Init Code entry ===>>> [_this] execVM "initTransport.sqf"; // NOTE: Only tested in single player. // GIVEN: For use with the Transport Module of Simplex Support Services. // GIVEN: Provides speed control and the ability to stop on demand. // GIVEN: Creates AddAction menu items to control speed of respective vehicle. // GIVEN: After a "ts---Stop" - when player leaves _vehicle - _vehicle will resume last ordered waypoint automatically. // GIVEN: After a "ts---Stop" - when player remains in _vehicle - is "ts---Resume" must be ordered to resume travel. // GIVEN: Camera switches to "External" when player enters a vehicle. // GIVEN: Sets initial max speed to 45. /////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////// _vehicle = _this select 0; _speedArr = _this select 3; _speedMode = (_speedArr select 0); _speed = (_speedArr select 1); _group = group _vehicle; _groupLeader = leader _group; _vehicleArr = []; _driverArr = []; // Iterate over each unit in the group { _unitVehicle = vehicle _x; _unitDriver = driver _unitVehicle; // Check if the unit is in a vehicle and if the vehicle is not already in the array if (!isNull _unitVehicle && {_unitVehicle != _x} && !(_unitVehicle in _vehicleArr)) then { _vehicleArr = _vehicleArr + [_unitVehicle]; // Add the driver to the driver array if they are not already in it if (!isNull _unitDriver && !(_unitDriver in _driverArr)) then { _driverArr = _driverArr + [_unitDriver]; }; }; } forEach units _group; hint format ["Vehicle: %3, Speed Mode: %1, Speed: %2", _speedMode, _speed, _vehicle]; sleep 2; // Initialize the flag variable if not already set if (isNil "vehicleStopped") then { vehicleStopped = false; }; // Check if the _vehicle was previously stopped and not in stop mode if (vehicleStopped && _speedMode != 4) then { // Get the current waypoint of the unit. _currentWaypoint = waypoints _vehicle select 0; // Check if a waypoint exists. if (isNil "_currentWaypoint") exitWith { hint "No Waypoint Set"; sleep 2; }; // Get the position of the current waypoint. _waypointPosition = waypointPosition _currentWaypoint; _vehicle doMove _waypointPosition; }; // Switch on the speed mode switch (_speedMode) do { case 0: { // Stop _vehicle limitSpeed 15; //sleep 2; { //hint format ["Vic: %1", _x]; sleep 1; doStop _x; } foreach _vehicleArr; vehicleStopped = true; }; case 1: { // Limited if (vehicleStopped == true) then { // Only follow if the vehicle was previously stopped units _group doFollow leader _group; }; _vehicle limitSpeed _speed; vehicleStopped = false; }; case 2: { // Cruise if (vehicleStopped == true) then { // Only follow if the vehicle was previously stopped units _group doFollow leader _group; }; _vehicle limitSpeed _speed; vehicleStopped = false; }; case 3: { // Full if (vehicleStopped == true) then { // Only follow if the vehicle was previously stopped units _group doFollow leader _group; }; _vehicle limitSpeed _speed; vehicleStopped = false; }; case 4: { // Release sleep 10; vehicleStopped = false; // Get the current waypoint of the unit. _currentWaypoint = waypoints _vehicle select 0; // Check if a waypoint exists. if (isNil "_currentWaypoint") exitWith { hint "No Waypoint Set"; }; // Get the position of the current waypoint. _waypointPosition = waypointPosition _currentWaypoint; units _group doFollow leader _group; _vehicle doMove _waypointPosition; _vehicle limitSpeed _speed; }; case 5: { // Regroup hint format ["Entering Regroup Mode: vehicleStopped = %1", vehicleStopped]; sleep 2; { hint format ["%1", _x]; sleep 2; _x disableAI "AUTOCOMBAT"; _x disableAI "TARGET"; _x disableAI "AUTOTARGET"; _x disableAI "SUPPRESSION"; _x disableAI "CHECKVISIBLE"; _x disableAI "WEAPONAIM"; _x disableAI "COVER"; _x setBehaviourStrong "SAFE"; _x setCombatMode "BLUE"; _x doFollow leader _groupLeader; } forEach _driverArr; }; }; Thanks. Regards, Scott -
Riddle Me This - AI Group Spans Two Vehicles - Formation Keeping?
scottb613 replied to scottb613's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi... Thanks again for the response. I haven't seen or tried that mod yet - I'll gladly take a gander. Yeah - I'm not a real programmer - just a hack that keeps beating a dead horse until it starts doing what I want - LOL. What I am using now to control my squad is @johnnyboy - SOG AI. That combined with Voice Attack - has actually made running a squad feel immersive - and the squad actually contributes to the mission. It's - hands down - the best experience I've ever had in ArmA. Previously - AI squads seemed pretty useless and were just cannon fodder. I can't seem to run ArmA without SOG AI - now. As far as this post - I was trying to gain a little better control of AI Drivers with more than one unit. Just some basics - for the second unit to station keep and accept formation change orders - without ignoring or fleeing. I'm not looking for brilliant AI drivers that understand combined arms operations - just go from a column to a line when faced with a threat - to allow the weapons to be more effective. I can manage the lead vehicle just fine with scripts (as a passenger) - it's the following vehicle that seems unreliable. Hmm - I may try that join/release routine... I'm currently using some addAction menus in the lead vehicle - along with the Simplex Transport Module. The two play nicely together and it seems to work pretty well - if I could get #2 to stick with me. I tried messing with the "Better Convoy" mod - but - it's not intended for what I want - I think it was intended for fully autonomous operation. I want to control the speed of the lead vehicle - to whatever conditions dictate - but the mod just overrides my issued commands. I can successfully order stop/go commands to the convoy - and issue WP changes. I can't change the formation - and the speed control seems pretty rough (jerky) on cars when you are using one for a taxi - does a little better with heavier APC's. Appreciate the interest. Regards, Scott -
SCO SP Stupid Little Squad Status Script
scottb613 replied to scottb613's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Folks, Just a quick question - I can manipulate size and color - in hints - can I not use a "fixed width font" as well? I had tried and it failed - perhaps it was me? Not having perfectly aligned columns - does bother me. Thanks. Regards, Scott -
SCO SP Stupid Little Squad Status Script
scottb613 replied to scottb613's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi... Gracias Amigo - much better - tested on Vanilla and SOG - looks good to me. 😉 Eliminated FAK class names. Updated code in initial post. Regards, Scott -
SCO SP Stupid Little Squad Status Script
scottb613 replied to scottb613's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi... Thanks for the interest - let me look into this. I'm always looking for better ways of doing things. Regards, Scott -
SCO SP Bad Pilot Script (Simplex Support Modules)
scottb613 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
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 -
SCO SP Stupid Little Squad Status Script
scottb613 replied to scottb613's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Pierre, Thank you kindly for your fine help. 😉 Updated the script in my first post. Added an array of FAK classnames - easily editable. Added DOA units last name - to make you feel even more responsible for them. They're just a number until you pull their dog tags. Regards, Scott -
Best way to stop a tracked vehicle when not crew?
scottb613 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Folks, I have this script that works well on wheeled APC's. When I move to tracked APC's it no longer works - when I try to stop using this script - I hear the crew calling out numerous coordinates to move to - then the vehicle starts moving around - then backing up. I tried doStop, commandStop, limitSpeed, forceSpeed, disableAI - nothing seems to work. I was thinking of trying - store the original wp - then delete all wp - then create a new wp at current position - then when I want to move again - delete wp and restore saved. Seems like a lot of work - just to get a tracked vehicle stopped. Script in question: _vehicle = _this select 0; _speedMode = _this select 3; switch (_speedMode) do { case 0: { _vehicle limitSpeed 20; sleep 2; _vehicle forceSpeed 0; }; // Stop case 1: { _vehicle forceSpeed -1; _vehicle limitSpeed 20 }; // Limited case 2: { _vehicle forceSpeed -1; _vehicle limitSpeed 45 }; // Cruise case 3: { _vehicle forceSpeed -1; _vehicle limitSpeed 100 }; // Full case 4: { hint "TRANSPORT released"; sleep 10; _vehicle forceSpeed -1; _vehicle limitSpeed 45; _group = group _vehicle; _waypoint = currentWaypoint _group; _wpPos = waypointPosition [_group, _waypoint]; _vehicle move _wpPos; }; // Release }; Thanks. Regards, Scott -
Best way to stop a tracked vehicle when not crew?
scottb613 replied to scottb613's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Folks, CORRECTION: Vanilla Tracked APC's work fine. The problem is with the SOG_PF M113's - - - they just won't stop with the script posted above. Regards, Scott -
SCO SP Rearm and Smart Ammo Box Scripts
scottb613 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Folks, Put this together from several scripts I've been tinkering with for years. // Overview: Stock custom Ammo Boxes (crate or vehicle) with magazines from player's squad initial loadout. // Overview: Provides on demand "Rearm" for Players Squad at Ammo Box. // Requires: "initAmmoCrate.sqf" in mission root folder. // Requires: "Scripts\SCOammo.sqf" in root of mission folder. // Requires: "Scripts\SCOrearm.sqf" in root of mission folder. // Requires: Init Field Entry in desired Ammo Box ===>>> null = [this] execVM "initAmmoCrate.sqf"; // Note: Only tested in single player. // Given: Ammo Box can be a crate or vehicle. // Given: Smart Ammo Box [SAB] - empties selected container - then stocks with magazines from players units. // Given: Ammo Box will have addAction [Srcoll Wheel] menus assigned to order players squad to resupply. // Given: Player must walk up to Ammo Box to see the menus - 4 meters. // Given: Ammo Box addAction menus only appear when not in the vehicle. // Given: Players Squad must be in the area of the ammo box - 30 meters to rearm. // Given: Intended for SOG_AI as if you want to rearm by Team - only Red or Green supported - otherwise just choose your whole squad. // Given: Explosive Destruct for actual crate - crate deleted during explosion. // Given: Explosive Destruct on vehicle - any crew will abandon and vehicle will remain destroyed. // Given: Supports multiple Ammo Boxes. // Given: Ammo Boxes can be moved by whatever means you like and should still work fine. // Given: Should work with any assets and mods - tested on SOG_PF and Vanilla. Any real interest and I'll put together a download and share them somewhere. For now - just cut and paste your own copies following the (4) Requirements. initAmmoCrate.sqf //====================================// // SCO Rearm Script w/ Smart Ammo Box // //====================================// // FILE: initAmmoCrate.sqf :FILE // Author: scottb613 // Overview: Two basic functions - stock custom Ammo Boxes (crate or vehicle) with magazines from players squad. // Overview: Provides on demand "Rearm" for Players Squad at Ammo Box. // Requires: initAmmoCrate.sqf in mission root folder. // Requires: "Scripts\SCOammo.sqf" in root of mission folder. // Requires: "Scripts\SCOrearm.sqf" in root of mission folder. // Requires: Init Field Entry in Ammo Box ===>>> null = [this] execVM "initAmmoCrate.sqf"; // Note: Only tested in single player. // Given: Ammo Box can be a crate or vehicle. // Given: Smart Ammo Box [SAB] - empties selected container - then stocks with magazines from players units. // Given: Ammo Box will have addAction [Scoll Wheel] menus assigned to order players squad to resupply. // Given: Player must walk up to Ammo Box to see the menus - 4 meters. // Given: Ammo Box addAction menus only appear when not in the vehicle. // Given: Players Squad must be in the area of the ammo box - 30 meters to rearm. // Given: Intended for SOG_AI as if you want to rearm by Team - only Red or Green supported. // Given: Explosive Destruct for actual crate - crate deleted during explosion. // Given: Explosive Destruct on vehicle - any crew will abandon - and vehicle will remain destroyed. // Given: Supports multiple Ammo Boxes. // Given: Ammo Boxes can be moved by whatever means you like and should still work fine. //=====================================================================================================================// //=====================================================================================================================// private _crate = _this select 0; private _unitArr = units group player; // Clear all existing cargo from the crate clearMagazineCargoGlobal _crate; clearWeaponCargoGlobal _crate; clearItemCargoGlobal _crate; clearBackpackCargoGlobal _crate; // Loop through each unit in the group { private _unit = _x; // Add all magazines (including grenades and smokes) from unit to crate { _crate addMagazineCargoGlobal [_x, 1]; } forEach (magazines _unit); // Add 3 vanilla First Aid Kits per unit to the crate _crate addItemCargoGlobal ["FirstAidKit", 3]; } forEach _unitArr; // Add actions to the crate for rearming and destructing _crate addAction ["<t color='#98FB98'>Rearm Squad</t>", "Scripts\SCOrearm.sqf", ["ALL", _crate], 1.5, true, true, "", "vehicle player == player", 4]; _crate addAction ["<t color='#98FB98'>Rearm Team Red</t>", "Scripts\SCOrearm.sqf", ["RED", _crate], 1.5, true, true, "", "vehicle player == player", 4]; _crate addAction ["<t color='#98FB98'>Rearm Team Green</t>", "Scripts\SCOrearm.sqf", ["GREEN", _crate], 1.5, true, true, "", "vehicle player == player", 4]; _crate addAction ["<t color='#FF0000'>AMMO_BOX Destruct</t>", "Scripts\SCOrearm.sqf", ["DESTRUCT", _crate], 1.5, true, true, "", "vehicle player == player", 4]; // Detect the classname of the ammo crate and display it as a hint hint "AMMO_CRATE stocked"; Scripts\SCOammo.sqf //====================================// // SCO Rearm Script w/ Smart Ammo Box // //====================================// // FILE: SCOammo.sqf :FILE // Author: scottb613 // Overview: Two basic functions - stock custom Ammo Boxes (crate or vehicle) with magazines from players squad. // Overview: Provides on demand "Rearm" for Players Squad at Ammo Box. // Requires: initAmmoCrate.sqf in mission root folder. // Requires: "Scripts\SCOammo.sqf" in root of mission folder. // Requires: "Scripts\SCOrearm.sqf" in root of mission folder. // Requires: Init Field Entry in Ammo Box ===>>> null = [this] execVM "initAmmoCrate.sqf"; // Note: Only tested in single player. // Given: Ammo Box can be a crate or vehicle. // Given: Smart Ammo Box [SAB] - empties selected container - then stocks with magazines from players units. // Given: Ammo Box will have addAction [Scoll Wheel] menus assigned to order players squad to resupply. // Given: Player must walk up to Ammo Box to see the menus - 4 meters. // Given: Ammo Box addAction menus only appear when not in the vehicle. // Given: Players Squad must be in the area of the ammo box - 30 meters to rearm. // Given: Intended for SOG_AI as if you want to rearm by Team - only Red or Green supported. // Given: Explosive Destruct for actual crate - crate deleted during explosion. // Given: Explosive Destruct on vehicle - any crew will abandon - and vehicle will remain destroyed. // Given: Supports multiple Ammo Boxes. // Given: Ammo Boxes can be moved by whatever means you like and should still work fine. //=====================================================================================================================// //=====================================================================================================================// // Capture an array of units selected via Function Key private _unitArr = groupSelectedUnits player; private _ammoBox = _this select 3; // Ammo Container private _ammoRun = 1; hint "REARM Script"; while { _ammoRun == 1 } do { private _ammoPos = getPos _ammoBox; { // Unit Info and Team Membership private _unit = _x; if (!alive _unit) then { continueWith { hint format ["%1 - Skipped (Dead)", _unit]; }; }; // Skip dead units // Check if the unit is within 50 meters of the ammo container if ((_unit distance _ammoPos) > 50) then { continueWith { hint format ["%1 - Skipped (Too far)", _unit]; }; }; private _priWeap = primaryWeapon _unit; private _unitMagArr = magazines _unit; private _compMagArr = compatibleMagazines _priWeap; private _totCnt = 0; // Count Primary Weapon Magazines { private _compMag = _x; { private _unitMag = _x; if (_compMag == _unitMag) then { _totCnt = _totCnt + 1; }; } forEach _unitMagArr; } forEach _compMagArr; // If Unit Above Threshold - Continue if (_totCnt > 4) then { _logger = format ["%1 - I'm good.", _unit]; hint _logger; sleep 1; continue; }; // Get Ammo _unitPos = getPos _unit; _logger = format ["Rearm %1", _unit]; hint _logger; _unit doMove _ammoPos; waitUntil { sleep 1; (_unit distance _ammoBox) < 5 }; _unit action ["rearm", _ammoBox]; _unit doMove _unitPos; } forEach _unitArr; _ammoRun = 0; }; hint ""; Scripts\SCOrearm.sqf //====================================// // SCO Rearm Script w/ Smart Ammo Box // //====================================// // FILE: SCOrearm.sqf :FILE // Author: scottb613 // Overview: Two basic functions - stock custom Ammo Boxes (crate or vehicle) with magazines from players squad. // Overview: Provides on demand "Rearm" for Players Squad at Ammo Box. // Requires: initAmmoCrate.sqf in mission root folder. // Requires: "Scripts\SCOammo.sqf" in root of mission folder. // Requires: "Scripts\SCOrearm.sqf" in root of mission folder. // Requires: Init Field Entry in desired Ammo Box ===>>> null = [this] execVM "initAmmoCrate.sqf"; // Note: Only tested in single player. // Given: Ammo Box can be a crate or vehicle. // Given: Smart Ammo Box [SAB] - empties selected container - then stocks with magazines from players units. // Given: Ammo Box will have addAction [Scoll Wheel] menus assigned to order players squad to resupply. // Given: Player must walk up to Ammo Box to see the menus - 4 meters. // Given: Ammo Box addAction menus only appear when not in the vehicle. // Given: Players Squad must be in the area of the ammo box - 30 meters to rearm. // Given: Intended for SOG_AI as if you want to rearm by Team - only Red or Green supported. // Given: Explosive Destruct for actual crate - crate deleted during explosion. // Given: Explosive Destruct on vehicle - any crew will abandon - and vehicle will remain destroyed. // Given: Supports multiple Ammo Boxes. // Given: Ammo Boxes can be moved by whatever means you like and should still work fine. //=====================================================================================================================// //=====================================================================================================================// private _params = _this select 3; private _choseTeam = _params select 0; private _ammoCrate = _params select 1; private _ammoCrateClassname = typeOf _ammoCrate; if (_choseTeam == "DESTRUCT") then { // Destruct Code private _target = _ammoCrate; private _posit = getpos _target; // create and attach charge private _charge = "DemoCharge_Remote_Ammo_Scripted" createVehicle _posit; _charge attachTo [_target, [0,0,0]]; // now detonate charge hint "----RUN---RUN---RUN----"; // Check if the ammo box is a vehicle and make the crew exit and run away if (_ammoCrate isKindOf "LandVehicle") then { private _crew = crew _ammoCrate; private _newGroup = createGroup west; // Create a new group for the crew { unassignVehicle _x; // Unassign from vehicle _x action ["getOut", _ammoCrate]; [_x] joinSilent _newGroup; // Join the new group _x doMove (getPos _x vectorAdd [100, 100, 0]); // Move 100 meters away _x setSpeedMode "FULL"; // Force sprint } forEach _crew; }; sleep 5; hint "---------10"; sleep 1; hint "--------9"; sleep 1; hint "-------8"; sleep 1; hint "------7"; sleep 1; hint "-----6"; sleep 1; hint "----5"; sleep 1; hint "---4"; sleep 1; hint "--3"; sleep 1; hint "-2"; sleep 1; hint "1"; sleep 2; hint ""; _charge setDamage 1; // Destroy the vehicle or delete the crate if (_ammoCrate isKindOf "LandVehicle") then { _ammoCrate setDamage 1; // Destroy the vehicle } else { deleteVehicle _target; // Delete the crate }; }; private _logger = format ["Rearm %1", _choseTeam]; hint _logger; sleep 3; private _ammoBox = nearestObject [player, _ammoCrateClassname]; while {true} do { private _ammoPos = getpos _ammoBox; private _unitArr = units group player; _unitArr deleteAt 0; // Exclude the player { // Unit Info and Team Membership private _unit = _x; if (!alive _unit) then {continue}; private _assTeam = assignedTeam _unit; if (_choseTeam != "ALL" && _choseTeam != _assTeam) then {continue}; if (_unit distance _ammoBox > 25) then { _logger = format ["%1 - UNABLE - Ammo Too Far", _unit]; hint _logger; sleep 1; continue; }; private _priWeap = primaryWeapon _unit; private _unitMagArr = magazines _unit; private _compMagArr = compatibleMagazines _priWeap; private _totCnt = 0; // Count Primary Weapon Magazines { private _compMag = _x; { private _unitMag = _x; if (_compMag == _unitMag) then {_totCnt = _totCnt + 1}; } foreach _unitMagArr; } foreach _compMagArr; // If Unit Above Threshold - Continue if (_totCnt > 4) then { _logger = format ["%1 - I'm good.", _unit]; hint _logger; sleep 1; continue; }; // Get Ammo _unitPos = getpos _unit; _logger = format ["Rearm %1",_unit]; hint _logger; _unit doMove _ammoPos; waitUntil {sleep 1; (_unit distance _ammoBox) < 5}; _unit action ["rearm", _ammoBox]; _unit doMove _unitPos; } foreach _unitArr; break; }; Regards, Scott- 1 reply
-
- 2
-
SCO SP Rearm and Smart Ammo Box Scripts
scottb613 replied to scottb613's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Folks, Added a working DEMO mission all setup and ready to go with the scripts. Requirements: Vanilla - plus CBA - plus ACE. Simply copy to your mission's folder and launch. Includes Ammo Box Crate and Ammo Box Vehicle examples. Download: SCO Rearm Test - Vanilla 2 Radio Triggers included in mission: Strips the units of all magazines. Kills all units so you can check their inventory. 3 Questions: When I strip magazines the HUD indicator turn yellow for each unit - indicating low ammo - however - it never clears when rearmed. What are the requirements to clear the yellow low ammo indicator? I tried adding a custom sound file to the "Destruct" script (it's in the download) - it doesn't work - anyone know why? Instead of using a custom sound - what's the name of a vanilla Arma file that give me a beep for a timer? I know I've seen it before - but I don't know how to find it. How I'm trying to call my first custom sound file: playSound3D ["Sounds\SCOtimeBeep.ogg", _ammoCrate, false, getPosASL _ammoCrate, 1, 1, 50]; sleep 2; hint ""; Thanks. Regards. Scott -
Get the position of what the player is aiming at?
scottb613 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Folks, I've been trying to capture the position the player is aiming at - using cursorTarget and screenToWorld - I think I need to be using lineIntersectsSurfaces. No joy. This seems like a task in common use in many scripts. Best way to achieve this? This fails. // Get the position the player is pointing at _startPos = eyePos player; _endPos = _startPos vectorAdd (vectorMultiply (vectorDir player, 1000)); _intersect = lineIntersectsSurfaces [_startPos, _endPos, player, objNull, true, 1, "GEOM", "NONE"]; _pointedPos = _intersect select 0 select 0; Thanks. Regards, Scott -
Get the position of what the player is aiming at?
scottb613 replied to scottb613's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Pierre, Working on a little script to easily order my associated APC to move around - without opening the map - when in close combat with my squad. I did get it kind of working but my waypoints were being created like 100 meters further out than I was actually aiming - on the correct bearing though - not sure why. You nailed it - works perfectly - adapted same - thanks so much! 😊 You would think that BIS would have made this a simple command. Not done yet. // Ensure MyRide is defined if (isNil "MyRide") exitWith {hint "TRANSPORT not defined";}; // Get the vehicle from the global variable _vehicle = missionNamespace getVariable "MyRide"; // Ensure the vehicle is valid if (isNull _vehicle) exitWith {hint "TRANSPORT not valid vehicle";}; // Clear all old waypoints using a while loop _group = group _vehicle; while {(count (waypoints _group)) > 0} do { deleteWaypoint ((waypoints _group) select 0); }; // Get the position the player is pointing at using camera position and AGLToASL _startPos = AGLToASL positionCameraToWorld [0, 0, 0]; _endPos = AGLToASL positionCameraToWorld [0, 0, 5000]; // Find intersections along the line from _startPos to _endPos _intersect = lineIntersectsSurfaces [_startPos, _endPos, player, objNull, true, 1, "VIEW", "NONE"]; // Calculate the distance to the first intersection _cursor_distance = if (count _intersect > 0) then { (_intersect select 0 select 0) vectorDistance (eyePos player) } else { 5000 }; // Calculate the waypoint position based on the camera's aiming point _pointedPos = positionCameraToWorld [0, 0, _cursor_distance]; hint "TRANSPORT on the way"; sleep 5; // Delete all existing markers { deleteMarker _x; } forEach allMapMarkers; // Create a marker at the position the player is aiming at (_pointedPos) _markerAimedName = createMarker ["AimedPositionMarker", _pointedPos]; _markerAimedName setMarkerType "hd_dot"; _markerAimedName setMarkerColor "ColorBlue"; _markerAimedName setMarkerText "Aimed Position"; // Create a new waypoint at the pointed position _newWaypoint = _group addWaypoint [_pointedPos, 0]; _newWaypoint setWaypointType "MOVE"; // Set the vehicle's speed _vehicle forceSpeed -1; // Reset any forced speed _vehicle limitSpeed 45; // Set speed mode to limited (typically around 45 km/h) // Move to the new waypoint _group setCurrentWaypoint _newWaypoint; Regards, Scott -
SCO SP Transport Enhancement (Simplex Support Modules)
scottb613 posted a topic in ARMA 3 - ADDONS - CONFIGS & SCRIPTING
Hi Folks, I use the fantastic Simplex Support Services in almost every mission - nice easy to use support modules. That said - the Transport Module left me needing a bit more. I often found myself charging headlong into places that I knew were bad but had no way to stop quickly to disembark. I needed a simple script to make the speed of the vehicle I'm traveling in a bit more manageable and readily accessible. I created a script to enhance your Simplex controlled Transport Module - or - any other vehicle you are riding in - to add a bit more control. Speed of vehicle is controlled by addAction menu when in the respective vehicle. It has options for (Stop, Limited Speed, Cruise Speed, Full Speed, Resume). Resume is used after a Stop to continue on to the previously picked Waypoint without having to choose a new one. This gives you a chance to rapidly stop and disembark troops if the path ahead looks sketchy - instead of fumbling with the Ace Menu to pick a new Waypoint. This seems to work quite well for me. Regards, Scott -
SCO SP Transport Enhancement (Simplex Support Modules)
scottb613 replied to scottb613's topic in ARMA 3 - ADDONS - CONFIGS & SCRIPTING
Hi Folks, Updated this and added more features: Requires creating the two following files and one init code entry in the respective Simplex Transport Module - as posted below. Simplex Transport Module - Custom Init Code entry ===>>> [_this] execVM "initTransA.sqf"; initTransA.sqf goes in mission root folder. SCOsetSpeed.sqf goes in a "Scripts" directory inside the mission root folder. If the Simplex Transport Module spawns a replacement vehicle - these same settings will be applied to the new vehicle. initTransA.sqf //==========================// // Simplex Transport Speed // //==========================// // Author: scottb613 // File: initTransA.sqf // Requires: Simplex Support Modules addon. // Requires: "initTransA.sqf" in root of mission folder. // Requires: "Scripts\SCOsetSpeed.sqf" in root of mission folder. // Requires: Simplex Transport Module - Custom Init Code entry ===>>> [_this] execVM "initTrans.sqf"; // Note: Only tested in single player. // Given: For use with the Transport Module of Simplex Support Services. // Given: Provides speed control and the ability to stop on demand. // Given: Creates AddAction menu items to control speed of respective vehicle. // Given: After a "ts---Stop" - when player leaves vehicle - vehicle will resume last ordered waypoint automatically. // Given: After a "ts---Stop" - when player remains in vehicle - is "ts---Resume" must be ordered to resume travel. // Given: Camera switches to "External" when player enters a vehicle. // Given: Sets initial max speed to 45. //=====================================================================================================================// //=====================================================================================================================// _vehicle = _this select 0; // Disable Lambs Danger _vehicle setVariable ["dangerAIEnabled", false]; // Add Action to menu to control speed of vehicle _vehicle addAction ["<t color='#00FFFF'> ts---Stop</t>", "Scripts\SCOsetSpeed.sqf", 0, 1, true, true, "", "", 3]; _vehicle addAction ["<t color='#00FFFF'> ts---Limited</t>", "Scripts\SCOsetSpeed.sqf", 1, 1, true, true, "", "", 3]; _vehicle addAction ["<t color='#00FFFF'> ts---Cruise</t>", "Scripts\SCOsetSpeed.sqf", 2, 1, true, true, "", "", 3]; _vehicle addAction ["<t color='#00FFFF'> ts---Full</t>", "Scripts\SCOsetSpeed.sqf", 3, 1, true, true, "", "", 3]; _vehicle addAction ["<t color='#00FFFF'> ts---Resume</t>", "Scripts\SCOsetSpeed.sqf", 4, 1, true, true, "", "", 3]; // Add event handler to check for all non-crew members exiting the vehicle _vehicle addEventHandler ["GetOut", { params ["_veh", "_role", "_unit"]; if (!(_unit in crew _veh) && {_unit == player}) then { [_veh, nil, nil, 5] execVM "Scripts\SCOsetSpeed.sqf"; }; }]; // Add event handler to switch to external camera view when the player gets in the vehicle _vehicle addEventHandler ["GetIn", { params ["_veh", "_role", "_unit"]; if (_unit == player) then { player switchCamera "EXTERNAL"; }; }]; // Set slower initial speed _vehicle limitSpeed 45; SCOsetSpeed.sqf //==========================// // Simplex Transport Speed // //==========================// // Author: scottb613 // File: SCOsetSpeed.sqf // Requires: Simplex Support Modules addon. // Requires: "initTransA.sqf" in root of mission folder. // Requires: "Scripts\SCOsetSpeed.sqf" in root of mission folder. // Requires: Simplex Transport Module - Custom Init Code entry ===>>> [_this] execVM "initTrans.sqf"; // Note: Only tested in single player. // Given: For use with the Transport Module of Simplex Support Services. // Given: Provides speed control and the ability to stop on demand. // Given: Creates AddAction menu items to control speed of respective vehicle. // Given: After a "ts---Stop" - when player leaves vehicle - vehicle will resume last ordered waypoint automatically. // Given: After a "ts---Stop" - when player remains in vehicle - is "ts---Resume" must be ordered to resume travel. // Given: Camera switches to "External" when player enters a vehicle. // Given: Sets initial max speed to 45. //=====================================================================================================================// //=====================================================================================================================// _vehicle = _this select 0; _speedMode = _this select 3; switch (_speedMode) do { case 0: { _vehicle limitSpeed 20; sleep 2; _vehicle forceSpeed 0; }; // Stop case 1: {_vehicle limitSpeed 20}; // Limited case 2: {_vehicle limitSpeed 45}; // Cruise case 3: {_vehicle limitSpeed 100}; // Full case 4: { _vehicle forceSpeed -1; _vehicle limitSpeed 20; _group = group _vehicle; _waypoint = currentWaypoint _group; _wpPos = waypointPosition [_group, _waypoint]; _vehicle move _wpPos; }; // Resume case 5: { hint "Transport Release"; sleep 10; _vehicle forceSpeed -1; _vehicle limitSpeed 45; _group = group _vehicle; _waypoint = currentWaypoint _group; _wpPos = waypointPosition [_group, _waypoint]; _vehicle move _wpPos; }; // Release }; Regards, Scott- 1 reply
-
- 1
-
Hi JB, I see you haven't been active - so - - - please - - - don't let this draw you back in. This is just an FYI or placeholder for - if/when - the urge hits again. We all need our breaks - enjoy yours. I think something may have changed since I did my last serious testing - this seems to be a new behavior introduced into SOG_AI. There seems to be some confusion when ordering team specific (red or green) actions. Order Team Red to lay dog in a position - order Team Green to lay dog in a different position - Team Red starts jostling around - some members get up - some run back to my position. I tested with only SOG_PF and SOG_AI loaded. This behavior seems to affect all actions (go, cover, lay dog) when trying to order each team individually. If possible - most commands on the wheel - should be capable of independent actions - by team (red or green) - without interfering with the other team. Most did previously. I think "Stop" did not work independently since the beginning. Thanks for all you do. 😉 Regards, Scott
-
Hi Folks, First attempt at a short cinematic. Regards, Scott
-
Scripted helicrash and MP
scottb613 replied to Necropaulo's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Folks, TAKE TWO - if anyone has interest. Same mission I posted before but now with full cinematic camara usage - as my proof of concept. I think it adds depth for the mission with the opening crash cinematic - to know what the rescue mission is based off of. I added ACE and 3DEN - to the required mods - plus SOG PF and CBA. I'm so happy with how your crash script worked out. I did change the explosion audio. No action required - just enjoy the cinematic. Cinematic Camera Helo Crash: https://mega.nz/file/00wg2SrA#n91oHjl-8UfcDuI3Gb1MT2Olb8cKNcuij5PmDPvAXrM Regards, Scott -
What game are you currently playing right now?
scottb613 replied to gubtil864312's topic in OFFTOPIC - Games & Gaming
Hi Folks, I guess my two make for a pretty eclectic mix - just ArmA and Open Rails Train Simulator - but I model with Blender for Train Sim which is a massive third option for a hobby. My Blender Models Regards, Scott -
Scripted helicrash and MP
scottb613 replied to Necropaulo's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Folks, I'm strictly SP - man - what a fine script. I'm trying to make a cut scene for a helicopter rescue - in Nam. Most of the Helicopter scripts are DOA because they are so old. I set this up for a test mission and with some minor editing (I don't plan on being on the aircraft) - works perfectly. WOW!!! ____________________________________________________________________________________________________ Here's my full test mission - just to get your script working. Launch - wait 60 seconds or so - and watch. Only mods needed - CBA and SOG Prairie Fire. Using ALTIS for good visibility. Helicopter Crash Test Mission: https://mega.nz/file/U9owlQCK#tNldWGw-K8obsmAW-LgMu_Ztx_XiPdQBkl2zucr7TS0 Thanks so much. Regards, Scott -
Hi Folks, For anyone interested - or - for those looking for ideas - I've uploaded my recent changes for 2024 - for my Voice Attack (VA) profile for SOG AI. [DOWNLOAD - Link in my Sig - DOWNLOAD] I know JB worked hard on that menu wheel - but - with VA and never having to use that menu wheel - SOG AI is at a whole new level of realism. VA recognition is excellent and seldom misses a call for me. Commands can be called via Voice, Joystick Button, and/or Keyboard Shortcuts. For those unfamiliar - one of the best features of VA is the ability to combine many commands - into a single call. I use a ton of them. Compound Command to Call a Defensive Line SOG SILENCE Press T key and hold for 0.1 seconds and release Pause 0.2 seconds Press 5 key and hold for 0.1 seconds and release Pause a variable number of seconds [_proTime] SOG FORM LINE Press T key and hold for 0.1 seconds and release Pause 0.2 seconds Press 7 key and hold for 0.1 seconds and release Pause a variable number of seconds [_proTime] SOG MOVE Press T key and hold for 0.1 seconds and release Pause 0.2 seconds Press 2 key and hold for 0.1 seconds and release Play sound, '{VA_SOUNDS}\confirmation_beep.wav' Key Points of my Profile Mixes SOG AI with some Vanilla commands that seem to play well together. After using Vanilla commands - the SOG AI "Silence" command seems to reinitialize all SOG AI back to its normal operation. I have a role defined for a "Scout" (it's easy to do others - sniper - medic - etc) - at times I want to scout ahead with just one squad member - so a chosen unit can be removed from the squad for temporary individual instruction. I keep track of role assignments in both the lower and upper Function Keys to accommodate up to 20 squad members. Profile Commands (I don't know why the image quality is so poor - the source are high-res JPG) SOG AI Just one more bit of feedback on SOG AI for the record - it seems that even when you have your squad set to silence - the squad members will initiate contact with grenades when they have silenced weapons. In my humble opinion - overall SOG AI with Prairie Fire - is the best ArmA has ever been. Thanks JB - for all your hard work and effort. Regards, Scott
-
Delete ModuleEffectsFire_F (C3_Fire)?
scottb613 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Folks, Quick Question - "deleteVehicle" doesn't seem to work with fire and smoke modules - such as "ModuleEffectsFire_F (C3_Fire)". Can I delete this via script? Thanks. Creating a mission with random crash sites: Scott -
Delete ModuleEffectsFire_F (C3_Fire)?
scottb613 replied to scottb613's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi Pierre, I drift in and out around here - but - always nice to see you posting. Thanks for your help and I always appreciate seeing how I could code it better. Time to look up a couple new commands I haven't used before. 😉 Regards, Scott