Jump to content
AndrewDX

CAS Support Module Help

Recommended Posts

I would like to know how to make a support option for CAS planes to have gun runs, missile strikes options, etc. When you make an air support module and add an aircraft there are only two options unguided bomb and laser guided bomb, Anyway to fix this?

Share this post


Link to post
Share on other sites

You will need a scripted version of air support for that. I believe someone had or was talking about writing one here but cant remember where I saw it. Maybe look up the AI modification pages where they list all the AI mods. Think thats where I saw it

https://forums.bohemia.net/forums/topic/165560-ai-compilation-list-of-addonsmodsscripts-threads-for-arma3/

Share this post


Link to post
Share on other sites

the vanilla CAS is fairly simple, not sure theres much more options to be had?

 

if you need more detailed CAS could look at this?

 

Drongo's Air support

Share this post


Link to post
Share on other sites

The Vanilla CAS is simple to set up but there are only two options, bombing, I would like to be able call in gun runs and misses strikes not just bombing. 

Share this post


Link to post
Share on other sites

You can add this script in the CAS provider module. The unguided bomb will be replaced by gun run.

This is a demo, not a perfect script. If you want to add some specific menu see addAction or even showCommandingMenu or BIS_fnc_addCommMenuItem;

Perhaps some other guys could help with commanding menu. I'm not digging into submenu.

Spoiler

 


0 = this spawn {
   private _repeatOnVirtual = {
    _module = _this;
    waitUntil {sleep 1; {_x isKindOf "plane"} count synchronizedObjects _module > 0 or !isnil {player getVariable "BIS_SUPP_selectedProviderVeh"}};
      private _veh = [];
      private _isVirtual = false;

      If (!isnil {player getVariable "BIS_SUPP_selectedProviderVeh"}) then {
        _isVirtual = true;
        waitUntil {player getVariable "BIS_SUPP_selectedProviderVeh" != ""};
        _vehClass = player getVariable "BIS_SUPP_selectedProviderVeh";
        waitUntil {count (nearestObjects [position _module,[_vehClass],50,true]) > 0};
        _veh = (nearestObjects [position _module ,[_vehClass],50,true]);
      };
      {_veh pushBack _x} forEach ((synchronizedObjects _module) select {_x isKindOf "plane"});
      if (isServer) then {
    {
      _home = getPos _x;

      while {alive _x} do {
        waitUntil {sleep 1; (driver _x getVariable "BIS_SUPP_supportType") == "CAS_Bombing"  && (driver _x getVariable ["BIS_SUPP_supporting",false])};
        if (driver _x getVariable "BIS_SUPP_ammoType" == 0) then {
          _requester = (driver _x) getVariable "BIS_SUPP_requester";
        "Gun run requested" remoteExec ["hint",_requester];
        waitUntil {!isnil {driver _x getVariable "BIS_SUPP_supportRunCoords"}};
        _coords = driver _x getVariable "BIS_SUPP_supportRunCoords";
        driver _x setCombatMode "BLUE";
        waitUntil {_x distance2D _coords < 2000};
        _timer = diag_tickTime;
        _result = false;
        "In sight"  remoteExec ["hint",_requester];
        _tgttype = ["laserTargetE","laserTargetW"] select (side _x == WEST or (side _x == RESISTANCE && WEST getFriend RESISTANCE >0.6));
        _tgt = createVehicle [_tgttype,_coords,[],0,"none"];
        _trts =  (_x WeaponsTurret [-1]) select { ["gatling",_x] call bis_fnc_inString or ["cannon",_x] call bis_fnc_inString};
        if (count _trts > 0) then {
          _trt = _trts select 0;
        while {diag_tickTime < _timer + 30} do {
          deleteVehicle BIS_SUPP_laserTGT;
          _x doTarget _tgt;
          _x selectWeaponTurret [_trt,[-1]];
          driver _x setCombatMode "RED";
            if ((_x weaponDirection _trt vectorCos (AGLToASL _coords vectorDiff (eyepos driver _x))) > 0.999) then {
              _result = [_x,_trt] call BIS_fnc_fire;
            } else {
              driver _x lookAt _tgt
            };
            sleep .01;
        };
      };
        if (!_result) then {driver _x setVariable ["BIS_SUPP_failed",true]};
        (["Gun run aborted","Gun run terminated, resuming support"] select _result) remoteExec ["hint",_requester];
        (driver _x) setVariable ["BIS_SUPP_supporting",false];
        if (_isVirtual) then {
            waitUntil {isNull _x};
            if (true) exitWith {_module call _repeatOnVirtual};
        };
        waitUntil {waypointType [group _x,currentWaypoint group _x] == "MOVE"};
        [group _x,currentWaypoint group _x] setWaypointPosition [_home,0];
        [group _x,currentWaypoint group _x] setWaypointStatements ["true",""];
        _x setFuel 1;
        waitUntil {!(driver _x getVariable ["BIS_SUPP_supporting",true])};
      };
    };
    } forEach _veh;
  };
};
_this call _repeatOnVirtual
};

 

 

 

EDITED: This script is not maintained. See instead.

Share this post


Link to post
Share on other sites

@AndrewDX

 

have you tried the heli attack module in EDEN? that calls a chopper to attack near enemies with guns,  missles etc. the planes just do bombing runs i think

Share this post


Link to post
Share on other sites
24 minutes ago, lordfrith said:

@AndrewDX

 

have you tried the heli attack module in EDEN? that calls a chopper to attack near enemies with guns,  missles etc. the planes just do bombing runs i think

Yes, I've gotten all supports to work. The scenario is an AAF unit low on supplies, all factions at war, etc. The AAF unit on Stratis is supposed to be supported by AAF jets with low ordinance ergo no bombs or missles only strafing. I was hoping there was a simple fix without having to do a bunch of scripting. I'm not good with it lol, I tried downloading the mod but I couldn't get the addon to work.  

Share this post


Link to post
Share on other sites
2 minutes ago, AndrewDX said:

I was open there was simple fix without having to do a bunch of scripting

 

hehe nope, the vanilla support modules are pretty basic. did you try the code above by @pierremgi? all you should need to do is copy the contents of the grey box and paste it into the box mark 'init' when you double click on the CAS module in EDEN editor.

Share this post


Link to post
Share on other sites
34 minutes ago, lordfrith said:

 

hehe nope, the vanilla support modules are pretty basic. did you try the code above by @pierremgi? all you should need to do is copy the contents of the grey box and paste it into the box mark 'init' when you double click on the CAS module in EDEN editor.

I appreciate all the help guys-the box would work, but how would make a CAS with all options? More code I'm sure -_- That mod looked awesome but I'm not good enough with files and editing to do it, I wish it was in the steam workshop.  

Share this post


Link to post
Share on other sites

So far, I modified my script (above) to make it compatible with all aircraft. But gun run will abort if no "cannon" or "gatling" on board. Tell me if you find some other cannon  (weaponsTurret) with a different string inside name.

 

Now, the script is compatible with virtual and real CAS.

 

The firing accuracy is not fine due to a forced firing in a direction, not on a target. As usual, it's a pain in the b.. to override BI engine for choosing a cannon instead of bombs, then firing something neat on a target.

 

If you want to repeat the run, wait for the aircraft's distance from target (at least 2000 m) , or let it disappear on virtual CAS. If not, there is some chance to see a bomb drop.

 

No effect on laser guided ordnance, but the classic bomb run is overridden (if not too soon repeated).

For Menu: It's possible to add a "gun run request" line in ordnance mode submenu (then 3 lines: guided, non-guided, gun run request).

The problem is to trigger the run after selection. A code can run but I didn't discover the command to let start the CAS, struggling with BIS_support variables. I'll have a second look if I have time. Done!

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Finally, i re-re-wrote the script. Now, you just have to call the Gun run request in your favorite module!

I moved my code here for evident reason: It's easier for me to find it for some debug/improvement. I'm a little bit lost with all these threads. Thanks for your comprehension.

  • Like 1

Share this post


Link to post
Share on other sites

Hey peeps, I've edited the virtual bombing support module to run a modified loadout version of the A-164 wipeout.The aircraft spawns and flys in but wont drop any bombs.The ordnance is laser guided capable.But no bombs dropped at all and wont finish the script and fly off and delete. 

Any insight welcome.:)

Thanks.

Share this post


Link to post
Share on other sites

What do you mean by "edited the virtual bombing support module"?

BI module runs FSMs with commands taking your parameters into account. It creates LaserTarget (W or E) on position you click when calling the support. But, if I remember, there is no weapon selection. So, if the guided payload is not selected before release, the script will fail. Anyway, the bombing is not the easiest code to manage. There is no guarantee to succeed in dropping the right bomb at the right place. Time consuming!

Share this post


Link to post
Share on other sites

Hey bud,

 

 

I have modified the virtual support modules by patching the module config.

I have successfully patched the CAS module with an A-164 and F-181  with a napalm loadout.For the CAS module patch i had to modify the default loadout for the aircraft.That takes care of the aircraft spawning with the right weps.

The support modules use different scripting.Further digging is required.If anyone has any experience with this please post whatever insight you have to share here.

Thanks.:)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×