Jump to content
BobBrownB21

Changing a Pistol's properties so that it can be a Secondary or Launcher Slot

Recommended Posts

Hello all,

 

Sorry if this has been described before but I have been unable to find the script for it.  On my server, I'm trying to setup a taser (which is ID'd as a pistol) in the launcher slot so that officers can easily switch between their pistol and the taser.  How would I go about changing the properties of the taser in order to get it in the launcher or "secondary" slot?   The extent of my abilities are to extract the taser's config file in order to edit it.  I don't really know where else to go from there.  

 

Thanks in advance for your help.

Share this post


Link to post
Share on other sites

Not possible with scripts but with editing the config. Maybe move the thread here: https://forums.bohemia.net/forums/forum/162-arma-3-addons-configs-scripting/

Also: secondary and launcher slot are the same thing. Rifle = primary, launcher = secondary, pistol = handgun.

 

As far as I know there is a config entry "allowedSlots" which describes where you can put the item but that's not my field of expertise.

Share this post


Link to post
Share on other sites

Similar question here. Although as @7erra says requires a mod, and also comes with its own problems.

 

Maybe use a key event and just swap the pistol instead.

  • Like 1

Share this post


Link to post
Share on other sites
15 hours ago, Larrow said:

 

 

Maybe use a key event and just swap the pistol instead.

 

Would you mind explaining this part?

  • Like 1

Share this post


Link to post
Share on other sites
11 hours ago, BobBrownB21 said:

Would you mind explaining this part?

 

player setVariable[ "tazer", "hgun_Rook40_F" ]; //Replace with tazer class name
player setVariable[ "pistol", handgunWeapon player ];

findDisplay 46 displayAddEventHandler[ "KeyUp", {
	params[ "_display", "_keyCode", "_shft", "_ctr", "_alt" ];
	
	if ( _keyCode isEqualTo 0x16 ) then { //DIK_U
		_weapon = if ( handgunWeapon player isEqualTo ( player getVariable "pistol" ) ) then {
			player getVariable "tazer";
		}else{
			player getVariable "pistol";
		};
		[ _weapon ] spawn {
			params[ "_weapon" ];
			player addWeapon _weapon;
			waitUntil{ player hasWeapon _weapon };
			player selectWeapon _weapon;
		};
	};
}];

Of course needs tidying, allowing player to set their own key, allowing swap weapon anim to play, inventoryClosed EH to update any change to players hand gun etc,  just to get idea across.

  • Like 1

Share this post


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

 


player setVariable[ "tazer", "hgun_Rook40_F" ]; //Replace with tazer class name
player setVariable[ "pistol", handgunWeapon player ];

findDisplay 46 displayAddEventHandler[ "KeyUp", {
	params[ "_display", "_keyCode", "_shft", "_ctr", "_alt" ];
	
	if ( _keyCode isEqualTo 0x16 ) then { //DIK_U
		_weapon = if ( handgunWeapon player isEqualTo ( player getVariable "pistol" ) ) then {
			player getVariable "tazer";
		}else{
			player getVariable "pistol";
		};
		[ _weapon ] spawn {
			params[ "_weapon" ];
			player addWeapon _weapon;
			waitUntil{ player hasWeapon _weapon };
			player selectWeapon _weapon;
		};
	};
}];

Of course needs tidying, allowing player to set their own key, allowing swap weapon anim to play, inventoryClosed EH to update any change to players hand gun etc,  just to get idea across.



Where would be the best place to apply this script?  init?

Share this post


Link to post
Share on other sites

initPlayerLocal.sqf as its only needed by a player.

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

×