Check out my latest map:
demo.mp4
This is a CS2 cs_script to help create vehicles with minimal map setup
A demo map with vehicles is in maps folder
- You can create vehicles without any entity I/O
- You can have as many seats and place them where you want
- You can choose to ignore thruster of one or more directions
- Support for wheeled vehicles
- Support for steering wheels and similar
- Player is forced out of vehicle if another player tries to enter
- Input/Output interface
For updated script and more features, feel free to contact me
These entities must be placed in the map
Important
- You must either include a vehicle-specific prefix (i.e.,
{vehicle name}_) in the name of every vehicle/seat-specific entity or create a prefab containing all such entities without prefixes - Remember to set parents of entities as needed
point_script: To load the scriptProperty Value cs_script scripts/vscripts/func_vehicle.vjsfunc_tracktrain: Used as a floor for seats to prevent weapon spreadProperty Value Name func_vehicle_floorBrush a 32x32 (maybe less is needed) face with material tools/playerclipSolidity Always Solid point_template: Used to dynamically spawn seat floors and collision pair entitiesProperty Value Name func_vehicle_templateTemplate 1 seat floor entity Template 2... collision pair entities
logic_collision_pair: Used to disable collisions between occupant and vehicle wheelsProperty Value Attachment 1 vehicle wheel name/pattern Support multiple entities with same name ✅ (if using a pattern) Include Hierarchy ✅ Start with collisions disabled ✅
- Any VPhysics entity: Vehicle body
Property Value Name body phys_thruster/phys_torque(optional): Used to move the vehicle forward/backwardProperty Value Name forwardphys_thruster/phys_torque(optional): Used to move the vehicle right/leftProperty Value Name right
Entities used to provide vehicle- and seat-specific information to the script
You can add any number of entities you want or none that rotate around their axes on steering, this is necessary for tires and can allow for other entities like steering wheels
| Property | Value |
|---|---|
| Name | steer |
| Parent | steering entity |
| Use Local Transform | ✅ |
| Local Angles | Deviation on steering right |
- Any VPhysics entity: Wheels
func_tracktrain(optional): Used as an angular constraint anchor for steering wheels to steerProperty Value Name see here Parent vehicle body Spawnflags passable Brush anything with any invisible texture - Any angular constraint: Used to constarint steering wheels to angular anchor, only constraint x-axis and z-axis amgular motion
Property Value Attachment 1 angular anchor Attachment 2 wheels Treat Entity 1 as Infinite Mass ✅ No Collision Until Break ✅ - Any linear constraint: Used to constarint steering wheels to angular anchor, constraint all linear motion and set no collision until break
phys_hinge(optional): Used to constarint non-steering wheels to vehicle body, set hinge axis to wheel's side and set no collision until breaklogic_collision_pair(optional): Used to disable collisions between vehicle wheels and body hierarchiesProperty Value Attachment 1 vehicle body Attachment 2 vehicle wheel(s) name/pattern Support multiple entities with same name ✅ Include Hierarchy ✅
func_button: Used to enter vehicle into that seat, each seat should have a number where seat 0 is the driver's seatProperty Value Name seat{seat number}_button- Any entity: Entity whose origin is at the bottom of where the player should be when occupying that seat
Property Value Name seat{seat number}_in - Any entity (optional): Entity whose origin is at the bottom of where the player should be when unoccupying that seat
Property Value Name seat{seat number}_out
OnUser1is fired atseat*_inon entering, activator is the playerOnUser2is fired atseat*_inon exiting, activator is the player
- Vehicle will immediately slow down on touching any non-occupant player
Vehicle collision doesn't damage occupantsDriver orientation doesn't follow vehicle pitch and roll unless vehicle is considered undrivable due to its orientation being at specific roll and/or pitch, so driver can appear out of vehicleDriver doesn't follow the vehicle smoothly unless vehicle is considered undrivableWeapon spreadAll vehicles can rotate with same torque at any velocityCan't drive on a seat that goes through the ground