Jump to content
Sign in to follow this  
nikiller

increase recoil

Recommended Posts

hi,

I would like to find a way to restrict some weapons for some classes (i.e: medic/sniper) but in a "realistic" manner. Then I want to increase recoil to simulate the lack of train with certain weapon (i.e: a medic will have hard time to use a sniper rifle).

I found a command setUnitRecoilCoefficient but it works only for the first bullet fired and then go back to a normal recoil.

So I decided to make a script:

// increase recoil
// By Nikiller for RedLine 28/11/2014
sleep 0.001;
true spawn {
_snipers = ["B_sniper_F"];
_restrictedWeapons = ["srifle_GM6_F", "srifle_LRR_F", "srifle_LRR_camo_SOS_F"];

   waitUntil {player == player};

   _iamsniper = ({typeOf player == _x} count _snipers) > 0;

while {true} do {
_weaponClass = currentWeapon player;
	if ((!_iamsniper) && (_weaponClass in _restrictedWeapons)) then {
		hint "recoil Coefficient 50";
           player setUnitRecoilCoefficient 50;
	}
	else {
		if (!(_weaponClass in _restrictedWeapons)) then {
		hint "recoil Coefficient 1";
           player setUnitRecoilCoefficient 1;
		};
};
sleep 0.1;	
};
};

But I am not too sure it is good for performance to use this command in a loop.

I would like to know if there's a better way to increase recoil for some classes with some weapons.

Thank you.

cya.

Nikiller.

Share this post


Link to post
Share on other sites

It should be okay, but a cheap way to increase weapon sway and kind of simulate a lack of training would be to set a units fatigue level higher. setFatigue

Share this post


Link to post
Share on other sites

Thanks DreadedEntity, I think the setFatigue would be a better and more natural way and more performance friendly IMHO.

I updated my script with your suggestion and it works fairly well.

NB: The script is made for missions with enableFatigue false and no crosshair, if you want to use it with enableFatigue true and crosshair edit the script.

You can also add more classes in the _snipers and _restrictedWeapons arrays if you want.

// increase weapon sway to simulate lack of training
// By Nikiller for RedLine 28/11/2014
sleep 0.001;
true spawn {
_snipers = ["B_sniper_F"];
_restrictedWeapons = ["srifle_GM6_F", "srifle_LRR_F", "srifle_LRR_camo_SOS_F"];

   waitUntil {player == player};

   _iamsniper = ({typeOf player == _x} count _snipers) > 0;

while {true} do {
_weaponClass = currentWeapon player;
	if ((!_iamsniper) && (_weaponClass in _restrictedWeapons) && (cameraOn == player && cameraView == "GUNNER")) then {
		player enableFatigue true;
		player setFatigue 1;
	}
	else {
		if (!(_weaponClass in _restrictedWeapons) || (cameraOn == player && !(cameraView == "GUNNER"))) then {
		player enableFatigue false;
		player setFatigue 0;
		};
};
sleep .5;	
};
};

You can edit the script as you like but please credit me and write it is a modified version in the script header.

cya.

Nikiller.

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  

×