Comrades in Arms Discussion Board

Full Version: Check if item is in anyone's inventory
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hiya, I'm trying to make a following objective: the team must retrieve an intel item from a building and I cannot seem to find a way to check if the item is in someone's inventory.

I have been doing a lot of SELECT * FROM INTERNET; but haven't found a working solution. I've found this

Code:
intel_item1 in items player

(where intel_item1 is the object's given name) but that obviously don't work in MP and that would mean only the group leader holding the item counts. I've also tried this with my mad scripting skills

Code:
(({_x == "CUP_item_Cobalt_File"} count itemCargo november1) +
({_x == "CUP_item_Cobalt_File"} count itemCargo november2) +
({_x == "CUP_item_Cobalt_File"} count itemCargo november3) +
({_x == "CUP_item_Cobalt_File"} count itemCargo november4) +
({_x == "CUP_item_Cobalt_File"} count itemCargo november5) +
({_x == "CUP_item_Cobalt_File"} count itemCargo november6) +
({_x == "CUP_item_Cobalt_File"} count itemCargo november7) +
({_x == "CUP_item_Cobalt_File"} count itemCargo november8) +
({_x == "CUP_item_Cobalt_File"} count itemCargo november9) +
({_x == "CUP_item_Cobalt_File"} count itemCargo november10) ) > 0

(where novemberN are the playable/switchable units) and that works to some extend. It registers if anyone in the group picks up the item but stops working if even one member dies before the item is taken.

I'm not sure if
Code:
!alive intel_item1
works but that's not really an option because the item can be destroyed. Any tips, gentlemen? Smile
You might try the following as condition:



Code:
{alive _x && "CUP_item_Cobalt_File" in items _x} count [november1, november2, november3, november4, november5, november6, november7, november8, november9, november10] > 0
(03-15-2015, 04:39 PM)Alwarren link Wrote:You might try the following as condition:



Code:
{alive _x && "CUP_item_Cobalt_File" in items _x} count [november1, november2, november3, november4, november5, november6, november7, november8, november9, november10] > 0

Thank you very much, works like a charm!