Zum Inhalt springen
Driving Style Calculator

Driving Style Calculator

Build and decode the driving style integer for TaskVehicleDriveToCoord, TaskVehicleDriveWander and SetDriveTaskDrivingStyle, with every flag bit listed.

Diese Doku ist vorerst auf Englisch.

Open the tool Last updated

The Driving Style Calculator combines vehicle AI flags into the single integer the driving tasks expect, and decodes any value you find in someone else’s script. It also writes a ready Lua snippet for the task you pick, for the player’s own car or an NPC driver.

What it is for

A driving style is a 32-bit number where each bit switches one AI behaviour: stop for cars, obey lights, use shortcuts, drive in reverse. You pass it to TaskVehicleDriveToCoord, TaskVehicleDriveToCoordLongrange, TaskVehicleDriveWander, or change a running task with SetDriveTaskDrivingStyle. Guessing numbers like 786603 by hand is slow, and reading one back is worse. This tool does both directions.

Quick start

  1. Pick a Preset (the page opens on Normal, 786603) or tick the flags you want.
  2. Read the result in the Driving style panel: Decimal, Hex, Binary, plus Signed int32 when bit 31 is set.
  3. In Snippet options, choose the Task, the Driver (Player or NPC) and the Destination (Waypoint or Coords).
  4. Copy driving_style.lua from the code block under the calculator.

To decode, paste a value into Decode a value. It accepts decimal, negative int32, 0x hex, 0b binary and expressions like 1 | 2 | 128 (a + works as well). Underscores are ignored. The value is kept in the URL as ?v=, so you can share a link to it.

Flags

Bit Value Name What it does
0 1 StopForVehicles Brakes and waits behind vehicles in its way.
1 2 StopForPeds Stops for pedestrians on the road.
2 4 SwerveAroundAllVehicles Swerves around moving and stopped vehicles instead of waiting.
3 8 SteerAroundStationaryVehicles Steers around parked and empty vehicles.
4 16 SteerAroundPeds Steers around pedestrians instead of stopping.
5 32 SteerAroundObjects Steers around props on the road.
6 64 DontSteerAroundPlayerPed Does not steer around the player: stops or hits it.
7 128 StopAtTrafficLights Obeys red lights and stop lines.
8 256 GoOffRoadWhenAvoiding May leave the road to get around something.
9 512 AllowGoingWrongWay Uses oncoming lanes when its own lane is blocked.
10 1024 Reverse Drives the whole route in reverse.
11 2048 UseWanderFallbackInsteadOfStraightLine Wanders if no route is found, instead of a straight line.
12 4096 AvoidRestrictedAreas Keeps out of restricted zones.
13 8192 PreventBackgroundPathfinding Cruise tasks: no background re-planning.
14 16384 AdjustCruiseSpeedBasedOnRoadSpeed Cruise tasks: matches each road’s speed.
15 32768 Unknown15 No known effect.
16 65536 Unknown16 No known effect.
17 131072 Unknown17 No known effect.
18 262144 UseShortCutLinks Allows dirt tracks, alleys and other shortcut links.
19 524288 ChangeLanesAroundObstructions Changes lanes to pass slower traffic.
20 1048576 Unknown20 No known effect.
21 2097152 UseSwitchedOffNodes Routes over nodes switched off for traffic (goto tasks only).
22 4194304 PreferNavmeshRoute Navmesh pathing for off-road, roughly 200 m around the player.
23 8388608 PlaneTaxiMode Planes on a goto task taxi on the ground.
24 16777216 ForceStraightLine Ignores pathing, heads straight for the target.
25 33554432 UseStringPullingAtJunctions Cuts corners through junctions.
26 67108864 Unknown26 No known effect.
27 134217728 Unknown27 No known effect.
28 268435456 Unknown28 No known effect.
29 536870912 TryToAvoidHighways Avoids highways when there is another way.
30 1073741824 ForceJoinInRoadDirection Always joins a road in the direction of traffic.
31 2147483648 StopAtDestination Brakes to a stop at the destination.

Each flag row in the tool also shows older community names under “Also known as” (for example DF_StopForCars, or “Use blinkers” for bit 8). Unknown bits can be hidden with Show unknown bits. All on, All off and Invert work on the defined bits.

Presets

Preset Value
Normal 786603
Strict 262275
Ignore lights 786475
Avoid vehicles 786469
Reckless 786468
Avoid, obey lights 786597
Avoid, stop for peds, lights 786599
Rushed 1074528293
Off-road allowed 2883621
Avoid highways 537657515
Plough through 262144
Straight line 17039360

Under the flag list, Values used in Rockstar’s scripts holds 39 raw values from the decompiled scripts. Click one to load and decode it.

Snippet options

Option What it does Default
Task TaskVehicleDriveToCoord, TaskVehicleDriveToCoordLongrange, TaskVehicleDriveWander or SetDriveTaskDrivingStyle only TaskVehicleDriveToCoord
Driver Player uses your current vehicle (you must be the driver). NPC adds a SpawnDriver() function that spawns an adder with a_m_y_business_01 in front of you. Player
Destination Waypoint reads blip sprite 8, Coords uses the x, y, z fields. Only for the two goto tasks. Waypoint
Speed (m/s) Cruise speed, with km/h and mph shown under it. 20
Stop range (m) How close to the target the task ends. Goto tasks only. 8
Ability / Aggressiveness SetDriverAbility and SetDriverAggressiveness, 0.0 to 1.0. 1.0 / 0.0

Example

A trimmed version of what the tool writes for the Normal preset and a waypoint:

driving_style.lua
local drivingStyle = 786603
local speed = 20.0
local stopRange = 8.0

CreateThread(function()
    local ped = PlayerPedId()
    local vehicle = GetVehiclePedIsIn(ped, false)
    if vehicle == 0 or GetPedInVehicleSeat(vehicle, -1) ~= ped then return end

    local blip = GetFirstBlipInfoId(8) -- 8 = waypoint
    if not DoesBlipExist(blip) then return end
    local target = GetBlipInfoIdCoord(blip)

    SetDriverAbility(ped, 1.0)
    SetDriverAggressiveness(ped, 0.0)
    TaskVehicleDriveToCoord(ped, vehicle, target.x, target.y, target.z, speed, 0, GetEntityModel(vehicle), drivingStyle, stopRange, 1.0)
end)

Note

When bit 31 is set the snippet writes the negative signed value, for example local drivingStyle = -1073741824, with the unsigned number in a comment. Natives take the style as an int32, so this is correct.

Tips

  • Speed is metres per second. 20.0 is about 72 km/h.
  • NPC drivers react to gunfire and give up unless you call SetBlockingOfNonTemporaryEvents(ped, true). The NPC snippet does this and adds SetPedKeepTask.
  • Take control back from your own AI driving with ClearPedTasks(ped).
  • The yellow warning in the value panel means the value has bits with no known effect.

Limitations

The descriptions reflect what is known about each bit from the FiveM native docs and community testing. The calculator runs entirely in your browser.