Improves ambient NPC traffic reactions around emergency vehicles with active sirens.
The resource runs client-side. Each player locally scans nearby player-driven emergency vehicles and gently retasks nearby NPC traffic to move away, pull right, slow down, or briefly hold position.
Place the resource in:
resources/[pulse]/pulse-ai-yield
If server.cfg already contains:
ensure [pulse]then the resource will start with the rest of the Pulse resources after a server restart.
For immediate testing:
ensure pulse-ai-yield- Detects nearby player vehicles with sirens on.
- Treats vehicle class
18as emergency by default. - Scans nearby NPC traffic from the game vehicle pool.
- Ignores player vehicles, emergency vehicles, empty vehicles, dead drivers, mission vehicles, and parked vehicles.
- Retasks NPC drivers with short cooldowns so the script does not spam AI tasks every frame.
Edit config.lua.
Important settings:
Config.ScanRadius = 115.0
Config.FrontConeDegrees = 130.0
Config.SideRadius = 42.0
Config.BehindRadius = 18.0
Config.RetaskCooldown = 2600
Config.PullRightDistance = 3.8
Config.PullForwardDistance = 18.0
Config.YieldSpeed = 4.5Useful tuning:
- Increase
ScanRadiusif traffic should react earlier. - Increase
SideRadiusif cross traffic should brake/hold earlier. - Lower
RetaskCooldownif NPCs feel slow to react. - Raise
RetaskCooldownif traffic looks twitchy. - Increase
PullRightDistanceslightly if same-direction vehicles are not clearing enough room. - Avoid enabling
AlwaysAvoidRadiusunless testing, because all-direction avoidance can make NPCs turn unpredictably.
Most proper police/EMS/fire vehicles should use GTA vehicle class 18.
If a custom emergency vehicle does not, add its spawn name:
Config.EmergencyModels = {
['polbuffalo'] = true,
['my_custom_ambo'] = true,
}This does not permanently rewrite GTA traffic AI. It applies short local tasks to NPC drivers around active emergency vehicles. That keeps it lightweight and avoids server-wide entity control issues, but behavior can still vary based on road layout, density, and GTA pathfinding.
If traffic overreacts, reduce ScanRadius, SideRadius, or raise RetaskCooldown.