stoffl 13 Posted October 28, 2014 Hey there, I am currently working on a script for which I have to check the backpackcargo for uniforms. Everything works fine but I have one problem. I'd like to make the script compatible with all uniforms from any addon, vanilla, whatever, but I do not want to write a whitelist of all the classnames (which is hot it currently works). Hence my question is if there is a way to check if something is a uniform or not (or define a list of items that definitely are unforms for that matter). VAS and the virtual arsenal do it somehow, since you can filter them, but I can't figure out how they do it. Any help is appreciated Thanks in advance. Share this post Link to post Share on other sites
jshock 513 Posted October 28, 2014 Your going to have to follow the config directory to the class of "uniforms", I believe, and I don't have enough experience to give you a proper code line, but hopefully someone can follow up with one :p. Share this post Link to post Share on other sites
iceman77 19 Posted October 28, 2014 VAS and the virtual arsenal do it somehow, since you can filter them, but I can't figure out how they do it. Probably pull the items from the main config file. That would automatically load (most) addons you're running. To check if a unit has a backpack in his uniform { _bpCargo = getBackPackCargo uniformContainer player select 0; if ( count _bpCargo > 0 ) then { player sideChat format ["%1 has atleast one back pack in his uniform.", name _x]; }; } forEach allUnits; To pull an array of backpacks from the cfg private ["_cfgArray","_backPacks"]; _backpacks = []; _cfgArray = "( (getNumber (_x >> 'scope') >= 2) && {getText (_x >> 'vehicleClass') in ['Backpacks'] && {_backpacks pushBack ( configName _x ); true} } )" configClasses (configFile >> "CfgVehicles"); hint str _backPacks; Share this post Link to post Share on other sites
stoffl 13 Posted October 28, 2014 thanks, but I'm a bit confused. are you checking the uniform for backpacks or the backpack for uniforms? I basically just want to give out an array of all the uniforms a player has in his backpack. Share this post Link to post Share on other sites
iceman77 19 Posted October 28, 2014 (edited) Something like this. _uniforms = []; { _item = [_x] call BIS_fnc_itemType; if ( _item select 1 == "Uniform" ) then { _uniforms pushBack _x; //_uniforms pushBack ( typeOf _x ); }; } forEach (backPackItems player); Hope that helps. Report back and we go further if needed. Edited October 28, 2014 by Iceman77 Share this post Link to post Share on other sites
stoffl 13 Posted October 28, 2014 _uniforms = []; _uniformsType = []; { _itemType = [_x] call BIS_fnc_itemType; if ( _itemType select 1 == "Uniform" ) then { _uniforms pushBack _x; _uniformsType pushBack ( typeOf _x ); }; } forEach (backPackItems player); hint format["%1\n%2\n%3", _itemType, _uniforms, _uniformsType]; only gives me empty arrays Share this post Link to post Share on other sites
iceman77 19 Posted October 28, 2014 It works fine. player addbackPackGlobal "B_TacticalPack_blk"; player addItemToBackPack "U_B_CombatUniform_mcam"; _uniforms = []; { _item = [_x] call BIS_fnc_itemType; player sideChat format ["%1", _item]; // Outputs ["Equipment","Uniform"] if ( _item select 1 == "Uniform" ) then { _uniforms pushBack _x; //_uniforms pushBack ( typeOf _x ); }; } forEach (backPackItems player); player sideChat format ["%1", _uniforms]; // Outputs ["U_B_CombatUniform_mcam"] Share this post Link to post Share on other sites
stoffl 13 Posted October 29, 2014 thanks, it's working fine now. You've earned yourself a slot in the credits :) Share this post Link to post Share on other sites
iceman77 19 Posted October 29, 2014 No need to put me in the credits. Put the editing forum in the credits. Share this post Link to post Share on other sites