Leadwerks Game Engine

Leadwerks Game Engine

Not enough ratings
TrafficWerks 1.0
   
Award
Favorite
Favorited
Unfavorite
Type: Script
File Size
Posted
Updated
9.372 KB
28 Dec, 2014 @ 5:38pm
12 Jun, 2015 @ 8:08pm
8 Change Notes ( view )

Subscribe to download
TrafficWerks 1.0

Description
HELP WANTED! If you are interested in expanding this system or want to edit it in anyway, send me a message/post a comment, and then I can add you as a collaborator.

A vehicle traffic system for Leadwerks!

Important Note: While I am going to try to improve the system and add other features, this isn't the easiest asset to use. It can get quite complicated and there are many things that can go wrong. If you need help setting it up, post a comment or message me and I'll try my best to help. Generally, the most common errors will likely be nil pointer errors in that either a point (i.e. Point67) doesn't exist but something points to it or the global variables either conflict with other global variables you have or have not been initialized (i.e. copied/pasted from the app_dot_lua_header.lua file into App.lua as is said in the instructions below).

Required Workshop Items:
-"Vehicles" by Josh
-"CarDemo prefab (requires addon Vehicles installed)" by shadmar

Key features:
-Almost any type of road imaginable is possible
-Performance stays roughly constant no matter how many roads there are
-Adaptive turning means vehicles are less likely to miss turns
-Vehicles react to obstacles in front of them including other vehicles

Instructions:
-Copy everything in "app_dot_lua_header.lua" and paste it at the top of "App.lua" (above the Start method).
-Drag the prefab car into the scene.
-Make a few pivot points and name them "Pointx" where "x" is a number (i.e. "Point0," "Point1").
-Assign the "point.lua" script to them.
-In each pivot's script tab, change Choice 1. If you want more than one choice in direction, fill in Choice 2 and then Choice 3. These choices should be the number associated to each point (i.e. 1 for Point1, 0 for Point0)
-Create a new pivot and assign it the "carmap.lua" script.
-Make all of your points children of this carmap pivot.
-Make sure you set the "Start Goal" for each car prefab under the script tab.
10 Comments
Marcee3D 23 Apr, 2022 @ 1:48am 
I can help you, im interested in traffic infrastructure
chris.palusak 17 Apr, 2017 @ 4:40pm 
HOW DO I CONNECT A PIVIT SCRIPT TO A PLAYER LUA.SCRIPT. Trying to make health and armor bars for a hud.
nick.ace  [author] 1 Mar, 2015 @ 7:38pm 
I'm going to improve this in the near future. Right now the cars are probably going in reverse due to changes in the engine. I also need to fix a few things as well, and hopefully i'll have time to model a traffic light to add that in (the code works, but i want to also add a traffic light to show how that interacts with the code).
nick.ace  [author] 1 Jan, 2015 @ 10:18am 
Thanks! When did you download this last? I released an update about an hour ago that fixes this issue (I forgot to put an invisible texture variable in).
Dr Zoidberg 1 Jan, 2015 @ 10:17am 
First thanks, this add is just a must have and easy to use!
but i have a little probleme, the car work great but i have a big white box on the top and i don't know how to delet or hide this (sorry but i just begun on this engine so maybe it's a stupid question)
TheLightLOD 31 Dec, 2014 @ 4:33am 
Not that i was planning to use vehicles, but this looks pretty nice :)
._.Stashed Girl._. 31 Dec, 2014 @ 3:06am 
Holy sh***************t ! THANKS !!!!
shadmar 30 Dec, 2014 @ 12:29pm 
looks great! :)
nick.ace  [author] 29 Dec, 2014 @ 8:33am 
@Gengivas
Yeah, TrafficWerks is royalty free. It's based off of shadmar's prefab code, and extended quite a bit.
☢ Gengivas ☢ 29 Dec, 2014 @ 8:29am 
royalty free?