Vehicle.holdPosition 41
The vehicle stays where it is, as a sentinel, within radius metres of its current position. Same as moveTo with the vehicle's own position.
Return value
| Return Type | Description |
|---|---|
| void | True if the order was given. False when a player is at the wheel, on planes, or when nobody is aboard. |
Parameters
| Parameter | Type | Description |
|---|---|---|
| 1 | Number | How far from the current position the vehicle may wander, in metres. Optional, 5 by default. |
Examples
Vehicle as a sentinel
-- the nearest tank to the crossroads parks there and guards it
local crossroads = vec3(412, 31, 870)
local tank = er2.getNearestVehicle(crossroads, 300)
if tank ~= nil then
if tank:moveTo(crossroads, 4) then
er2.print("The tank is moving to the crossroads")
end
end
-- later: let the crew follow its own orders again
-- tank:getLeader():getSquad():followLeader()