{"name":"unitReady","operator":null,"title":"unitReady","type":"command","url":"https://community.bistudio.com/wiki/unitReady","revid":378263,"updated":"2026-03-26T16:51:08Z","groups":["Unit Control"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"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":"ofp","name":"Operation Flashpoint","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Check if the unit is ready. Unit is busy when it is given some command like move, until the command is finished.","syntaxes":[{"syntax":"unitReady unitName","since":null,"effect":null,"exec":null,"params":[{"name":"unitName","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"unitName: Object"}],"returns":{"type":"Boolean","types":["Boolean"],"description":null,"text":"Boolean"},"form":"unary","operator":null,"left":null,"right":{"text":"unitName","types":["Object"]}}],"examples":[{"text":"```sqf\nprivate _isReady = unitReady _soldierOne;\n```","code":["private _isReady = unitReady _soldierOne;"]},{"text":"```sqf\nif (not unitReady _soldierOne) then\n{\n    _soldierOne groupChat \"Wait one, sarge!\";\n};\n```","code":["if (not unitReady _soldierOne) then\n{\n\t_soldierOne groupChat \"Wait one, sarge!\";\n};"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["move"],"notes":[{"user":"Rübe","date":"2010-08-26T03:55:00Z","text":"Keep in mind that\n- dead units are unitReady\n- it takes a while until it get's known to group members that a unit is not alive anymore, which leads to\n- the current leader of a group might be actually dead (until another group member takes command).\nWhy this is important? I'll give you an example: if you're using unitReady as a condition inside one of your fsm to advance whatever the fsm/group is doing, you really might wanna check that this unit is actually still alive. Otherwise you might end up with really fast and nasty loops in your FSM, eventually accompanied by a stream of radio commands that will last until finally a living leader is in command again.. and that could take a while... nasty, I tell you :)"},{"user":"Rübe","date":"2011-01-17T20:27:00Z","text":"Regarding vehicles, there is only one single unit (from the vehicle crew) whose unitReady-status is affected by giving that vehicle (or that unit) commands.\nWhile it is the driver unit for a truck, it is the gunner unit for a mg-jeep or the commander for a tank. Generally it is always the unit \"in control\" of the vehicle.\n(because it is only that unit, that is seen as \"full unit\" to the \"outside world\". Only he can be adressed with commands.)\n\nIn consequence you can't just send vehicles around and check if they've arrived with something like:\n\n```sqf\nwaitUntil { unitReady driver _vehicle }; // don't do this!\n```\n\nBecause it is *not guaranteed that the driver is in command of the vehicle* and only that unit will have its unitReady status affected.\n\nSo in conclusion, **if you need to check if a vehicle is ready**, try something like this:\n\n```sqf\n_vehicleReady = {\n    private [\"_veh\", \"_ready\"];\n    _veh = _this;\n    _ready = true;\n    {\n        if (not isNull _x) then\n        {\n            _ready = _ready && (unitReady _x);\n        };\n    } forEach [\n        commander _veh,\n        gunner _veh,\n        driver _veh\n    ];\n    _ready\n};\n```"},{"user":"Kastenbier","date":"2015-11-21T22:40:00Z","text":"To check readiness of a vehicle, don't check its crew, driver, gunner, commander, etc., but the vehicle itself, e.g.:\n\n```sqf\nunitReady _yourVehicle;\n```\n\nOnly tested 11/21/2015 by me with A2 1.63.131129 and A3 1.52.132676 but possibly true since 1964. :P"}],"categories":["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 Operation Flashpoint version 1.00","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Take On Helicopters: Scripting Commands"]}