Asw vehicle jeep: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (added to asw entity list)
m (Changed parameters of {{this is a}} to comply with the updated version. This action was performed by a bot.)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Stub}}  
{{Stub}}  
[[Category:Alien Swarm Entities]]


{{this is a|point entity|game=Alien Swarm|name=asw_vehicle_jeep}}
== Entity description ==
This is basically the hl2 buggy, ported into alien swarm.  
This is basically the hl2 buggy, ported into alien swarm.  
It doesn't work in multiplayer because it spawns a dummy jeep vehicle as soon as it start thinking, when the client count is bigger than one.
It doesn't work in multiplayer because it spawns a dummy jeep vehicle as soon as it start thinking, when the client count is bigger than one.


{{todo | Add code segments.}}
{{todo|Add code segments.}}
 
== Keyvalues ==
{{KV BaseDriveableVehicle}}
 
== Inputs ==
{{I BaseDriveableVehicle}}
 
== Outputs ==
{{O BaseDriveableVehicle}}
 
== Enabling ==
The Buggy can work by adding a few missing files
being the buggy model and the jeep_test script file
 
Assuming you own HL2 or Hl2DM you can get the files from
 
'''source models.cfg''' (inside "Models")<br>
buggy.dx80.vtx<br>
buggy.dx90.vtx<br>
buggy.mdl<br>
buggy.phy<br>
buggy.sw.vtx<br>
buggy.vvd
 
'''source materials.cfg''' (inside "Materials/Models/Buggy")<br>
ammo_box.vmt<br>
ammo_box.vtf<br>
buggy001.vmt<br>
buggy001.vtf
 
put them into the relevent folders in Alien swarm\swarm
 
also copy the following and put it into alien swarm\swarm\scripts\vehicles
and call it jeep_test.txt
<source lang="cpp">
// This is a test jeep type vehicle for the wasteland
 
"vehicle"
{
"wheelsperaxle" "2"
"body"
{
"countertorquefactor" "1"
"massCenterOverride" "0 0 0"
"massoverride" "800" // kg
"addgravity" "0.33"
}
"engine"
{
"horsepower" "350"
"maxrpm" "3000"
"maxspeed" "35" // mph
"maxReverseSpeed" "20" // mph
"autotransmission" "1"
"axleratio" "4.56"
"gear" "1.86" // 1st gear
"gear" "1.59" // 2nd gear
"gear" "1.17" // 3rd gear
"gear" "1.0" // 4th gear
"gear" "0.84" // 5th gear
"shiftuprpm" "1500"
"shiftdownrpm" "300"
"boost"
{
// "force" "1.5" // 1.5 car body mass * gravity * inches / second ^ 2
"duration" "1.0" // 1 second of boost
"delay" "15" // 15 seconds before you can use it again
"torqueboost" "1" // enable "sprint" mode of vehicle, not force type booster
"maxspeed" "50" // maximum turbo speed
"force" "2.5" // use for value as a boost factor
}
}
"steering"
{
"degrees" "26"
"fastdampen" "0.35"
"slowcarspeed" "0"
"fastcarspeed" "40"
"slowsteeringrate" "4"
"faststeeringrate" "2"
"steeringRestFactor" "1.5"
"turnbrake" "0.25"
 
"skidallowed" "1"
"dustcloud" "1"
}
 
// front axle
"axle"
{
"wheel"
{
"radius" "18"
"mass" "100"
"inertia" "0.5" // steady the car (fixes the oscillation of the axles about z)
"damping" "0"
"rotdamping" "0.0"
"material" "jeeptire"
"skidmaterial" "slidingrubbertire"
"brakematerial" "brakingrubbertire"
}
"suspension"
{
"springConstant" "80"
"springDamping" "4"
"stabilizerConstant" "110"
"springDampingCompression" "4"
"maxBodyForce" "250"
}
 
"torquefactor" "0.8"
"brakefactor" "0.5"
}
 
// rear axle
"axle"
{
"wheel"
{
"radius" "20"
"mass" "100"
"inertia" "0.5" // steady the car (fixes the oscillation of the axles about z)
"damping" "0"
"rotdamping" "0.0"
"material" "jeeptire"
"skidmaterial" "slidingrubbertire"
"brakematerial" "brakingrubbertire"
}
"suspension"
{
"springConstant" "80"
"springDamping" "4"
"stabilizerConstant" "110"
"springDampingCompression" "4"
"maxBodyForce" "250"
}
"torquefactor" "0.2"
"brakefactor" "0.5"
}
}
 
"vehicle_sounds"
{
// List gears in order from lowest speed to highest speed
 
"gear"
{
"max_speed" "0.3"
"speed_approach_factor" "1.0"
}
 
"gear"
{
"max_speed" "0.5"
"speed_approach_factor" "0.07"
}
"gear"
{
"max_speed" "0.75"
"speed_approach_factor" "0.07"
}
"gear"
{
"max_speed" "0.90"
"speed_approach_factor" "0.035"
}
"gear"
{
"max_speed" "0.95"
"speed_approach_factor" "0.015"
}
"gear"
{
"max_speed" "2.0"
"speed_approach_factor" "0.03"
}
"state"
{
"name" "SS_START_WATER"
"sound" "ATV_start_in_water"
}
 
"state"
{
"name" "SS_START_IDLE"
"sound" "ATV_engine_start"
}
"state"
{
"name" "SS_SHUTDOWN_WATER"
"sound" "ATV_stall_in_water"
}
"state"
{
"name" "SS_IDLE"
"sound" "ATV_engine_idle"
}
"state"
{
"name" "SS_REVERSE"
"sound" "ATV_reverse"
"min_time" "0.5"
}
"state"
{
"name" "SS_GEAR_0"
"sound" "ATV_rev"
"min_time" "0.75"
}
"state"
{
"name" "SS_GEAR_0_RESUME"
"sound" "ATV_engine_idle"
"min_time" "0.75"
}
"state"
{
"name" "SS_GEAR_1"
"sound" "ATV_firstgear"
"min_time" "0.5"
}
"state"
{
"name" "SS_GEAR_1_RESUME"
"sound" "ATV_firstgear_noshift"
"min_time" "0.5"
}
"state"
{
"name" "SS_GEAR_2"
"sound" "ATV_secondgear"
"min_time" "0.5"
}
"state"
{
"name" "SS_GEAR_2_RESUME"
"sound" "ATV_secondgear_noshift"
"min_time" "0.5"
}
"state"
{
"name" "SS_GEAR_3"
"sound" "ATV_thirdgear"
"min_time" "0.5"
}
"state"
{
"name" "SS_GEAR_3_RESUME"
"sound" "ATV_thirdgear_noshift"
"min_time" "0.5"
}
"state"
{
"name" "SS_GEAR_4"
"sound" "ATV_fourthgear"
"min_time" "0.5"
}
"state"
{
"name" "SS_GEAR_4_RESUME"
"sound" "ATV_fourthgear_noshift"
"min_time" "0.5"
}
"state"
{
"name" "SS_SLOWDOWN_HIGHSPEED"
"sound" "ATV_throttleoff_fastspeed"
}
"state"
{
"name" "SS_SLOWDOWN"
"sound" "ATV_throttleoff_slowspeed"
}
"state"
{
"name" "SS_TURBO"
"sound" "ATV_turbo_on"
"min_time" "2.5"
}
"state"
{
"name" "SS_SHUTDOWN"
"sound" "ATV_engine_stop"
}
"crashsound"
{
"min_speed" "350"
"min_speed_change" "250"
"sound" "ATV_impact_medium"
"gear_limit" "1"
}
"crashsound"
{
"min_speed" "450"
"min_speed_change" "350"
"sound" "ATV_impact_heavy"
}
 
"skid_lowfriction" "ATV_skid_lowfriction"
"skid_normalfriction" "ATV_skid_normalfriction"
"skid_highfriction" "ATV_skid_highfriction"
}
 
</source>
 
After all thats done, in hammer on any map add asw_Vehicle_jeep
set the world model to the buggy
and make sure the vehicle script file is "scripts/vehicles/jeep_test.txt"
 
save and run the map
 
and finally make sure the following console commands are set<br>
asw_vehicle_cam_height 412<br>
asw_vehicle_cam_dist 60<br>
asw_vehicle_cam_pitch 60
 
you should now have a working yet pretty buggy..buggy!

Latest revision as of 18:02, 17 May 2024

Stub

This article or section is a stub. You can help by expanding it.

asw_vehicle_jeep is a point entity available in Alien Swarm Alien Swarm.

Entity description

This is basically the hl2 buggy, ported into alien swarm. It doesn't work in multiplayer because it spawns a dummy jeep vehicle as soon as it start thinking, when the client count is bigger than one.

Todo: Add code segments.

Keyvalues

BaseDriveableVehicle:

Starts locked (VehicleLocked) <boolean>
Players cannot enter vehicle until it is unlocked.

BaseVehicle:

Vehicle Script File (vehiclescript) <string>
The vehicle script files contained in scripts\vehicles\ define the behaviour and handling of a vehicle. It is important to match the right script to the right entity/model:
Scale of action input / framerate (actionScale) <float>
Todo: How fast the vehicle turns/accelerates?


Inputs

BaseDriveableVehicle:
HandBrakeOn
HandBrakeOff
Turns the handbrake on/off, preventing the vehicle from driving but not disabling motion from external forces.
BaseVehicle:
Action <floatRedirectInput/float>
Set the speed of the action animation.
Todo: What does this mean?
TurnOn
Start engine and enable throttle.
TurnOff
Stop engine, disable throttle, engage brakes.
Lock
Unlock
Prevent/allow the player from entering or exiting the vehicle.

Outputs

BaseDriveableVehicle:

PlayerOn <void>
PlayerOff <void>
!activator = the player
!caller = this entity
Player entered/exited the vehicle.
PressedAttack <void>
PressedAttack2 <void>
!activator = !caller = this entity
Player pressed the +attack/+attack2 key.
AttackAxis <floatRedirectOutput/float>
Attack2Axis <floatRedirectOutput/float>
!activator = the player when exitting the vehicle other-wise it's this entity
!caller = this entity
State of the attack/attack2 buttons (can only be 0 or 1). Also called when the player exits the vehicle.


Enabling

The Buggy can work by adding a few missing files being the buggy model and the jeep_test script file

Assuming you own HL2 or Hl2DM you can get the files from

source models.cfg (inside "Models")
buggy.dx80.vtx
buggy.dx90.vtx
buggy.mdl
buggy.phy
buggy.sw.vtx
buggy.vvd

source materials.cfg (inside "Materials/Models/Buggy")
ammo_box.vmt
ammo_box.vtf
buggy001.vmt
buggy001.vtf

put them into the relevent folders in Alien swarm\swarm

also copy the following and put it into alien swarm\swarm\scripts\vehicles and call it jeep_test.txt

// This is a test jeep type vehicle for the wasteland

"vehicle"
{
	"wheelsperaxle"	"2"
	"body"
	{
		"countertorquefactor"	"1"
		"massCenterOverride"	"0 0 0"
		"massoverride"		"800"		// kg
		"addgravity"		"0.33"
	}
	"engine"
	{
		"horsepower"		"350"
		"maxrpm"		"3000"
		"maxspeed"		"35"		// mph
		"maxReverseSpeed"	"20"		// mph
		"autotransmission"	"1"
		"axleratio"		"4.56"
		"gear"			"1.86"		// 1st gear
		"gear"			"1.59"		// 2nd gear
		"gear"			"1.17"		// 3rd gear
		"gear"			"1.0"		// 4th gear
		"gear"			"0.84"		// 5th gear
		"shiftuprpm"		"1500"
		"shiftdownrpm"		"300"
	
		"boost"
		{
//			"force"		"1.5"	// 1.5 car body mass * gravity * inches / second ^ 2
			"duration"	"1.0"	// 1 second of boost
			"delay"		"15"	// 15 seconds before you can use it again
			"torqueboost"	"1"	// enable "sprint" mode of vehicle, not	force type booster			
			"maxspeed"	"50"	// maximum turbo speed
			"force"		"2.5"	// use for value as a boost factor
		}
	}
	"steering"
	{
		"degrees"		"26"
		"fastdampen"		"0.35"
		"slowcarspeed"		"0"
		"fastcarspeed"		"40"
		"slowsteeringrate"	"4"		
		"faststeeringrate"	"2"
		"steeringRestFactor"	"1.5"
		"turnbrake"		"0.25"

		"skidallowed"		"1"
		"dustcloud"		"1"
	}

	// front axle
	"axle"
	{
		"wheel"
		{
			"radius"	"18"
			"mass"		"100"
			"inertia"	"0.5"		// steady the car (fixes the oscillation of the axles about z)
			"damping"	"0"
			"rotdamping"	"0.0"
			"material"	"jeeptire"
			"skidmaterial"	"slidingrubbertire"
			"brakematerial" "brakingrubbertire"
		}
		"suspension"
		{
			"springConstant"		"80"
			"springDamping"			"4"
			"stabilizerConstant"		"110"
			"springDampingCompression"	"4"
			"maxBodyForce"			"250"
		}

		"torquefactor"	"0.8"
		"brakefactor"	"0.5"
	}

	// rear axle
	"axle"
	{
		"wheel"
		{
			"radius"	"20"
			"mass"		"100"
			"inertia"	"0.5"		// steady the car (fixes the oscillation of the axles about z)
			"damping"	"0"
			"rotdamping"	"0.0"
			"material"	"jeeptire"
			"skidmaterial"	"slidingrubbertire"
			"brakematerial" "brakingrubbertire"
		}
		"suspension"
		{
			"springConstant"		"80"
			"springDamping"			"4"
			"stabilizerConstant"		"110"
			"springDampingCompression"	"4"
			"maxBodyForce"			"250"
		}
		"torquefactor"	"0.2"
		"brakefactor"	"0.5"
	}
}

"vehicle_sounds"
{
	// List gears in order from lowest speed to highest speed

	"gear"
	{
		"max_speed"		"0.3"
		"speed_approach_factor" "1.0"
	}

	"gear"
	{
		"max_speed"		"0.5"
		"speed_approach_factor" "0.07"
	}
	"gear"
	{
		"max_speed"		"0.75"
		"speed_approach_factor" "0.07"
	}
	"gear"
	{
		"max_speed"		"0.90"
		"speed_approach_factor" "0.035"
	}
	"gear"
	{
		"max_speed"		"0.95"
		"speed_approach_factor" "0.015"
	}
	"gear"
	{
		"max_speed"		"2.0"
		"speed_approach_factor" "0.03"
	}
	"state"
	{
		"name"		"SS_START_WATER"
		"sound"		"ATV_start_in_water"
	}

	"state"
	{
		"name"		"SS_START_IDLE"
		"sound"		"ATV_engine_start"
	}
	"state"
	{
		"name"		"SS_SHUTDOWN_WATER"
		"sound"		"ATV_stall_in_water"
	}
	"state"
	{
		"name"		"SS_IDLE"
		"sound"		"ATV_engine_idle"
	}
	"state"
	{
		"name"		"SS_REVERSE"
		"sound"		"ATV_reverse"
		"min_time"	"0.5"
	}
	"state"
	{
		"name"		"SS_GEAR_0"
		"sound"		"ATV_rev"
		"min_time"	"0.75"
	}
	"state"
	{
		"name"		"SS_GEAR_0_RESUME"
		"sound"		"ATV_engine_idle"
		"min_time"	"0.75"
	}
	"state"
	{
		"name"		"SS_GEAR_1"
		"sound"		"ATV_firstgear"
		"min_time"	"0.5"
	}
	"state"
	{
		"name"		"SS_GEAR_1_RESUME"
		"sound"		"ATV_firstgear_noshift"
		"min_time"	"0.5"
	}
	"state"
	{
		"name"		"SS_GEAR_2"
		"sound"		"ATV_secondgear"
		"min_time"	"0.5"
	}
	"state"
	{
		"name"		"SS_GEAR_2_RESUME"
		"sound"		"ATV_secondgear_noshift"
		"min_time"	"0.5"
	}
	"state"
	{
		"name"		"SS_GEAR_3"
		"sound"		"ATV_thirdgear"
		"min_time"	"0.5"
	}
	"state"
	{
		"name"		"SS_GEAR_3_RESUME"
		"sound"		"ATV_thirdgear_noshift"
		"min_time"	"0.5"
	}
	"state"
	{
		"name"		"SS_GEAR_4"
		"sound"		"ATV_fourthgear"
		"min_time"	"0.5"
	}
	"state"
	{
		"name"		"SS_GEAR_4_RESUME"
		"sound"		"ATV_fourthgear_noshift"
		"min_time"	"0.5"
	}
	"state"
	{
		"name"		"SS_SLOWDOWN_HIGHSPEED"
		"sound"		"ATV_throttleoff_fastspeed"
	}
	"state"
	{
		"name"		"SS_SLOWDOWN"
		"sound"		"ATV_throttleoff_slowspeed"
	}
	"state"
	{
		"name"		"SS_TURBO"
		"sound"		"ATV_turbo_on"
		"min_time"	"2.5"
	}
	"state"
	{
		"name"		"SS_SHUTDOWN"
		"sound"		"ATV_engine_stop"
	}
	"crashsound"
	{
		"min_speed"			"350"
		"min_speed_change"	"250"
		"sound"				"ATV_impact_medium"
		"gear_limit"		"1"
	}
	"crashsound"
	{
		"min_speed"			"450"
		"min_speed_change"	"350"
		"sound"				"ATV_impact_heavy"
	}

	
	"skid_lowfriction"		"ATV_skid_lowfriction"
	"skid_normalfriction"	"ATV_skid_normalfriction"
	"skid_highfriction"		"ATV_skid_highfriction"
}

After all thats done, in hammer on any map add asw_Vehicle_jeep set the world model to the buggy and make sure the vehicle script file is "scripts/vehicles/jeep_test.txt"

save and run the map

and finally make sure the following console commands are set
asw_vehicle_cam_height 412
asw_vehicle_cam_dist 60
asw_vehicle_cam_pitch 60

you should now have a working yet pretty buggy..buggy!