Jump to content

NPC HLC traffic modification


rain_gloom

Recommended Posts

Posted

What part should I change if I want only a few vehicles to achieve the following?

  • only 1-20 vehicles, but those are always "streamed", so they are always moving and are never destroyed (at least not for coding purposes)
    get (random) positions on the road
    add vehicles explicitly
    engage/disengage into/from traffic

it's kind of a huge resource, so I have no idea where should I begin...

thx in adv

My GitHub

function brain()   return nil end 
Posted

Traffic is created and destroyed in generate.lua file, spawnTrafficInSquare and despawnTrafficInSquare functions.

As for positions on road, you can look at load_paths.lua to see where the data is stored. conn_n1[connection_id] and conn_n2[connection_id] are the nodes where connection starts and ends and if it is bent around a node, that node is stored in conn_nb table.

The last thing you want to do, linking/unlinking the vehicles to/from traffic, is not something what this resource was designed for. Maybe you could achieve this if you did the same what is done on creation/removal of vehicles, minus the createVehicle/destroyElement calls (using already existing vehicle instead), but the resource itself is not well-designed overall because I was after speed, not flexibility when I was making it.

-

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...