Disable traffic in certain area

I need help disabling traffic from spawning in a certain area (the Elysian Island bridge). I am using a scene script to make the bridge broken, and thus I need to disable traffic from spawning where there is no road, or not drive off the bridge like idiots.

Can I disable NPC from spawning in a certain area (coords)? I wannt traffic to be alive in general throughout the city.

Haven’t tried but this looks interesting SetRoadsInArea else maybe the generator natives

SetRoadsInArea? Is’nt that for setting up roads?
I need to clear out traffic in a certain area. :slight_smile:

The native mentions

When this is set to false, all nodes in the area get disabled.

Ah, right. I gotta test this out… I am guessing it uses coords from A to B to control traffic.

Using the native above

1 Like

That’s brilliant! :slight_smile:
Would you mind posting that snippet you’re using, please?

SetRoadsInArea(
	vec3(1455.88, 762.5026, 73.21433), -- the corners of the area where I disabled traffic
	vec3(1543.358, 885.8956, 80.26099),
	false, -- set this to true to enable traffic in that area again
	false
)
3 Likes

Seems to work fine! Thanx a lot!

What is that localRestart command you are using? Does it restart the entire script-stack?

‘localRestart’ is to restart a ‘localGame’ script which allows you to script in singleplayer.

1 Like

In which file did you add these lines?
thanks

1 Like