Jump to content
jsmith82

Counting Cfg Prop Equipment in Inventory

Recommended Posts

Stumped on this one.  In Eden, there are 2 key prop objects that can be placed in a scenario.

 

Equipment>Inventory Items>Keys (Item_Keys)

 

Equipment>Things>Tools>Keys (Land_Key_01_F)

 

I am spawning a set of the inventory usable “Item_Keys” in my scenario, and I’m able to pick them up, but my script is unable to count how many sets of keys I have in inventory.

 

Here is my code, no error, but no results:

 

_i = 0;

private _i = {_x == “Item_Keys”} count items player;

hint format [Keys: %1, _i];

 

I’ve used similar scripts to count helmets, guns, magazines but no combination of == TypeOf isKindOf or multiple types to count are turning results.

 

The wiki lists Item_Keys as CfgVehicle Props Equipment.

 

Any ideas what I’m doing wrong, or why these are seemingly unrecognizable?

Share this post


Link to post
Share on other sites

I found a solution, though it’s not very clean and I don’t understand why “items”, or something that checks uniform + vest + backpack isn’t working.

 

First thing is Item_Keys is actually referenced as “Keys”.

 

This works:

 

//start

test = 0;
_i = 0;

private _i = {_x == “Keys”} count uniformItems player;

test = test + _i;

private _i = {_x == “Keys”} count vestItems player;

test = test + _i;

private _i = {_x == “Keys”} count backpackItems player;

test = test + _i;

 

hint format [Keys: %1, test];

//end

 

I’m open to more fluid solutions if anyone can help.

Share this post


Link to post
Share on other sites

The "Keys" item is in fact NOT an item, but a magazine. The command items returns everything but magazines, while the uniform/vest/backpackItems commands do return magazines, which is why your second attempt worked.

 

Easier is to just use itemsWithMagazines, which returns everything.

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

×