unitReady: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 40: | Line 40: | ||
In consequence you can't just send vehicles around and check if they've arrived with something like: | In consequence you can't just send vehicles around and check if they've arrived with something like: | ||
waitUntil{(unitReady (driver _vehicle))}; | waitUntil{(unitReady (driver _vehicle))}; // don't do this! | ||
Because it's ''not guaranteed, that the driver is in command of the vehicle'' and only that unit will have it's unitReady status affected.<br> | Because it's ''not guaranteed, that the driver is in command of the vehicle'' and only that unit will have it's unitReady status affected.<br> |
Revision as of 21:28, 17 January 2011
Description
- Description:
- Check if the unit is ready. Unit is busy when it is given some command like move, until the command is finished.
- Groups:
- Uncategorised
Syntax
Examples
- Example 1:
_it = unitReady _soldierOne
Additional Information
- See also:
- See also needed
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
- Posted on August 26, 2010
- Rübe
-
Keep in mind that a) dead units are unitReady and b) that it takes a while until it get's known to group members that a unit is not alive anymore, which leads to c) the current leader of a group might be actually dead (until another group member takes command).
Why 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 :) - Rübe
-
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. While it's the driver unit for a truck, it is the gunner unit for a mg-jeep or the commander for a tank. Generally it's always the unit "in control" of the vehicle. (because it's only that unit, that is seen as "full unit" to the "outside world". Only he can be adressed with commands.)
In consequence you can't just send vehicles around and check if they've arrived with something like: waitUntil{(unitReady (driver _vehicle))}; // don't do this! Because it's not guaranteed, that the driver is in command of the vehicle and only that unit will have it's unitReady status affected.
So in conclusion, if you need to check if a vehicle is ready, try something like this:
_vehicleReady = { private ["_veh", "_ready"]; _veh = _this; _ready = true; { if (!(isNull _x)) then { _ready = _ready && (unitReady _x); }; } forEach [ (commander _veh), (gunner _veh), (driver _veh) ]; _ready };
Bottom Section
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint version 1.00
- Operation Flashpoint: New Scripting Commands
- Operation Flashpoint: Scripting Commands
- Command Group: Uncategorised
- Scripting Commands OFP 1.96
- Scripting Commands OFP 1.46
- Scripting Commands ArmA
- Scripting Commands ArmA2
- Scripting Commands VBS2