Jump to content

scottb613

Member
  • Content Count

    760
  • Joined

  • Last visited

  • Medals

Posts posted by scottb613


  1. Hi JB,

     

    Thanks for the tips. Yeah - even after fixing my glaring error - same symptoms I had before disabling AI. It runs fairly well until it doesn’t - and my #2 has to forcefully take the lead and charge ahead - or stop after firing off a few Nades again breaking formation. I’m pretty confident I ordered all the disabling of AI in a proper manner. I had done similar on a recent heli script to break contact and it works like a champ.
     

    Frame  by frame you say - I’ve heard of it but never really looked into it. Perhaps it’s time.

     

    My test setup is the Marines from Generation Kill (desert camo with woodland camo vests) - or as close as I can get to them with the assets I could find - kind of a new genre for me - I think I like it.

     

    Regards,

    Scott

     

     

    • Like 1

  2. 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   


  3. 12 hours ago, panther42 said:

    Scott, don't know if you've found anything yet, but check out @Ibragim A's Platoon Commander 2

    This may offer what you're looking for.  I was thinking of giving it a try myself.

    Of course, you could do your own script and have the AI join your squad while you want to control them and release when done.

     

    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.

     

    SPEED.jpg

     

     

     

    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

    • Like 1

  4. 15 hours ago, panther42 said:

    You shouldn't need to keep arrays of fak or medikit.  This becomes more labor than needed if/when names are changed or new DLC added.  They should all inherit correctly in order to work properly and you can just read from the config:

      Reveal hidden contents
    
    
    lass ItemInfo: InventoryFirstAidKitItem_Base_F
    class InventoryFirstAidKitItem_Base_F: InventoryItem_Base_F
    		{
    			type = 401;
    		};
    		
    class ItemInfo: MedikitItem
    class MedikitItem: InventoryItem_Base_F
    		{
    			type = 619;
    			allowedSlots[] = {801, 701, 901};
    		};

     

    Just use the following or similar. You can adjust as needed

    _hasFAK = ((((assignedItems _unit) + (items _unit)) findIf {getNumber (configFile >> "cfgWeapons" >> _x >> "ItemInfo" >> "type") == 401}) > -1);

    _hasMedikit = ((((assignedItems _unit) + (items _unit)) findIf {getNumber (configFile >> "cfgWeapons" >> _x >> "ItemInfo" >> "type") == 619}) > -1);

     

    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


  5. 1 hour ago, panther42 said:

    You shouldn't need to keep arrays of fak or medikit.  This becomes more labor than needed if/when names are changed or new DLC added.  They should all inherit correctly in order to work properly and you can just read from the config:

      Reveal hidden contents
    
    
    lass ItemInfo: InventoryFirstAidKitItem_Base_F
    class InventoryFirstAidKitItem_Base_F: InventoryItem_Base_F
    		{
    			type = 401;
    		};
    		
    class ItemInfo: MedikitItem
    class MedikitItem: InventoryItem_Base_F
    		{
    			type = 619;
    			allowedSlots[] = {801, 701, 901};
    		};

     

    Just use the following or similar. You can adjust as needed

    _hasFAK = ((((assignedItems _unit) + (items _unit)) findIf {getNumber (configFile >> "cfgWeapons" >> _x >> "ItemInfo" >> "type") == 401}) > -1);
    _hasMedikit = ((((assignedItems _unit) + (items _unit)) findIf {getNumber (configFile >> "cfgWeapons" >> _x >> "ItemInfo" >> "type") == 619}) > -1);

     

    Hi...

     

    Thanks for the interest - let me look into this. I'm always looking for better ways of doing things.

     

    Regards,

    Scott


  6. 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


  7. 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

     

    • Thanks 1

  8. Hi Folks,

     

    For today's contribution - a stupid little status screen to help manage your SP Squad a little better.

     

    Copy the code into your own SQF - call it however you like (no args) - it should work fine... 

     

    I gotta say - seeing a DOA Unit Status staring you in the face for the duration - especially if you did something to cause it - seems to add some gravity to the mission. 

     

     

    • // Overview: A basic status report of units in player squad - Fitness, First Aid Kits, and primary weapon Magazines.

     

    • // Requires: Simply call SCOsquadStat.sqf by whatever means you choose - I use addAction to player.

     

    • // Note: Only tested in single player.

     

    • // Given: First Run - records all player units in a global variable for DOA reference. 
    • // Given: You should run SCOsquadStat.sqf once at mission start - before losses - or DOA records won't be valid.
    • // Given: Queries the status of alive player units - for Fitness, First Aid Kits, and Magazines.
    • // Given: Fit - statistic quantified so you don't focus on the numbers.
    • // Given: Fit - based on damage - 100/75 AOK | 75/50 LGT | 50/25 SER | 25/0 CRT | 0/0 DOA.
    • // Given: Fit - AOK = All Good or Just a Scratch | LGT = Lightly Injured | SER = Seriously Injured | CRT = Critically Injured | DOA = Dead On Arrival.
    • // Given: Fit - LGT indicates in Green | SER indicates in Yellow | CRT indicates in Red status lines.
    • // Given: Fit - DOA drops Fak/Mag count and dims status line - memorializes the unit's last name.
    • // Given: Fak - pulled from "401" configFile entry (panther42).
    • // Given: Mag - only counts Primary Weapon Magazines.

     

    • // Suggestion: Place this in one of your initialization scripts to run it once at startup: [] execVM "Scripts\SCOsquadStat.sqf";

     

     

     

    Hint Output looks like this:

     

    STAT.jpg

     

     

    Regards,
    Scott

     

     

    SCOsquadStat.sqf

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    // FILE NAME: SCOsquadStat.sqf
    // ARGS: None
    // AUTHOR: Scottb613
    
    // OVERVIEW: A basic status report of units in player squad - Health, Faks, and primary weapon Mags.
    
    // REQUIRES: Simply call SCOsquadStat.sqf by whatever means you choose - I use addAction to player.
    
    // NOTE: Only tested in single player.
    
    // GIVEN: First Run - records all player units in a global variable for DOA reference. 
    // GIVEN: You should run SCOsquadStat once at mission start (init) - before losses - or DOA not valid.
    // GIVEN: Queries the status of alive player units - for Health, Faks, and Mags.
    // GIVEN: Fit - stat numbers rounded off so you don't focus on chasing numbers.
    // Given: Fit - AOK = All Good or a Mere Scratch | LGT = Lightly Injured | SER = Seriously Injured.
    // Given: Fit - CRT = Critically Injured | DOA = Dead On Arrival.
    // GIVEN: Fit - based on damage - 100/75 AOK | 75/50 LGT | 50/25 SER | 25/0 CRT | DOA.
    // GIVEN: Fit - LGT indicates in Green | SER indicates in Yellow | CRT indicates in Red - status lines.
    // GIVEN: Fit - DOA drops Fak/Mag count and dims the units status line.
    // Given: Fak - First Aid Kits pulled from 401 configFile entry (panther42).
    // Given: Mag - only count Primary Weapon Magazines.
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    // Check if the global variable `SCOplayerUnits` exists
    if (isNil "SCOplayerUnits") then {
        // On first run, store all player units in the global variable
        SCOplayerUnits = [];
        {
            SCOplayerUnits pushBack _x;
        } forEach units group player;
    };
    
    // Initialize local variables
    private _hint = "";
    private _unitCnt = 0;
    
    // Function to pad numbers
    _fnc_stringPadding = {
        params[
            [ "_string", "", [ "", 0 ] ],
            [ "_numDigits", 0, [ 0 ] ]
        ];
    
        if (_string isEqualType 0) then {
            _string = str _string;
        };
    
        private _padding = "000";
        _padding select[0, _numDigits - count _string];
    };
    
    // Function to get unit position ID
    _fnc_getUnitPositionId = {
        params[ "_unit" ];
    
        private _vvn = vehicleVarName _unit;
        _unit setVehicleVarName "";
        private _str = str _unit;
        _unit setVehicleVarName _vvn;
        _str select[(_str find ":") + 1];
    };
    
    // Iterate over all units in the global list
    {
        _unit = _x;
    
        // Get unit's full name and last name
        private _fullName = name _unit;
        private _nameParts = _fullName splitString " ";
        private _lastName = if (count _nameParts > 1) then {_nameParts select 1} else {""};
    
        if (!alive _unit) then {
            // Only mark DOA and do not remove the unit from the list
            _unitCnt = _unitCnt + 1;
    
            // Format DOA status with padding and include last name
            private _unitFormPos = format["%1%2", [_unitCnt, 2] call _fnc_stringPadding, _unitCnt];
            _hint = format[
                "%1<t align='left' color='#474747'>%2 || Fit: DOA || %3</t><br/>%4",
                _hint,
                _unitFormPos,
                _lastName,
                ""
            ];
        } else {
            // Fit - If the unit is alive, update the status
            _unitCnt = _unitCnt + 1;
    
            // Get unit health and convert to fitness label
            private _health = round((1 - damage _unit) * 100);
            private _fitLabel = switch true do {
                case (_health >= 75): { "AOK" };
                case (_health >= 50): { "LGT" };
                case (_health >= 25): { "SER" };
                default { "CRT" };
            };
    
            // Set color based on fitness label
            private _fitColor = switch _fitLabel do {
                case "AOK": { "#7D7F7C" };  // Medium Grey
                case "LGT": { "#98fb98" };  // Pastel Green
                case "SER": { "#FFFF99" };  // Pastel Yellow
                case "CRT": { "#FF9999" };  // Pastel Red
                default { "#7D7F7C" };  // Default Medium Grey
            };
    
            // Mag - Count Primary Weapon Magazines
            private _priWeapon = primaryWeapon _unit;
            private _compMags = compatibleMagazines _priWeapon;
            private _magCnt = { _x in _compMags } count magazines _unit;
            _magCnt = format["%1%2", [_magCnt, 2] call _fnc_stringPadding, _magCnt];
    
            // Fak - Count FirstAidKits without using classnames
            private _fakCnt = {getNumber (configFile >> "cfgWeapons" >> _x >> "ItemInfo" >> "type") == 401} count (items _unit + assignedItems _unit);
            _fakCnt = format["%1%2", [_fakCnt, 2] call _fnc_stringPadding, _fakCnt];
    
            // Get unit formation position
            private _unitFormPos = format["%1%2", [_unitCnt, 2] call _fnc_stringPadding, _unitCnt];
    
            // Format Output with color
            _hint = format[
                "%1<t align='left' color='%2'>%3 || Fit: %4 || Fak: %5 || Mag: %6</t><br/>",
                _hint,
                _fitColor,
                _unitFormPos,
                _fitLabel,
                _fakCnt,
                _magCnt
            ];
        };
    
    } forEach SCOplayerUnits;  // Use the global list of player units
    
    // Display Status
    hint parseText _hint;

     

    • Thanks 1

  9. 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


  10. 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


  11. 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

    • Like 2

  12. 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

    • Like 1

  13. 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


  14. 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

    • Like 1

  15. Hi Folks,

     

    Based on a script from "Necropaulo":

    Scripted helicrash and MP

     

     

    Converted to SP and added some fire particle effects - some minor code massage.

     

    Simply name your helicopter with a global variable "slick1" or change the script variable to whatever name you choose - fly it through a trigger - it will crash. 

     

    • // FILE NAME: SCOheliCrash.sqf
    • // AUTHOR: scottb613

     

    • // OVERVIEW: Creates a scripted helicopter crash - that doesn't explode until on the ground.

     

    • // REQUIRES: Scripts\SCOheliCrash.sqf
    • // REQUIRES: Helicopter - Variable Name - match what is set at beginning of this script.

     

    • // NOTE: Only tested in single player.

     

    • // Given: Helicopter will be disabled once triggered - but will continue with crash landing.
    • // Given: Smoke and Fire Particle Effects added to damaged aircraft.
    • // Given: Helicopter will explode after crash landing - making it plausible a survivor may have gotten out.
    • // Given: Helicopter smoke particle effect will dissapate after 60 seconds - post crash landing.

     

    • // SUGGESTED: Radio Trigger to call script:    [] execVM "Scripts\SCOheliCrash.sqf";

     

     

     

    SCOheliCrash.sqf

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    // FILE NAME: SCOheliCrash.sqf
    // AUTHOR: scottb613
    
    // OVERVIEW: Creates a scripted helicopter crash - that doesn't explode until on the ground.
    
    // REQUIRES: Scripts\SCOheliCrash.sqf
    // REQUIRES: Helicopter - Variable Name - match what is set at beginning of this script.
    
    // NOTE: Only tested in single player.
    
    // Given: Helicopter will be disabled once triggered - but will continue with crash landing.
    // Given: Smoke and Fire Particle Effects added to damaged aircraft.
    // Given: Helicopter will explode after crash landing - making it plausible a survivor may have gotten out.
    // Given: Helicopter smoke particle effect will dissapate after 60 seconds - post crash landing.
    
    // SUGGESTED: Radio Trigger to call script:    [] execVM "Scripts\SCOheliCrash.sqf";     
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    // Set to variable name assigned to helicopter
    	private _heli = slick1;
    //-
    
    //private _groupMembers = units _heli;
    
    // Sound Explosion
    	playSound3D ["a3\sounds_f\weapons\explosion\explosion_satchel1.wss", player, true, (_heli getPos [15, getDir _heli]) vectorAdd [0, 0, 5], 5, 1, 0];
    //--
    
    // Helicopter Setup
    	_heli setDamage .98;
    	_heli setHitPointDamage ["HitHRotor",1];
    	_heli setHitPointDamage ["HitVRotor",.95];
    	_heli setHitPointDamage ["HitEngine",.99];
    	_heli allowDamage false;
    //--
    
    // Particle Effect Fire
    	private _ps1 = "#particlesource" createVehicleLocal (position _heli);
    	_ps1 attachto [_heli, [0,0,0]];
    	_ps1 setParticleParams [
    		["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 12, 0, 8], "", "Billboard",
    		1, 3, [0, 0, 0], [0, 0, 2], 0, 1, 1, 0.5, [1, 3],
    		[[1,0.5,0,1], [1,0.2,0,0.5], [0.5,0.1,0,0]],
    		[0.5, 1], 1, 1, "", "", _ps1];
    	_ps1 setParticleRandom [0.4, [1, 1, 1], [0.5, 0.5, 0.5], 0.4, 0.4, [0, 0, 0, 0], 0, 0];
    	_ps1 setDropInterval 0.03;
    //--
    
    // Particle Effect Smoke
    	private _ps2 = "test_EmptyObjectForSmoke" createVehicle (position _heli);
    	_ps2 attachto [_heli, [0,0,0]];
    //--
    
    // End Fire
    	sleep 3;
    	deleteVehicle _ps1;
    //--
    
    // Destroy Helicopter
    	waituntil {isTouchingGround _heli};
    	sleep 1;
    	_heli allowDamage true;
    	sleep 1;
    	_heli setDamage 1;
    //--
    
    // End Smoke
    	sleep 60;
    	deleteVehicle _ps2;
    //--

    Regards,

    Scott

     

    • Like 1

  16. 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


  17. 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


  18. 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

    • Like 2

  19. 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.  

     

     

     

    Add-Action.jpg

     

     

     

    This seems to work quite well for me.

     

    Regards,
    Scott

×