View Full Version : spawn and kill moving cars

08-13-2010, 09:28 AM
I want to have moving cars in my city themed map.

I've already set up the tracks with func_tracktrain and path_track. But what I want now is that the cars spawn, drive to their destination, get killed and spawn again at the start.

So how is this done? You can also link me to a tutorial if you know a good one.

08-13-2010, 01:03 PM
You could try to loop one or more cars, having it teleport back to the start when it reaches the end (the path_track has the settings). Teleport to this path_track set on the first one (under flags), then set the last path_track to be connected to the first one. iirc. It can be limited and cause problems depending on how complicated your stuff is.

Alternatively you can...
Create 1 car with it parented to the tracktrain
Create a point_template and set the car you made as template 1. Usually set the flag no name fixup.
There are two ways to do the next part.
1. Use a logic_timer to tell the point_template to spawn the car. Make sure you have the car and/or template (I forget) at the location you want... which should probably be the middle of the tracktrain. Don't parent the point_template to anything.

OR 2. (more control with this one) Make an env_entity_maker, put it where you want the car to spawn and put the car and point template exactly on top of each other anywhere on the map. Setup the point_template in the env_entity_maker. You can make multiple env_entity_makers if you want multiple car locations, but not sure about parenting to different tracktrains. The env_entity_maker is NOT parented to anything. Second, you can set autospawn, autospawn when object is destroyed. This will automatically keep pumping out cars and wait for them to get destroyed before making a new one.

To kill the car you can setup a kill command at the final path_track.
I can give you example maps that show how it's done, if needed.