kuplion

[Release] Fix ASDG JR / CBA Attachment Compatibility at Traders

18 posts in this topic

Nothing too fancy here, just a quick edit to fix weapon/attachment compatibility at Traders when using ASDG JR. Thanks to @happydayz for answering my Qs and pointing me in the right direction when I was being a n00b.

ASDG JR Version:

ExileClient_util_gear_getCompatibleWeaponItems.sqf - Download Link or Copy and Paste:

/**
 * ExileClient_util_gear_getCompatibleWeaponItems
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * Modified by [FPS]kuplion
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_weaponClassName","_weaponConfig","_compatibleItems","_getcompatibleItems"];
_weaponClassName = _this;
_weaponConfig = configFile >> "CfgWeapons" >> _weaponClassName;
_compatibleItems = getArray (_weaponConfig >> "magazines");

/*
{
	if (isClass (_weaponConfig >> "WeaponSlotsInfo" >> _x)) then
	{
		_compatibleItems append getArray (_weaponConfig >> "WeaponSlotsInfo" >> _x >> "compatibleItems");
	};
}
forEach ["CowsSlot", "PointerSlot", "MuzzleSlot", "UnderBarrelSlot"];
*/

{
	_getcompatibleItems = [_weaponClassName] call asdg_fnc_compatibleItems;
	_compatibleItems append _getcompatibleItems;

}forEach [101,201,301,302];

{
	if !(_x isEqualTo "this") then
	{
		_compatibleItems append getArray (_weaponConfig >> _x >> "magazines");
	};
}
forEach getArray (_weaponConfig >> "muzzles");
{
	_compatibleItems set [_forEachIndex, toLower _x];
}
forEach _compatibleItems;
_compatibleItems

ExileClient_util_item_getCompatibleWeaponItems.sqf - Download Link or Copy and Paste:

/**
 * ExileClient_util_item_getCompatibleWeaponItems
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * Modified by [FPS]kuplion
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_weaponClassName","_weaponConfig","_compatibleItems","_getcompatibleItems"];
_weaponClassName = _this;
_weaponConfig = configFile >> "CfgWeapons" >> _weaponClassName;
_compatibleItems = getArray (_weaponConfig >> "magazines");

/*
{
	if (isClass (_weaponConfig >> "WeaponSlotsInfo" >> _x)) then
	{
		_compatibleItems append getArray (_weaponConfig >> "WeaponSlotsInfo" >> _x >> "compatibleItems");
	};
}
forEach ["CowsSlot", "PointerSlot", "MuzzleSlot", "UnderBarrelSlot"];
*/

{
	_getcompatibleItems = [_weaponClassName] call asdg_fnc_compatibleItems;
	_compatibleItems append _getcompatibleItems;

}forEach [101,201,301,302];

{
	if !(_x isEqualTo "this") then
	{
		_compatibleItems append getArray (_weaponConfig >> _x >> "magazines");
	};
}
forEach getArray (_weaponConfig >> "muzzles");
_compatibleItems

CBA Version:

ExileClient_util_gear_getCompatibleWeaponItems.sqf - Download Link or Copy and Paste:

/**
 * ExileClient_util_gear_getCompatibleWeaponItems
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Teamm
 *
 * Modified by [FPS]kuplion
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_weaponClassName","_weaponConfig","_compatibleItems","_getcompatibleItems"];
_weaponClassName = _this;
_weaponConfig = configFile >> "CfgWeapons" >> _weaponClassName;
_compatibleItems = getArray (_weaponConfig >> "magazines");

{
	_getcompatibleItems = [_weaponClassName] call CBA_fnc_compatibleItems;
	_compatibleItems append _getcompatibleItems;

}forEach [101,201,301,302];

{
	if !(_x isEqualTo "this") then
	{
		_compatibleItems append getArray (_weaponConfig >> _x >> "magazines");
	};
}
forEach getArray (_weaponConfig >> "muzzles");
{
	_compatibleItems set [_forEachIndex, toLower _x];
}
forEach _compatibleItems;
_compatibleItems

ExileClient_util_item_getCompatibleWeaponItems.sqf - Download Link or Copy and Paste:

/**
 * ExileClient_util_item_getCompatibleWeaponItems
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * Modified by [FPS]kuplion
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_weaponClassName","_weaponConfig","_compatibleItems","_getcompatibleItems"];
_weaponClassName = _this;
_weaponConfig = configFile >> "CfgWeapons" >> _weaponClassName;
_compatibleItems = getArray (_weaponConfig >> "magazines");

{
	_getcompatibleItems = [_weaponClassName] call CBA_fnc_compatibleItems;
	_compatibleItems append _getcompatibleItems;

}forEach [101,201,301,302];

{
	if !(_x isEqualTo "this") then
	{
		_compatibleItems append getArray (_weaponConfig >> _x >> "magazines");
	};
}
forEach getArray (_weaponConfig >> "muzzles");
_compatibleItems

Tested with a Black MXM in the screenshots.

Before:

UNMiMD8.jpg

After:

20Tdm9R.jpg

Installation

Exile.MapName/config.cpp example:

class CfgExileCustomCode 
{
	/*
		You can overwrite every single file of our code without touching it.
		To do that, add the function name you want to overwrite plus the 
		path to your custom file here. If you wonder how this works, have a
		look at our bootstrap/fn_preInit.sqf function.

		Simply add the following scheme here:

		<Function Name of Exile> = "<New File Name>";

		Example:

		ExileClient_util_fusRoDah = "myaddon\myfunction.sqf";
	*/
	
      // ASDG / CUP Compatible Gear
      ExileClient_util_gear_getCompatibleWeaponItems = "Custom\ASDGCompatibleGear\ExileClient_util_gear_getCompatibleWeaponItems.sqf";
      ExileClient_util_item_getCompatibleWeaponItems = "Custom\ASDGCompatibleGear\ExileClient_util_item_getCompatibleWeaponItems.sqf";
    
      // One or the other here, not both..      
          
      // CBA Compatible Gear
      ExileClient_util_gear_getCompatibleWeaponItems = "Custom\CBACompatibleGear\ExileClient_util_gear_getCompatibleWeaponItems.sqf";
      ExileClient_util_item_getCompatibleWeaponItems = "Custom\CBACompatibleGear\ExileClient_util_item_getCompatibleWeaponItems.sqf";
	
}; 

9qfBKkr.png

And copy the files to here:

WCnm7ou.png

Edited by kuplion
2 people like this

Share this post


Link to post
Share on other sites
{
	_getcompatibleItems = [_weaponClassName, _x] call asdg_fnc_compatibleItems;
	_compatibleItems append _getcompatibleItems;

}forEach [101,201,301,302];

You can change this to  (slightly faster)

[_weaponClassName] call asdg_fnc_compatibleItems;


Nice find/fix

Share this post


Link to post
Share on other sites
Advertisement
32 minutes ago, Torndeco said:

{
	_getcompatibleItems = [_weaponClassName, _x] call asdg_fnc_compatibleItems;
	_compatibleItems append _getcompatibleItems;

}forEach [101,201,301,302];

You can change this to  (slightly faster)


[_weaponClassName] call asdg_fnc_compatibleItems;


Nice find/fix

Thank you. I'll update it.

Someone else figured this out for CBA but I've just swapped it out for ASDG, but thank you. :)

Share this post


Link to post
Share on other sites
1 hour ago, ReddestOfRoses said:

sorry im amassive noob, but where exactly should i paste this?

Like this:

9qfBKkr.png

And:

WCnm7ou.png

Share this post


Link to post
Share on other sites

Once again @kuplion great work man. I always have players asking my admins/me why there is only a few attachments that work for each gun when there are tons of attachments to choose from. It's such a hassle explaining to them the whole ordeal. This is a very helpful/needed script that works flawlessly with all the mods that I have running. Mods with attachments/weapons I run are as follows: 

-FHQ Accessories 

-RHS: AFRF

-RHS: USAF

of course the Exile and Arma attachments/weapons work as well

10/10 :monkey:

 

1 person likes this

Share this post


Link to post
Share on other sites

OP updated to include CBA attachment fix too.

1 person likes this

Share this post


Link to post
Share on other sites
On 10/20/2016 at 4:46 AM, kuplion said:

OP updated to include CBA attachment fix too.

Doesnt work with CUP=( I am using CBA as well. I tested it... I took cup off and left cba on it seems to work fine, So something with cups Cfgs maby?

Edited by DIamond

Share this post


Link to post
Share on other sites
8 hours ago, DIamond said:

Doesnt work with CUP=( I am using CBA as well. I tested it... I took cup off and left cba on it seems to work fine, So something with cups Cfgs maby?

It should work with CUP unless they've drastically changed something, as I used to use this code with CUP.

I'll double check I've not made a mistake somewhere and get back to you.

EDIT: Just to confirm, is it the traders that aren't working, or compatibility when trying to attach a attachment to a weapon? Can you check whether the AMS (Black) shows as compatible (in the traders) with the Black MXM for you?

Edited by kuplion
1 person likes this

Share this post


Link to post
Share on other sites
9 hours ago, kuplion said:

It should work with CUP unless they've drastically changed something, as I used to use this code with CUP.

I'll double check I've not made a mistake somewhere and get back to you.

EDIT: Just to confirm, is it the traders that aren't working, or compatibility when trying to attach a attachment to a weapon? Can you check whether the AMS (Black) shows as compatible (in the traders) with the Black MXM for you?

I tried it and got this.    compatibility when trying to get a attach attachment to a weapon

http://images.akamai.steamusercontent.com/ugc/245836995517710794/DFCEB3F8C7C2829949D6D8819CB12AB880C32214/ 

Edited by DIamond

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.