Community Forum

Vehicle Is Available

Forum Overview >> Farming Simulator 22

CategoryFarming Simulator 22
Created13.07.2023 18:45


Richard Whitehouse (rj_whitehouse) 13.07.2023 18:45
I'm trying to find out if a vehicle is available for "tasks". Whether it be by Courseplay, AutoDrive or AI worker. Doesn't necessarily matter if the user is using it, but if possible, then that can be included.

I've tried using isActive, but doesn't seem to be correct, and getIsActiveForInput seems to be returning null.

I could check whether it's moving, but if a vehicle is sat around waiting to empty out a combine etc, then this wouldn't be valid.

What's the best solution to work this out?


if g_currentMission and g_currentMission.enterables then
for _, foundVehicle in pairs(g_currentMission.enterables) do
-- is the vehicle being used by courseplay / autodrive / ai worker?

-- foundVehicle.getIsActiveForInput(true, true)
-- foundVehicle.isActive();
end
end


Thanks


Note: Log in to post. Create a new account here.