{"name":"countType","title":"countType","type":"command","url":"https://community.bistudio.com/wiki/countType","revid":379407,"updated":"2026-10-31T00:02:25Z","groups":["Object Detection"],"status":"ok","games":{"ofp":"1.00","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.00","arma3_since":"0.50","locality":{"argument":"global"},"description":"Count how many objects in the array are of given type. This command also works with parent classes like \"Air\", \"Tank\", and \"Car\". For a full class reference see Classes.","syntaxes":[{"syntax":"type countType objects","params":[{"name":"type","type":"String","description":"class type","type_expr":"String"},{"name":"objects","type":"Array of Objects","type_expr":"Array<Object>"}],"returns":{"type":"Number","type_expr":"Number"},"form":"binary","left":{"text":"type"},"right":{"text":"objects"}}],"examples":[{"code":["_count = \"Tank\" countType list _triggerOne;"]},{"code":["_count = \"B_medic_F\" countType units player;"]}],"see_also":["count","isKindOf","typeOf","countFriendly","countEnemy","countSide","countUnknown"],"notes":[{"user":"Kronzky","date":"2007-04-23T16:34:00Z","text":"This command can be used on the whole hierarchical class tree (i.e. when checking a HMMWV, one could test for \"HMMWV50\", \"Car\", \"LandVehicle\", etc.)"},{"user":"Killzone_Kid","date":"2016-05-04T13:30:00Z","text":"To complement Kronzky's note, if one needs to count exact types, countType is not suitable for this, use count instead:\n\n```sqf\n_count = {typeOf _x == \"B_medic_F\"} count units player;\n```"}]}