{"name":"effectiveCommander","operator":null,"title":"effectiveCommander","type":"command","url":"https://community.bistudio.com/wiki/effectiveCommander","revid":369524,"updated":"2024-09-15T17:56:50Z","groups":["Unit Control"],"status":"ok","replaced_by":[],"games":[{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma1","name":"Armed Assault","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"vehicle","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"vehicle: Object"}],"returns":{"type":"Object","types":["Object"],"description":"commander unit","text":"Object - commander unit"},"form":"unary","operator":null,"left":null,"right":{"text":"vehicle","types":["Object"]}}],"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"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["setEffectiveCommander","commander","driver","gunner","currentPilot","vehicleMoveInfo"],"notes":[],"categories":["ArmA: Armed Assault: New Scripting Commands","ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Unit Control","Introduced with Armed Assault version 1.00","Scripting Commands","Take On Helicopters: Scripting Commands"]}