Jump to content

Recommended Posts

14 hours ago, avibird 1 said:

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

 

I've never tried it together, but you probably can. All it does is run the module anyway so it should be the same as using the editor module multiple times. 

Share this post


Link to post
Share on other sites

this script is really good, but are other versions possible such as artillery and attack helicopter?

  • Like 1

Share this post


Link to post
Share on other sites

Thanks @Casio91Fin

 

There's a bunch of scripts out there that'll do artillery strikes. Probably not so many for helicopters but there'd be a few for sure.

 

But I didn't write anything for any of the other editor modules, sorry.

Share this post


Link to post
Share on other sites
12 hours ago, Casio91Fin said:

artillery

 

Just jumped on and grabbed an older artillery script of mine. I just rewrote it a bit but it should still work.

 

MIL_Bombardment.sqf

/*
Simple bombardment script to enhance immersion.

nul = [_round,_position,_area,_rpm,_condition] execVM MIL_Bombardment.sqf;

_round - STRING - projectile you want to use
_position - ARRAY - 2D position to bomb
_area - ARRAY - x,y dimensions of a circular area to bomb around _position
_rpm - NUMBER - roughly how many rounds per minute (some randomness in it)
OPTIONAL:
_condition - defaults to TRUE, change as needed

e.g. nul = ["Sh_82mm_AMOS",[10767,8686],[150,50],6] execVM MIL_Bombardment.sqf;
*/

params ["_round","_position","_area","_rpm",["_condition",true]];

while {_condition} do {
	private ["_impactPos","_bomb"];
	
	_time = 60 / _rpm;
	sleep ((_time - (_rpm / 2)) + (random _rpm));	//sleeps for random +/- 50% of _rpm
	
	_impactPos = [
		(_position select 0) - (_area select 0) + (random ((_area select 0) * 2)),
		(_position select 1) - (_area select 1) + (random ((_area select 1) * 2)),
		50
	];
	
	_bomb = _round createVehicle _impactPos;
	_bomb setVelocity [0,0,-50];
};

 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

@beno_83au Awesome script dude! How can I change condition so only 6 round will be shot? When run like this it shoots forever. 

 

nul = ["Sh_82mm_AMOS",(screenToWorld [0.5,0.5]),[150,50],6] execVM "MIL_Bombardement.sqf";

Update:

This is dumbed down, "back alley Frodo" version tweaked to shoot 6 round mortar barrage and end. I use it with radio trigger. 

params ["_round","_position","_area","_rpm"];

for "_i" from 1 to 6 do {
	private ["_impactPos","_bomb"];
	
	_time = 60 / _rpm;
	sleep ((_time - (_rpm / 2)) + (random _rpm));	//sleeps for random +/- 50% of _rpm
	
	_impactPos = [
		(_position select 0) - (_area select 0) + (random ((_area select 0) * 2)),
		(_position select 1) - (_area select 1) + (random ((_area select 1) * 2)),
		50
	];
	
	_bomb = _round createVehicle _impactPos;
	_bomb setVelocity [0,0,-50];
};

  

  • Like 1

Share this post


Link to post
Share on other sites

@kibaBG Use a variable in the condition parameter. Just declare a variable as true before you start the firing, then declare it as false to stop firing.

 

Where you've got the "6" is how many rounds per minute, not how many rounds total. So it'll keep firing 6 round per minute until the script is stopped.

 

But if your code works then you may as well use that. 

  • Like 2

Share this post


Link to post
Share on other sites
On 7/18/2021 at 9:12 PM, beno_83au said:

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.

 

I've successfully integrated this into an addAction of the player and have added some additional elements like comms and a random attack vector, but I think I've exceeded my ability in trying to get this to work with onMapClick.  Is anyone able to assist?  For now, I'm just running the above addAction in the Player's init, which is fine for testing.

 

@beno_83au thanks again for this script.  It's the gift that keeps on giving.  The fact that we don't have all of the attack options built into the vanilla CAS module is odd, but your script makes that a non-issue.

  • Like 1

Share this post


Link to post
Share on other sites

@gatordev

Try something like this in your addAction code:

openMap true;
onMapSingleClick "
	[[_pos,200,'B_Plane_CAS_01_f',0],'MIL_CAS.sqf'] remoteExec ['BIS_fnc_execVM',2];
	onMapSingleClick '';
	openMap false;
"

That should open the map, then run the CAS and close the map once you click on a position, but honestly it's been more than a while for me.

 

You don't need to define _pos here either as it gets defined when you click the map.

Share this post


Link to post
Share on other sites
On 2/14/2024 at 6:08 PM, beno_83au said:

@gatordev

Try something like this in your addAction code:


openMap true;
onMapSingleClick "
	[[_pos,200,'B_Plane_CAS_01_f',0],'MIL_CAS.sqf'] remoteExec ['BIS_fnc_execVM',2];
	onMapSingleClick '';
	openMap false;
"

That should open the map, then run the CAS and close the map once you click on a position, but honestly it's been more than a while for me.

 

You don't need to define _pos here either as it gets defined when you click the map.

 

 

Thank you!  Finally had a chance to sit down and mess with this.  I put my extra variables into it to zazz it up and everything works.  Here's what I added to randomize the attack vector.  I'm still not convinced BIS fixed the "random" command, as the attack run doesn't change much, but whatever...it works.  I'll mess with it some more.
 

 

_id = player addAction [ 
 "Call CAS Gun Run", 
 {  
  openMap true; 
onMapSingleClick " 
 [[_pos,random [270,335,359],'RHS_A10',0],'MIL_CAS.sqf'] remoteExec ['BIS_fnc_execVM',2]; 
 onMapSingleClick ''; 
 openMap false;
 gunRunTrigger=true; 
";
 }
]; 

 

I removed the _target variable in there.  I'm guessing that's not need now, correct?  It works without it.

 

Thanks again!

 

  • Like 1

Share this post


Link to post
Share on other sites
12 hours ago, gatordev said:

I removed the _target variable in there.  I'm guessing that's not need now, correct?

 

Correct, because it has been replaced by _pos which is defined by onMapSingleClick when you click on the map. 

  • Like 1

Share this post


Link to post
Share on other sites
10 hours ago, beno_83au said:

 

Correct, because it has been replaced by _pos which is defined by onMapSingleClick when you click on the map. 

 

That's what I figured, but wanted to confirm.  Also, it looks like when I widen the attack vector to a random 180 degrees, it becomes a little more random.

 

Thanks again!

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

×