Jump to content

Recommended Posts

Okay, I posted topic about "my" mod, and here's just explanation of one the element that I pretty proud of: jamming.

 

Basically: every weapon defined in CONGIF may use multiple magazine types, and if removed and added to soldier - it will instantly load highest magazine listed in it's definition.

 

Eg.

class Rifle

{

 magazines[]={"mag1","mag2","mag3"}

}

 

If solider has all three types of magazines and add him rifle - it will be instantaneously loaded with  "mag1".

 

Here starts magic:

I created two types of "Jamming" magazines to match weapons with single mode (M21) and two modes (M16A2, M14 etc.):

 

	class Jamming: Riffle
		{
		scopeWeapon=0;
		scopeMagazine=2;
		displayName="$STR_MN_Jamming";
		displayNameMagazine="$STR_MN_Jamming";
		shortNameMagazine="$STR_MN_Jamming";
		Count=1;
		ammo="Default";
		modes[]={"this"};
		canDrop = false;
		picture = "";
		magazineType="0*256";
		};
	class Jamming2: Jamming
		{
		modes[]={"this","this"};
		};

 

Then defined jamming in every weapon first magazine:

	class FAL:20rnd_762x51_FAL
		{
		[...]
		magazines[]={"Jamming2","20rnd_762x51_FAL"};
		modes[]={"Single","FullAuto"};
		};

 

Then created a script, running only on PLAYER (using it for AI would be pointless) that checks if weapon will get jammed at every shot:

_soldier = _this select 0
_weapon = _this select 1
_muzzle = _this select 2
_jam = random (100)

if (Time > 10) then {} else {goto"end"}

#M21
if (_muzzle in ["M21","M21_SD"]) then {} else {goto"M249"}
if (_jam < 0.3) then {goto"jam"} else {goto"end"}

[...]

#RPD
if (_muzzle in ["RPD"]) then {} else {goto"FAL"}
if (_jam < 0.25) then {goto"jam"} else {goto"end"}

#FAL
if (_muzzle in ["FAL"]) then {} else {goto"end"}
if (_jam < 0.4) then {goto"jam"} else {goto"end"}

goto "end"

#jam
_soldier addmagazine "jamming";
~0.1
_soldier removeweapon _weapon;
_soldier addweapon _weapon;
_soldier selectweapon _muzzle;
goto "end"

#jam2
_soldier addmagazine "jamming2";
~0.1
_soldier removeweapon _weapon;
_soldier addweapon _weapon;
_soldier selectweapon _muzzle;
goto "end"


#end
exit

 

For clearing the jammed weapon it was two options:

- just enable player to shoot with rest of bullets in his magazine (possible but complicated beyond usefulness)

- make him change magazine to full - easy and effective.

 

To clear jammed weapon player need to reload it twice - it seemed much more natural that using action-menu.

First reload will clear the weapon, second will load full mag.

animChanged = "if (((_this select 0) == PLAYER) and ((_this select 1) in [""combatreloadmagazine"",""crouchreloadmagazine"",""lyingreloadmagazine"",""handgunstandreloadmagazine"",""handguncrouchreloadmagazine"",""handgunlyingreloadmagazine""])) then {((_this select 0) removemagazines ""Jamming"") and ((_this select 0) removemagazines ""Jamming2"");nul}";

 

I suppose this may work also with Arma 1/2/3 weapons: so if anyone wish to use it: feel free. Just mention me in credits, as it's something I'm really and finally proud of :D

  • Like 4
  • Haha 1

Share this post


Link to post
Share on other sites

Nope, "jammed" is magazine, so:

- no you can't fire burst if jammed on single (or other way)

- yes, you can shoot grenade launcher if M16A2 is jammed ;)

 

That's pretty funny that weapon parameters are defined in magazine - but useful afterall.

 

Changing weapon to sidearm also won't change jamming status, but reloading sidearm would - that's by bad - I forgot to remove their animation from array :P

  • Like 1

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

×