Jump to content
Sign in to follow this  
masaker

Get information about weapon in SQF

Recommended Posts

How can i get for any weapon information about its compatible scopes, suppressors, accessories and bipods? And also I need get type of the weapon (primary, secondary, launcher). I already figured out how to get list of copatble magazines.

cfgWeapons = configFile >> "CfgWeapons";
magazinelist = getarray ((cfgWeapons select 187) >> "magazines");

Edited by Masaker

Share this post


Link to post
Share on other sites

You could open the editor and take a look in the config viewer but there is a simple way. Click HERE. There are all weapons sorted with their magazines and attachments.

Bipods are not in this list but they are pretty universal. Just choose the color and faction (NATO Bipods for NATO weapons and so on).

bipod_01_F_snd Bipod (Sand) [NATO]

bipod_01_F_blk Bipod (Black) [NATO]

bipod_01_F_mtp Bipod (MTP) [NATO]

bipod_02_F_blk Bipod (Black) [CSAT]

bipod_02_F_tan Bipod (Tan) [CSAT]

bipod_02_F_hex Bipod (Hex) [CSAT]

bipod_03_F_blk Bipod (Black) [AAF]

bipod_03_F_oli Bipod (Olive) [AAF]

Edited by max1944

Share this post


Link to post
Share on other sites
You could open the editor and take a look in the config viewer but there is a simple way. Click HERE. There are all weapons sorted with their magazines and attachments.

Bipods are not in this list but they are pretty universal. Just choose the color and faction (NATO Bipods for NATO weapons and so on).

bipod_01_F_snd Bipod (Sand) [NATO]

bipod_01_F_blk Bipod (Black) [NATO]

bipod_01_F_mtp Bipod (MTP) [NATO]

bipod_02_F_blk Bipod (Black) [CSAT]

bipod_02_F_tan Bipod (Tan) [CSAT]

bipod_02_F_hex Bipod (Hex) [CSAT]

bipod_03_F_blk Bipod (Black) [AAF]

bipod_03_F_oli Bipod (Olive) [AAF]

As handy as that info is, I think the OP is looking to source the information for scripting purposes (i.e. if weapon has attachment 'X' then a certain function is called or somesuch), but I could be wrong...

Share this post


Link to post
Share on other sites

Have a look in configfinder and you can see them like this example:

class arifle_MX_Base_F : Rifle_Base_F {
class WeaponSlotsInfo : WeaponSlotsInfo {
    class MuzzleSlot : MuzzleSlot {
        linkProxy = "\A3\data_f\proxies\weapon_slots\MUZZLE";
        compatibleItems[] = {"muzzle_snds_h"};
        iconPosition[] = {0, 0.45};
        iconScale = 0.2;
    };
    class CowsSlot : CowsSlot {
        iconPosition[] = {0.5, 0.35};
        iconScale = 0.2;
    };
    class PointerSlot : PointerSlot {
        iconPosition[] = {0.2, 0.45};
        iconScale = 0.25;
    };
    class UnderBarrelSlot : UnderBarrelSlot {
        iconPosition[] = {0.2, 0.7};
        iconScale = 0.2;
    };
};
};

So when going through the configs, you need to look for (configFile / "CfgWeapons"), then the name of the class, then "WeaponSlotsInfo", then for example "Muzzleslot" and finally "compatibleItems".

The items are in an array (a list) so you would do the following in script:

_myItems = getArray(configFile / "CfgWeapons" / "NAME_OF_GUN_HERE" / "WeaponSlotsInfo" / "MuzzleSlot" / "compatibleItems");

And in this case you would have ["muzzle_snds_h"] returned.

You could loop it and do something like:

_arr = [];
{
_myItems = getArray(configFile / "CfgWeapons" / "NAME_OF_GUN_HERE" / "WeaponSlotsInfo" / _x / "compatibleItems");
_arr = _arr + _myItems; // don't pushBack because array of array etc
} forEach ["MuzzleSlot","CowsSlot","PointerSlot","UnderBarrelSlot"];

Then all the items should be in _arr for you to do whatever with.

You might want to ask that in the editing section in future as you'll get a better response.

Hope that helps somewhat.

  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you. That helped me a lot. I have only one trouble now. I have problem to recognize if the item is compass, radio, GPS, map, or watch. They all have the same value of "type" variable in the config.

For example:

configfile >> "CfgWeapons" >> "ItemCompass" >> "type" == 131072
configfile >> "CfgWeapons" >> "ItemGPS" >> "type" == 131072
configfile >> "CfgWeapons" >> "I_UavTerminal" >> "type" == 131072

Edited by Masaker

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  

×