Jump to content
SteelShot

[SOLVED] Sub-filter inventory items by their ItemInfo type

Recommended Posts

So basically, I am writing my own loot script.

 

It works completely fine, I just have now to populate the loot arrays.

I am trying to make this 100% customizable, so every different item type has a different spawn chance.

For basic things like Primaries, Handguns or Launchers is simple ie.

_launchers = "getnumber (_x >> 'type') isEqualTo 4 AND getnumber (_x >> 'scope') isEqualTo 2" configClasses (configfile >> 'CfgWeapons');

But all items like for example uniform, vest or backpack share the same type 131072

But I would like to filter them out by their ItemInfo, because for example a Vest has ItemInfo >> Type = 701.

 

So I was thinking of doing something like this, but it does not work :/

_vests = "getnumber (_x >> ItemInfo >> 'type') isEqualTo 701 AND getnumber (_x >> 'scope') isEqualTo 2" configClasses (configfile >> 'CfgWeapons');

Any help would be really appreciated, Thanks.

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, gc8 said:

use BIS_fnc_itemType instead

 

Works perfectly, thanks @gc8

 

For the curious people

Spoiler

switch ((_item call BIS_fnc_itemType) select 1) do {
	case "Headgear": { _headgear_arr pushBack _item; };
	case "Vest": { _vests_arr pushBack _item; };
	case "Uniform": { _uniforms_arr pushBack _item; };
	case "Backpack": { _backpack_arr pushBack _item; };
	//And etc. etc...
	default { _other_arr pushBack _item; };
	
};

 

 

  • 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

×