{"name":"playableUnits","title":"playableUnits","type":"command","url":"https://community.bistudio.com/wiki/playableUnits","revid":376985,"updated":"2026-01-01T07:13:32Z","groups":["Multiplayer","Object Detection"],"status":"ok","games":{"arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2 1.00","arma3_since":"0.50","description":"Returns a list of playable units in a multiplayer game (occupied by both AI or players), created on the following sides east/opfor, west/blufor, resistance/independent and civilian only.\nDoes not contain units of sideLogic.\n\n> [!NOTE]\n> This command returns an empty array in Singleplayer; use switchableUnits instead.\n\n> [!IMPORTANT]\n> This command does not include dead players awaiting for respawn.","syntaxes":[{"syntax":"playableUnits","params":[],"returns":{"type":"Array of Objects","type_expr":"Array<Object>"},"form":"nullary"}],"examples":[{"code":["{ _x groupChat \"I'm a playable unit.\"; } forEach playableUnits;"]},{"code":["_playableInGroup = units group player arrayIntersect playableUnits;"]},{"code":["_nonPlayableInGroup = units group player - playableUnits;"]}],"see_also":["playableSlotsNumber","allPlayers","allCurators","allGroups","allDead","switchableUnits","vehicles","allUnitsUAV","allDeadMen","isPlayer","playersNumber"],"notes":[{"user":"DreadedEntity","date":"2014-12-23T23:13:00Z","text":"To get a list of all player-controlled units:\n\n```sqf\n_allPlayers = [];\n{\n    if (isPlayer _x) then\n    {\n        _allPlayers pushBack _x;\n    };\n} forEach playableUnits;\n```"},{"user":"FR Starfox64","date":"2015-08-16T10:05:00Z","text":"playableUnits will not return dead players, use allPlayers instead."},{"user":"Pierre MGI","date":"2017-02-14T22:05:00Z","text":"Using the Editor (multiplayer attributes) for unchecking \"enable AI\", or disabling AI(s) in lobby, will make playableUnits as a public variable, updated by each JIP on disabled slot.\nSo, if all slots are disabled AI, playableUnits is same as allPlayers\nFurthermore, in this case, non-played slot (playable and disabled AI) units simply don't exist!\ni.e. If you name 8 playable units: u1..u8, then 2 players in game: u3 & u6\nplayableUnits will return [u3,u6], and true for isNil \"u1\", isNil \"u2\"... until another player takes the slot."}]}