{"name":"effectiveCommander","title":"effectiveCommander","type":"command","url":"https://community.bistudio.com/wiki/effectiveCommander","revid":369524,"updated":"2024-09-15T17:56:50Z","groups":["Unit Control"],"status":"ok","games":{"arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma1 1.00","arma3_since":"0.50","description":"Returns the effective commander of the vehicle. Effective commander is the player whom driver AI will listen to.\nSo if in a tank there is a gunner and a commander and AI driver, if the effectiveCommander is gunner, then gunner pressing <kbd>W</kbd> <kbd>A</kbd> <kbd>S</kbd> <kbd>D</kbd> will give AI orders to move.\nIf gunner jumps out and then enters a tank again, the effectiveCommander role most likely has changed to commander that remained in tank. Also the assignment seems to work on first come first served basis.","syntaxes":[{"syntax":"effectiveCommander vehicle","params":[{"name":"vehicle","type":"Object","type_expr":"Object"}],"returns":{"type":"Object","type_expr":"Object","description":"commander unit"},"form":"unary","right":{"text":"vehicle"}}],"examples":[{"text":"```sqf\n_unit = driver tank;\n_effectiveCommander = effectiveCommander _unit;                // returns the tank driver itself\n_effectiveCommander = effectiveCommander tank;                // returns the effective commander (commander or gunner or driver)\n_effectiveCommander = effectiveCommander vehicle _unit;        // identical to the one above - use vehicle if only the unit is known\n```","code":["_unit = driver tank;\n_effectiveCommander = effectiveCommander _unit;\t\t\t\t// returns the tank driver itself\n_effectiveCommander = effectiveCommander tank;\t\t\t\t// returns the effective commander (commander or gunner or driver)\n_effectiveCommander = effectiveCommander vehicle _unit;\t\t// identical to the one above - use vehicle if only the unit is known"]}],"see_also":["setEffectiveCommander","commander","driver","gunner","currentPilot","vehicleMoveInfo"]}