{"name":"hcSetGroup","title":"hcSetGroup","type":"command","url":"https://community.bistudio.com/wiki/hcSetGroup","revid":376359,"updated":"2025-10-07T21:40:53Z","groups":["High Command"],"status":"ok","games":{"arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2 1.00","arma3_since":"0.50","description":"Add group to unit's high command bar.\n\n> [!NOTE]\n> The previous HC leader should be removed before adding the new one (see **Example 3**).","syntaxes":[{"syntax":"unit hcSetGroup [group, groupName, team]","params":[{"name":"unit","type":"Object","description":"the leader","type_expr":"Object"},{"name":"group","type":"Group","type_expr":"Group"},{"name":"groupName","type":"String","optional":true,"type_expr":"String","text":"groupName: String - (Optional)"},{"name":"team","type":"String","optional":true,"default":"\"teamMain\"","description":"can be one of:\n\n- \"teamMain\"\n- \"teamRed\"\n- \"teamGreen\"\n- \"teamBlue\"\n- \"teamYellow\"","type_expr":"String","text":"team: String - (Optional, default \"teamMain\") can be one of:\n\n- \"teamMain\"\n- \"teamRed\"\n- \"teamGreen\"\n- \"teamBlue\"\n- \"teamYellow\""}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"unit"},"right":{"text":"[group, groupName, team]"}}],"examples":[{"code":["unit hcSetGroup [_group, \"HQ\", \"teamred\"];"]},{"code":["player hcSetGroup [_group];"]},{"text":"```sqf\nif (player != hcLeader _group) then\n{\n    hcLeader _group hcRemoveGroup _group;\n    player hcSetGroup [_group];\n};\n```","code":["if (player != hcLeader _group) then\n{\n\thcLeader _group hcRemoveGroup _group;\n\tplayer hcSetGroup [_group];\n};"]}],"see_also":["High Command","hcAllGroups","hcGroupParams","hcLeader","hcRemoveAllGroups","hcRemoveGroup","hcSelected","hcSelectGroup","hcShowBar","hcShownBar","onHCGroupSelectionChanged"]}