countType: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(note)
m (Bot: Replacing category Scripting Commands Arma 3 with Arma 3: Scripting Commands)
Line 40: Line 40:


<h3 style="display:none">Bottom Section</h3>
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|COUNTTYPE]]
[[Category:Scripting Commands OFP 1.99|COUNTTYPE]]
[[Category:Scripting Commands OFP 1.96|COUNTTYPE]]
[[Category:Scripting Commands OFP 1.46|COUNTTYPE]]
[[Category:Scripting Commands ArmA|COUNTTYPE]]
[[Category:Command_Group:_Object_Information|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
<!-- CONTINUE Notes -->
<!-- CONTINUE Notes -->
<dl class="command_description">
<dl class="command_description">
Line 60: Line 49:
</dl>
</dl>
<!-- DISCONTINUE Notes -->
<!-- DISCONTINUE Notes -->
[[Category:Scripting Commands|COUNTTYPE]]
[[Category:Scripting Commands OFP 1.99|COUNTTYPE]]
[[Category:Scripting Commands OFP 1.96|COUNTTYPE]]
[[Category:Scripting Commands OFP 1.46|COUNTTYPE]]
[[Category:Scripting Commands ArmA|COUNTTYPE]]
[[Category:Command Group: Object Information|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Arma 3: Scripting Commands]]
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]

Revision as of 17:08, 3 December 2018

Hover & click on the images for description

Description

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.
Groups:
Uncategorised

Syntax

Syntax:
type countType objects
Parameters:
type: String - class type
objects: Array - array of Objects
Return Value:
Number

Examples

Example 1:
_count = "Tank" countType list _triggerOne;
Example 2:
_count = "B_medic_F" countType units player;

Additional Information

See also:
countisKindOftypeOfcountFriendlycountEnemycountSidecountUnknown

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Posted on April 23, 2007 - 16:34
Kronzky
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.)

Bottom Section

Posted on May 4, 2016 - 13:30 (UTC)
Killzone Kid
To complement Kronzky's note, if one needs to count exact types, countType is not suitable for this, use count instead: _count = {typeOf _x == "B_medic_F"} count units player;