beno_83au 1369 Posted September 2, 2018 Download: MIL_CAS - Dropbox Description: MIL_CAS is a simple script to allow a mission designer to use the vanilla CAS Module in-game via scripting. All this does is perform the required actions to properly call BIS_fnc_moduleCAS. Best suited for ambience, the strikes shouldn't be relied on for 100% accuracy. Features: - Position and approach heading can be defined. - Plane and type of CAS to be provided can be defined. To use: - Copy the file MIL_CAS.sqf to your mission folder. - Run the script using: nul = [[_position,_direction,_vehicle,_type],"MIL_CAS.sqf"] remoteExec ["BIS_fnc_execVM",2]; - _position - array - position for CAS to strike - _direction - number - direction for the CAS to approach on - _vehicle - string (optional) - default: "B_Plane_CAS_01_F" - classname of the plane to fly CAS - _type - number (optional) - default: 2 - type of CAS to be used - 0 - Guns - 1 - Missiles - 2 - Guns & Missiles - 3 - Bomb - Examples: nul = [[getPos player,240],"MIL_CAS.sqf"] remoteExec ["BIS_fnc_execVM",2]; - Wipeout will fly in for a "Guns & Missiles" run. nul = [[getPos player,240,"RHS_A10",3],"MIL_CAS.sqf"] remoteExec ["BIS_fnc_execVM",2]; - A-10 will fly in and drop a single bomb. Credits: - This uses the vanilla function BIS_fnc_moduleCAS for the actual CAS. All I did was make an easy way to launch it from a script. Media: Everyone knows what CAS is all about, but here is all four types being called in anyway (0.52): If anyone finds any problems please let me know. Thank you. 10 7 Share this post Link to post Share on other sites
1212PDMCDMPPM 200 Posted September 2, 2018 Nice !! 1 Share this post Link to post Share on other sites
Guest Posted September 3, 2018 Thanks for sending us your newest release :) An Armaholic mirror is now available: MIL CAS v1.00 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4206 Posted September 3, 2018 Nice Script ! Congratulations beno_83au ! 1 Share this post Link to post Share on other sites
Gunter Severloh 4002 Posted November 20, 2018 Hello Beno, On 9/2/2018 at 4:26 AM, beno_83au said: To use: - Copy the file MIL_CAS.sqf to your mission folder. - Run the script using: A few questions for you on how to get this working. So the script is in my mission folder, and according your instructions here, do i copy the whole code or a part of it, and where do i put it? So my understanding is you dont need the support cas module anymore as the script will call it instead correct? Now if thats the case like the support requester, is there an option to limit how many cas missions one can call? 1 Share this post Link to post Share on other sites
beno_83au 1369 Posted November 20, 2018 1 hour ago, Gunter Severloh said: So the script is in my mission folder, and according your instructions here, do i copy the whole code or a part of it, and where do i put it? Once the file is in your mission directory, leave it as it is. You then only need to run it using as per the instructions above (nul = [_position,_direction,_vehicle,_type] execVM "MIL_CAS.sqf";). 1 hour ago, Gunter Severloh said: So my understanding is you dont need the support cas module anymore as the script will call it instead correct? Correct. 1 hour ago, Gunter Severloh said: Now if thats the case like the support requester, is there an option to limit how many cas missions one can call? Running the .sqf once will call in one CAS strike. So as an example, if you're using it in an addAction just delete the action when you run it. Hope that covers it, but if not just say so. I've tried to make this as simple as possible to call in CAS so let me know how you go. 1 Share this post Link to post Share on other sites
Gunter Severloh 4002 Posted November 20, 2018 1 hour ago, beno_83au said: You then only need to run it using as per the instructions above (nul = [_position,_direction,_vehicle,_type] execVM "MIL_CAS.sqf";). Thats what im asking about, run it how? Where do i put the code, in the players init, the mission's description, init.sqf, the localplayer.sqf, a trigger in the editor? 1 hour ago, beno_83au said: Running the .sqf once will call in one CAS strike. So as an example, if you're using it in an addAction just delete the action when you run it. I get what your saying to a point but idk how to implement that got to give me some details. Share this post Link to post Share on other sites
beno_83au 1369 Posted November 20, 2018 @Gunter Severloh Sorry mate, excuse the confusion. Safest way would be to run it server-side (e.g. initServer.sqf or a trigger that only runs on the server). I can give an example/explanation for that and a single use addAction but it'll have to wait until later. I'm just starting work now. Happy to help though. Share this post Link to post Share on other sites
beno_83au 1369 Posted November 21, 2018 @Gunter Severloh If you wanted to give a single, specific player the option to call in CAS once only, it would look something like this: if (player == CAS_player) then { _id = player addAction [ "Call CAS", { params ["_target","","_id"]; nul = [screenToWorld [0.5,0.5],90,"B_Plane_CAS_01_F",3] execVM "MIL_CAS.sqf"; _target removeAction _id; }, nil, 0, true, true, "", "alive _target", -1, false ]; }; Name the player you want to call in the CAS as CAS_player, then with this example run it from initPlayerLocal.sqf. That way when the mission starts ONLY the player named CAS_player will have the action added to them. The code in the addAction will have the player call in the CAS strike where the player's cursor is pointing (the ground, a building, whatever they're looking at) and then remove the action, so that they can't call it again. To change the parameters of the CAS, just edit this line in the addAction as described in the OP: nul = [screenToWorld [0.5,0.5],90,"B_Plane_CAS_01_F",3] execVM "MIL_CAS.sqf"; Does that fit with what you are trying to achieve? 1 1 Share this post Link to post Share on other sites
Gunter Severloh 4002 Posted November 21, 2018 Thanks for the added details, i like the concept but im interested in the interaction between the player and the pilot. With this concept i think the Bis support module for cas is a good start in terms of communication between player and pilot but i think the interaction could be a bit more enhanced for example: the player character will say requesting cas at this position then you have to mark the target, with an option, either with smoke, or with laser designator from there pilot needs to confirms target, once he confirms then you have option to tell him to use guns, guns, and missiles, just missiles or bomb the target. once you have made your choice then the pilot would confirm, then would ask you for the go or all clear to engage Once you give the ok to engage, he will respond with engaging, and then you would have to wait for him based on where he is at from the target. You could also add the option in there to get a status on how far away he is. Im after a bit of realism. I dont want to ask you to create a whole script and such from this idea, i mean what you have works already, i just want to enhance it a bit more. The addaction example works, and i like the fact that there is a real plane flying around that you can call for cas, but its to simple, i want to the player to do some work to get the cas support, i mean in a real fight, your calling in some serious support be it an a10 or another type of plane to come in and bomb or gun the shit out of your target, and thats not something you can really pull off yourself at that magnitude if you know what i mean. Lastly Still have it be called from the radio tho, addaction is cool but i like the idea if it were called from a radio, realism of it would add more immersion. 2 Share this post Link to post Share on other sites
beno_83au 1369 Posted November 21, 2018 4 hours ago, Gunter Severloh said: Im after a bit of realism. How realistic were you after? I can go pretty far in that regard, plus i also like realism (some of the other stuff I've released is based on realism). I'd leave this script alone though and just make a new one. Sounds like a good project to get into. Share this post Link to post Share on other sites
Gunter Severloh 4002 Posted November 22, 2018 18 hours ago, beno_83au said: How realistic were you after? Ideally for me it would be my example, calling from a radio or backpack radio either on you whereas you are acting as a Jtac. The interaction with your player character's voice and the pilot i think would really add to the immersion for calling in cas. The options for the type of cas too would make it interesting - helicopter, A10, guns, missiles, bombs, jdams, etc,. AC130 Gunship would be badass. Heres script i tried that is fairly realistic, but it doesn't have the voice aspect involved, check it out. http://www.armaholic.com/page.php?id=31949 1 Share this post Link to post Share on other sites
Alex Dyre 13 Posted January 24, 2021 Just wanted to add a little bit of info for others to this awesome script. At least for me, this does not work on a dedicated server. To run the MIL_CAS on a dedicated server you need to remote execute the function to the server as the BIS_fnc_moduleCAS will exit if not executed on the server. I call in CAS through radio triggers and the command looks something like this for it to work on a dedicated server. _tr3 setTriggerStatements ["this", "[[screenToWorld [0.5,0.5],getDir player, 'I_Plane_Fighter_03_dynamicLoadout_F', 3], 'MIL_CAS.sqf'] remoteExec['BIS_fnc_execVM',2];", ""]; Which uses the position of the terrain the player is looking at, and the direction the player is facing. 2 1 Share this post Link to post Share on other sites
Dyeg0 2 Posted July 17, 2021 On 1/23/2021 at 11:21 PM, Alex Dyre said: Just wanted to add a little bit of info for others to this awesome script. At least for me, this does not work on a dedicated server. To run the MIL_CAS on a dedicated server you need to remote execute the function to the server as the BIS_fnc_moduleCAS will exit if not executed on the server. I call in CAS through radio triggers and the command looks something like this for it to work on a dedicated server. _tr3 setTriggerStatements ["this", "[[screenToWorld [0.5,0.5],getDir player, 'I_Plane_Fighter_03_dynamicLoadout_F', 3], 'MIL_CAS.sqf'] remoteExec['BIS_fnc_execVM',2];", ""]; Which uses the position of the terrain the player is looking at, and the direction the player is facing. How did you do that? I'm trying to get this to work in Multiplayer, but getting nowhere so far. This is what I have at the moment: (calls gun run followed by a playsound3D and a 180 second cooldown with the hint to player to wait for the cooldown. works very well in singlepayer though) initPlayerServer.sqf if (playerunit == JTAC) then { _id = playerunit addAction [ "<t color='#FF0000'>Call for Gun Run</t>", { params ["_target","","_id"]; if (diag_tickTime < (uiNamespace getVariable ['tag_cooldown',-1])) exitWith { hint (format ['CAS Pilots are busy doing runs. Please wait %1 more seconds.',(round ((uiNamespace getVariable ['tag_cooldown',-1]) -diag_tickTime))]);}; _cooldown = 180; uiNamespace setVariable ['tag_cooldown',(diag_tickTime + _cooldown)]; nul = [screenToWorld [0.5,0.5],200,"B_Plane_CAS_01_F",0] execVM "MIL_CAS.sqf"; _soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; _soundToPlay = _soundPath + "sounds\radio4guns.ogg"; playSound3D [_soundToPlay,soundSource]; }, nil, 0, true, true, "", "alive _target", -1, false ]; }; Share this post Link to post Share on other sites
Harzach 2516 Posted July 17, 2021 3 hours ago, Dyeg0 said: This is what I have at the moment What is "playerunit" - where is it defined? Why are you using initPlayerServer.sqf ? Share this post Link to post Share on other sites
Dyeg0 2 Posted July 18, 2021 On 7/17/2021 at 6:03 PM, Harzach said: What is "playerunit" - where is it defined? Why are you using initPlayerServer.sqf ? Because I already tried other formats. It works well in SP, but not in MP. Originally, it was: player == JTAC (name of specific player). Also, before, it was in an initPlayerLocal (as MIL_SPEC had suggested up here), so I thought that this would work fine executed on initPlayerServer. I'm just trying to get it to work in MP, that's all. Share this post Link to post Share on other sites
Harzach 2516 Posted July 19, 2021 playerunit is not a command. Where are you defining it as a variable?initPlayerServer.sqf runs every time a player connects, and the code it contains is run on the server only. In SP/hosted that means it runs on the player's machine. In MP, it runs on the server. Also, the original code uses the command player: if (player == CAS_player) then { which does not exist on the server. Either of these may explain why it works for you in SP and not MP. If you are defining your variable playerunit in init.sqf then that would also explain it, as init.sqf runs before initPlayerServer.sqf in SP, but after it in MP. Share this post Link to post Share on other sites
beno_83au 1369 Posted July 19, 2021 @Dyeg0 Ok, I'm back baby, not that I actually went anywhere. So as Alex Dyre posted (and I'm sure I mentally noted to edit my OP, but then forgot), the module needs to be run from the server. So I'll talk towards that to start with. On 1/24/2021 at 3:21 PM, Alex Dyre said: To run the MIL_CAS on a dedicated server you need to remote execute the function to the server as the BIS_fnc_moduleCAS will exit if not executed on the server. One of the first lines of the module is: if (!isserver && {local _x} count (objectcurators _logic) == 0) exitwith {}; So that'll exit the module on a dedi server if run from a (non-curator) client. Easy way to get that to work on a dedi is just to do what Alex said (thanks Alex). Just remoteExec it to the server. And to keep it simple and make sure it's working for you, start simple (using a quick copy+paste from Alex's example): _id = player addAction [ "CAS", { private _target = screenToWorld [0.5,0.5]; nul = [[_target,200,"B_Plane_CAS_01_F",0],"MIL_CAS.sqf"] remoteExec ["BIS_fnc_execVM",2]; } ]; Run that from initPlayerLocal.sqf and see how it goes, then expand and see if anything @Harzach mentioned still needs to be addressed. 2 Share this post Link to post Share on other sites
pierremgi 4817 Posted August 4, 2021 Imho, the best way for adding an absolute path in MP is : getMissionPath Share this post Link to post Share on other sites
kibaBG 49 Posted November 16, 2022 Hi, I run the script from "radio" trigger: nul = [screenToWorld [0.5,0.5],90,"RHS_A10",2] execVM "MIL_CAS.sqf"; Is there any way to reduce the number of uses? Let's say the player can call CAS 5 times only? Share this post Link to post Share on other sites
beno_83au 1369 Posted November 21, 2022 On 11/17/2022 at 3:39 AM, kibaBG said: Is there any way to reduce the number of uses? Let's say the player can call CAS 5 times only? Yes. Simple way is to just declare a variable somewhere, then run a check each time you try to run the CAS and increment the variable each time it runs. Assuming this is single player (multiplayer is a bit different), and to keep it simple, in your player's Init field type: CAS_Runs = 0; You can put that variable in your init.sqf instead though if you have one. Then in the trigger you can check the variable and increment it each time the CAS runs: if (CAS_Runs < 5) then { nul = [screenToWorld [0.5,0.5],90,"RHS_A10",2] execVM "MIL_CAS.sqf"; CAS_Runs = CAS_Runs + 1; } else { deleteVehicle YourTriggerName; }; Then make sure your trigger is set to be repeatable and replace YourTriggerName with whatever you've called your trigger so that it gets deleted after it's final use. 1 1 Share this post Link to post Share on other sites
beno_83au 1369 Posted November 21, 2022 @kibaBG Sorry, the original example I gave you would've deleted the trigger the first time it ran 🙃 I edited it. Share this post Link to post Share on other sites
Hamster2k 0 Posted February 20, 2023 Hi there @beno_83au, thanks for making this small and easy script. We're trying to spawn in multiple aircraft at the same time, giving all of them different targets to attack. However, all spawned in planes go for the same target, even though we put in different positions as parameter. Is there something I can do to fix that? Or is this just the behavior of the BIS function and we're stuck with it? Cheers. Share this post Link to post Share on other sites
beno_83au 1369 Posted February 21, 2023 @Hamster2k I don't think it'd be the function, unless something has changed over time. You'll need to show your code though. Share this post Link to post Share on other sites
avibird 1 154 Posted February 21, 2023 @beno_83au can you use this and use the vanilla CAS together using your call for one group and the vanilla for a second group. Share this post Link to post Share on other sites