Jump to content
Sign in to follow this  
Wiki

CAS on mapclick

Recommended Posts

Hi guys.

Now in ArmA 3, there is a new CAS module.

You can choose the jet (Independent, Blufor or Opfor) and what you request (gun run, rocket/missiles run or both).

What I'd like to do is do it on map click.

For example, I have a soldier who need to clear a tree line and need a gun run for this.

So, I'd like him to lick on the map where he wants that gun run and then the module spawn the plane and make it do the run.

So, is it possible? And if yes, how to do it?

Thanks.

Share this post


Link to post
Share on other sites

I wouldn't know the script off the top of my head, but in process terms you could do a addAction option for team leads only, to get a map click function to happen.

From there the script can call a spawn of jet (by side type/faction of player) to then spawn 2k away from clicked area to then set a way-point to CAS/gun run where TL may have clicked.

There are mods out there like MCC in which you can call CAS through, or ALiVE where CAS and transport is available via the mods menu. Which in context MCC can be ran in a scripted form.

Or just implement Zeus.

Basic answer; mods

Complex answer; doable with work

Over all answer; use mods.

Share this post


Link to post
Share on other sites

You might work with the following code: called via radio or addaction, or other means.

 
titleText ["Open Map and Click on CAS Target location.", "PLAIN"];

["mk_omsca", "onMapSingleClick", {
titleText ["", "PLAIN"];

_mrkr = createMarker ["cas_target", _pos];
_mrkr setMarkerShape "ICON";
_mrkr setMarkerColor "Default";
_mrkr setMarkerSize [1, 1];
_mrkr setMarkerType "KIA";
_mrkr setMarkerText "CAS TARGET";

_center = createCenter sideLogic;    
_group = createGroup _center;         
_cas = _group createUnit ["ModuleCAS_F",_pos , [], 0, ""];   
//_cas setDir 360;
_cas setVariable ["vehicle","B_Plane_CAS_01_F",true]; 
_cas setVariable ["type", 2,true];
//[["AirborneCommand",["Airborne Command", "A164 WipeOut, target recieved and entroute."]], "BIS_fnc_showNotification", true, false] spawn BIS_fnc_MP;
["mk_omsca", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
true;
}] call BIS_fnc_addStackedEventHandler;

Share this post


Link to post
Share on other sites

thanks.

I'll try it and let you know

Share this post


Link to post
Share on other sites

So, it works perfectly well, thank you very much tomturner.

Edited by Wiki

Share this post


Link to post
Share on other sites
So, it works perfectly well, thank you very much tomturner.

You may also check the carpet bombing script I posted few days ago and change it easily to suit your needs.

Share this post


Link to post
Share on other sites
You might work with the following code: called via radio or addaction, or other means.

 
titleText ["Open Map and Click on CAS Target location.", "PLAIN"];

["mk_omsca", "onMapSingleClick", {
titleText ["", "PLAIN"];

_mrkr = createMarker ["cas_target", _pos];
_mrkr setMarkerShape "ICON";
_mrkr setMarkerColor "Default";
_mrkr setMarkerSize [1, 1];
_mrkr setMarkerType "KIA";
_mrkr setMarkerText "CAS TARGET";

_center = createCenter sideLogic;    
_group = createGroup _center;         
_cas = _group createUnit ["ModuleCAS_F",_pos , [], 0, ""];   
//_cas setDir 360;
_cas setVariable ["vehicle","B_Plane_CAS_01_F",true]; 
_cas setVariable ["type", 2,true];
//[["AirborneCommand",["Airborne Command", "A164 WipeOut, target recieved and entroute."]], "BIS_fnc_showNotification", true, false] spawn BIS_fnc_MP;
["mk_omsca", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
true;
}] call BIS_fnc_addStackedEventHandler;

So this worked for me as well, but... The CAS aircraft won't remove itself. Interestingly, when I try the regular "ModuleCAS_F" in the editor, the same thing happens. The aircraft makes it's attack run, then proceeds back near where it spawned and just orbits forever. I can't figure out how to delete the unit after it's made its attack...preferably after a certain amount of time. Any thoughts?

Share this post


Link to post
Share on other sites

hi, i had the same problem with a script i ve made some times ago and plane or chopper did the same, turning around like they cannoy reach teyr waypoint, did you succeed to fix it (despawn the vehicle?)

 

Share this post


Link to post
Share on other sites
37 minutes ago, thesnypr said:

hi, i had the same problem with a script i ve made some times ago and plane or chopper did the same, turning around like they cannoy reach teyr waypoint, did you succeed to fix it (despawn the vehicle?)

 

if(isNil "chopGunner_script")then{chopGunner_script = false;};
// debug message
if(chopGunner_script)exitwith{cutText [format["chopGunner_script allready running!"], "PLAIN DOWN"];};
//check if runn1ng
chopGunner_script = true;
// selection  of air types
_typechopper = ["RHS_A10","RHS_A10"] call BIS_fnc_selectRandom;
// position to spawn
//_spawnPoschop = markerPos "helo1_spawn_marker"; // old vesrion with markers
_spawnPoschop= [getpos player, 1000, 1400, 0, 0, 0, 0] call BIS_fnc_findSafePos;
//debug marker spawn pos
spawnPoschop = createmarker ["spawnPoschop",_spawnPoschop];

//debug
if (debugModeMASTER) then {
spawnPoschop setMarkerType "o_art";
spawnPoschop setMarkerColor "ColorRed";
spawnPoschop setMarkerText "spawnPoschop";
spawnPoschop setMarkerSizeLocal [0.6, 0.6];
};
// create chopper in air
_creation = [_spawnPoschop, -90,_typechopper, independent] call bis_fnc_spawnvehicle;
heloGroup = _creation select 2;
helo = _creation select 0;
{_x setskill ["spotDistance",0.88]}forEach crew helo;
{_x setskill ["aimingAccuracy",0.11]}forEach crew helo;

// combat mod crew
heloGroup  setBehaviour "AWARE";// AWARE,combat, safe, etc..
heloGroup setCombatMode "RED";//blue, yellow, green

// *combat height
//helo flyInHeight 120;

// *unlimited ammos for the chopper 
helo addeventhandler ["fired", {(_this select 0) setvehicleammo 1}];

// *sending to player zone
//[heloGroup,getpos player,1300] call CBA_fnc_taskPatrol;
//[group _unitu1, getmarkerPos "batlefield", 250] call bis_fnc_taskPatrol;
[heloGroup, getmarkerPos "batlefield", 750] call bis_fnc_taskPatrol;
// patrol timming
sleep 300;
 
_DEspawnPoschop= [getmarkerPos "batlefield", 4000, 5000, 0, 0, 0, 0] call BIS_fnc_findSafePos;

//debug marker despawn pos
DEspawnPoschop = createmarker ["DEspawnPoschop",_DEspawnPoschop];

//debug
if (debugModeMASTER) then {
DEspawnPoschop setMarkerType "o_art";
DEspawnPoschop setMarkerColor "ColorRed";
DEspawnPoschop setMarkerText "dspwnchpr";
DEspawnPoschop setMarkerSizeLocal [0.6, 0.6];
};
// creation destination final
_waypoint1 = heloGroup addWaypoint [ (markerPos "DEspawnPoschop"), 500];
_waypoint1 setWayPointBehaviour "CARELESS";
_waypoint1 setWayPointSpeed "full";
_waypoint1 setWayPointType "MOVE";
_waypoint1 setWayPointCombatMode "WHITE";
_waypoint1 setWaypointStatements ["true", ""];

//_wp setWaypointStatements ["true", "(your script here)"];
sleep 50;
// first condition

if(getmarkerPos "batlefield" distance getpos helo > 2500 or (getDammage helo > 0.7))exitwith 
{deleteMarker "spawnPoschop";deleteMarker "DEspawnPoschop"; chopGunner_script = false;};

// second condition

waitUntil { (getmarkerPos "batlefield" distance getpos helo > 2500)or (getDammage helo > 0.7) };
sleep 5;

{deleteVehicle _x;}forEach crew helo;
//deleteVehicle _unit1airchopper;
//deleteVehicle _unit2airchopper;
deleteVehicle helo;
sleep 10;
deleteMarker "spawnPoschop";
deleteMarker "DEspawnPoschop";
sleep 20;
chopGunner_script = false;

 

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
Sign in to follow this  

×