Jump to content
Sign in to follow this  
reconteam

Script to edit properties on a vehicle's weapons

Recommended Posts

So I've been working on a scenario involving a ragtag squad with an M2A3 Bradley working their way across Takistan trying to get out of the country. I wanted to represent some unusual field modifications made to the M2A3 including boosting the rate of fire on the 25mm chain gun which would theoretically be possible with a more powerful electric motor. Would such a thing even be possible through scripting? Would it be possible to simulate any other changes? Maybe give the gunner's FLIR sight a green overlay which I think it has in real life?


Or is this all beyond the realm of possibility?

Share this post


Link to post
Share on other sites
3 hours ago, reconteam said:

So I've been working on a scenario involving a ragtag squad with an M2A3 Bradley working their way across Takistan trying to get out of the country. I wanted to represent some unusual field modifications made to the M2A3 including boosting the rate of fire on the 25mm chain gun which would theoretically be possible with a more powerful electric motor. Would such a thing even be possible through scripting? Would it be possible to simulate any other changes? Maybe give the gunner's FLIR sight a green overlay which I think it has in real life?


Or is this all beyond the realm of possibility?

 

You can use this to make a vehicle fire faster, setting the value to 1 means 100% rechambering time, set to 0.75 will make the vehicle fire 25% faster.

Needs to be applied for every shot fired so a fired EH is needed:

test addEventhandler ["Fired",{
	params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];

	_reloadTime = _unit getVariable ["TAG_fnc_fireRate",1];
     _unit setWeaponReloadingTime [_gunner, _muzzle, _reloadTime];
}];


test setVariable ["TAG_fnc_fireRate",0.75];//will fire 25% faster

At this point it's strongly advised to visit the wiki and check the script commands page individually, since, as you can see, the naming convention is absolutely bonkers (setWeaponReloadingTime actually changes the rechambering time, go figure).

You can easily go from there and filter only certain weapons on the vehicle to receive the increased firerate (simple if _muzzle = check should do).

 

Cheers

  • Like 2

Share this post


Link to post
Share on other sites

Thanks for the help, I must admit this is quite a bit more complicated than I thought. Do you have to find the correct parameter for each of those categories corresponding to the 25mm chain gun?

 

Seems weird that you can add an init line that reduces small arms recoil so easily yet boosting rate of fire is so complicated.

Share this post


Link to post
Share on other sites

Would anybody be willing to write an example script for me using one of the vanilla ArmA 3 vehicles such as the AMV-7 Marshall? I'm not quite certain how to account for the multiple magazine types necessary. (in this case it would be 40mm GPR and 40mm APFSDS)

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  

×