CS: Source Vehicles

Tutorial collection, comprehensive listings on main site.

CS: Source Vehicles

Postby Tutorial on Thu Mar 17, 2005 8:47 pm

category
Counter-Strike: Source

description
Vehicles are possible in CS: Source, not perfect but if you really want them try this out.

keywords
cs, source, counter, strike, counter-strike, vehicles, car, drive.

Image

In this pic you can see everything that will be needed. This was my attempt at adding in drivable golf carts. This was basically my test box for setting this up. I did borrow some of the setup from several other tut sites to come up with this model. This was for CS:S and not intended for HL2 in which there are greater steps to make a fully flyable/drivable car or plane. While this did not prove out wholly for me because of some details like riding in the car and how it is controled, maybe this tut will help you with some ideas. There is a plane tut for HL2 out there on some site and I will not be going into this in any detail. This tut assumes you have a understanding of mapping and using Hammer.

You can start by adding- (this is the basics for a test box)

1. A room or box for testing/playing.
2. A car for driving about.
3. 4 Thrusters, left, rigth, back, and forth.
4. A GameUI entity.
5. A funct_button.
6. Player starts.
7. 2 logic compares, right/left, back/forth.

Build a sealed room to drive around in. Make a car, it can be simple or complex, one or many brushes. You may want to make a backing or hole for the player to stand in to keep from getting tossed out. Make sure the car stays on grid. When done place a truster front and back, perfectly aligned with the center. For turning you may need to adjust for a turning radius by sliding along the length of car for the desired effect you want. I adjusted near the front to fake turning tires. Make any kind of brush you want for a button, this will be the activtion point. If you want to try riding the car you will need to place it near the car so you can use it. Place a GameUI in where you like in the map. I would place nearer the your button for ease of editing. Do the same for 2 logic compares, just place inside the map. Place a couple of player starts. Now for the hard part, tying it all together.

Func_button-

This allows you enter the GameUI
Open the properties and set the flags to Don't move and Use activates. For some reason I had toggled checked too, but I don't remember why or if it needed

Image

Select the Ouputs tab. Click on the Add button two times and fill out the three fields.

Add output OnIn, target gameUI, and Activate.
Add output OnOut, target gameUT, and Deactivate.

OnIn and OnOut tell the GameUI to start and stop when you use the button and exit by jumping or using again.

I added more OnOuts, deactivate, left,back,... to make sure the trusters were turning off, but you may not need them. You should not have to add or adjust any key values, since you don't want the button to
move.


The GameUI-

Image

The GameUI is what you enter to control the car.
Select the flags you need. You should use at least use one or both methods for exiting. I used hide weapon for testing to know when I entered the GameUI.

Add 2 Outputs-

XAxis, steer, SetValueCompare.
YAxis, gas, SetValuecompare.


The Car-

Image

Select all the brushes of your car and make a func_physbox out of it and name it in the keyvalues, name it car or something. You can play around with the other settings like to take damage to blow up or render modes, I never used so I can't tell you how this works.

The Thrusters-

Image

Open the proprerties on each truster and give it a name, like right, left, forward, back (the names are just tags and don't not effect whether the car goes that way) Point the angles in the direction you want the car to go (they should all point out from the car to provide thrust in that direction).

Select all the trusters at once and selct the Attached Object, and select the car. With all still selected open the flags and make sure Ingore Mass is checked or the car will never move. I used all the flag but the Start On, but you may need to pick and choose for your effect. In the Keyvalues field choose the Force and fill out for each one. I used 600 for front and back and 500 for left and right.


Logic Compare

Image

Open one of the Logic Compares. Name it gas in the Keyvalues.

Add 6 Outputs

OnEqualTo, back, Deactivate
OnEqualTo, forward, Deactivate
OnGreaterThan, back, Deactivate
OnGreaterThan, forward, Activate
OnLessThan, forward, Deactivate
OnLessThan, back, Activate

This is the setup to have the keyboard read your input for go back, forward, when nothing is press the trusters stop.

Open the other Logic compare. Name it steer in the Keyvalues.
Do the same as above but switch for left and right.


Compile and test. REMEMBER you are not driving the car simply because you can stand on it, you are actually in the GameUI. Plus you can fall out easily and the ride can be jerky. Also the car is sliding around not driving, would not recommend setting the phys_box to metal, noisy as hell. If you want a real BSP based car then you will have to the pod from HL2, which is not written into CS:S. This method only works so well for cars, so I would not hope to base a whole level on this. I tried to attach the button to the car but the car won't more and I tried to have the car use the gameUI, but it does not have the settings like the func_buttton has. If you can figure out how to be in the car and activate it then this would not be so bad. This should work for phys_rotate and phys_torque too in place of phys_thruster it you want to play with them.


Example Map

Slayera
- Don't send PM's to this user -
Tutorial
Not A Real User
 
Joined: Sun Mar 06, 2005 11:00 pm

Postby Dead-Inside on Thu Mar 17, 2005 9:04 pm

/me loves you.
User avatar
Dead-Inside
Veteran
Veteran
 
Joined: Wed Jan 05, 2005 4:15 pm
Location: Sweden (It's just as cold as you think it is)

Postby Schkye on Sun Mar 20, 2005 2:53 pm

Your the answer to my prayers :D.
Image
User avatar
Schkye
Dumpling
Dumpling
 
Joined: Sun Mar 20, 2005 2:30 pm

Postby Dead-Inside on Thu Apr 07, 2005 3:47 pm

I'll have sex with you soon.
User avatar
Dead-Inside
Veteran
Veteran
 
Joined: Wed Jan 05, 2005 4:15 pm
Location: Sweden (It's just as cold as you think it is)

Postby slayera on Thu Apr 07, 2005 10:49 pm

Bottoms up... JK. I like the wet pink tacos too much...
Image


"When one person suffers from a delusion it is called insanity. When many people suffer from a delusion it is called religion." -Robert Pirsig
User avatar
slayera
Veteran
Veteran
 
Joined: Wed Dec 08, 2004 3:15 am
Location: Near the world's only super volcano.

Postby M@sterT on Mon Jun 20, 2005 9:00 am

when you are in the car it wont turn 360 but when you drive it with out standing in the car in does a 360 easly anyway to fix it so it will turn around when you are in it
M@sterT
Regular
Regular
 
Joined: Wed Nov 10, 2004 10:13 pm

Postby pcgamer58 on Thu Jul 07, 2005 10:54 pm

I think theres a problem with my button or something cause i can only stay at the button for like 5 seconds before it becomes deactivated and i have to press use again to start controlling the car. Any ideas on waht would fix that?
pcgamer58
Just Joined
Just Joined
 
Joined: Thu Jul 07, 2005 10:52 pm

Postby swej on Tue Jul 19, 2005 12:21 pm

This method of making a vehicle is really more for making an RC car. You aren't driving the car, you are watching the car move while you stand still. The player needs to be in a hole for this to work and the car can only be activated from one stationary button in the map. I'm not saying this is the mappers fault because it has nothing to do with him. Valve decided css doesn't need the entity for vehicle. But on the brightside, this is the best attempt for making a vehicle that i have yet to see so far. What i originally searched for was a boat tutorial! I know that will never happen.
User avatar
swej
Regular
Regular
 
Joined: Tue Jul 19, 2005 2:21 am

Postby ZenMunky on Tue Jul 19, 2005 12:32 pm

You could, in theory, put a boat on a rail... or do the ol' invisible floor trick for the boat...
User avatar
ZenMunky
Pheropod
Pheropod
 
Joined: Sun Apr 17, 2005 3:31 am
Location: Running From The Unicycling Giant Screaming Purple Bunnies of Doom...

Postby swej on Tue Jul 19, 2005 12:36 pm

well fortunately physboxes float. So now i'm working with the author's example cart to make some type of boat. I originally wanted to make a boatseason type of map. I made a map called fy_divide a while ago and it was just two huts separated by a little river in the middle. I wanted to make the rivers extend around one side of the map on each end leading out to a big bay where there are jumps, and a target at the other end. This would be james bond equivalent! :o
User avatar
swej
Regular
Regular
 
Joined: Tue Jul 19, 2005 2:21 am

Postby Kr1ck3T on Wed Jul 27, 2005 5:33 pm

I REALLY NEED UR GUYS HELP!!!!!

Can u Please help me out, ... i did exactly what this tutorial said and it didnt work.

I can give u guys the file so u can look at it, ...


Email: kricket225@hotmail.com
Aim: www kr1ck3t com
MSN: Kricket225@hotmail.com


PLEASE HELP ME OUT!!!!!

Thanks alot,
Kr1ck3T
Kr1ck3T
Just Joined
Just Joined
 
Joined: Wed Jul 27, 2005 3:20 am

Postby G|a$sEater54 on Sat Jul 30, 2005 12:19 am

when i tried this my vehicle, when i pressed forward and left...went straight. and when forward and right, turned so fast it flipped..

heres a scrnshot ..this is what the thrusters looked like(edited to show up in 3D Mode)

Image
Image
I Am The Infection
I Am The Cure

Image
User avatar
G|a$sEater54
Member
Member
 
Joined: Sat Jul 02, 2005 7:37 pm
Location: Ontario, Canada

Postby ZenMunky on Wed Aug 03, 2005 9:02 am

This reminds me, must build that forklift...

What "strength" have you got those thrusters set to?
User avatar
ZenMunky
Pheropod
Pheropod
 
Joined: Sun Apr 17, 2005 3:31 am
Location: Running From The Unicycling Giant Screaming Purple Bunnies of Doom...

Postby slayera on Wed Aug 03, 2005 9:48 pm

Did you download the example file? You can copy the entities and paste into your map.

2nd I don't recommend you do this for a map you plan on releasing.
Image


"When one person suffers from a delusion it is called insanity. When many people suffer from a delusion it is called religion." -Robert Pirsig
User avatar
slayera
Veteran
Veteran
 
Joined: Wed Dec 08, 2004 3:15 am
Location: Near the world's only super volcano.

Postby jacc0s on Mon Sep 19, 2005 2:24 pm

i recommend u should parent the button to the brush vehicle :shock:
jacc0s
Member
Member
 
Joined: Sat Jul 23, 2005 5:54 pm
Next

Return to Tutorials

Who is online

Users browsing this forum: No registered users