VehicleHandlingScripts: Difference between revisions
Jump to navigation
Jump to search
(9 intermediate revisions by 2 users not shown) | |||
Line 9: | Line 9: | ||
===body=== | ===body=== | ||
[[VehicleScript.massCenterOverride | massCenterOverride]] | *[[VehicleScript.massCenterOverride | massCenterOverride]] | ||
[[VehicleScript.massoverride | massOverride]] | *[[VehicleScript.massoverride | massOverride]] | ||
[[VehicleScript.addgravity | addGravity]] | *[[VehicleScript.addgravity | addGravity]] - Applies extra gravity to the vehicle | ||
[[VehicleScript.tiltForce | tiltForce]] | *[[VehicleScript.tiltForce | tiltForce]] | ||
[[VehicleScript.tiltForceHeight | tiltForceHeight]] | *[[VehicleScript.tiltForceHeight | tiltForceHeight]] | ||
[[VehicleScript.counterTorqueFactor | counterTorqueFactor]] | *[[VehicleScript.counterTorqueFactor | counterTorqueFactor]] | ||
[[VehicleScript.keepUprightTorque | keepUprightTorque]] | *[[VehicleScript.keepUprightTorque | keepUprightTorque]] | ||
[[VehicleScript.maxangularvelocity | maxAngularVelocity]] | *[[VehicleScript.maxangularvelocity | maxAngularVelocity]] | ||
===engine=== | ===engine=== | ||
[[VehicleScript.horsepower | horsepower]] | *[[VehicleScript.horsepower | horsepower]] | ||
[[VehicleScript.maxrpm | maxRpm]] | *[[VehicleScript.maxrpm | maxRpm]] | ||
[[VehicleScript.maxspeed | maxSpeed]] | *[[VehicleScript.maxspeed | maxSpeed]] | ||
[[VehicleScript.maxRevSpeed | maxRevSpeed]] | *[[VehicleScript.maxRevSpeed | maxRevSpeed]] | ||
[[VehicleScript.axleRatio | axleRatio]] | *[[VehicleScript.axleRatio | axleRatio]] | ||
[[VehicleScript.throttleTime | throttleTime]] | *[[VehicleScript.throttleTime | throttleTime]] | ||
[[VehicleScript.gearCount | gearCount]] | *[[VehicleScript.gearCount | gearCount]] | ||
[[VehicleScript.gearRatio | gearRatio]] | *[[VehicleScript.gearRatio | gearRatio]] | ||
[[VehicleScript.shiftUpRPM | shiftUpRPM]] | *[[VehicleScript.shiftUpRPM | shiftUpRPM]] | ||
[[VehicleScript.shiftDownRPM | shiftDownRPM]] | *[[VehicleScript.shiftDownRPM | shiftDownRPM]] | ||
[[VehicleScript.boostForce | boostForce]] | *[[VehicleScript.boostForce | boostForce]] | ||
[[VehicleScript.boostDuration | boostDuration]] | *[[VehicleScript.boostDuration | boostDuration]] | ||
[[VehicleScript.boostDelay | boostDelay]] | *[[VehicleScript.boostDelay | boostDelay]] | ||
[[VehicleScript.boostMaxSpeed | boostMaxSpeed]] | *[[VehicleScript.boostMaxSpeed | boostMaxSpeed]] | ||
[[VehicleScript.autobrakeSpeedGain | autobrakeSpeedGain]] | *[[VehicleScript.autobrakeSpeedGain | autobrakeSpeedGain]] | ||
[[VehicleScript.autobrakeSpeedFactor | autobrakeSpeedFactor]] | *[[VehicleScript.autobrakeSpeedFactor | autobrakeSpeedFactor]] | ||
[[VehicleScript.torqueBoost | torqueBoost]] | *[[VehicleScript.torqueBoost | torqueBoost]] | ||
[[VehicleScript.isAutoTransmission | isAutoTransmission]] | *[[VehicleScript.isAutoTransmission | isAutoTransmission]] | ||
===steering=== | ===steering=== | ||
[[VehicleScript.degreesSlow | degreesSlow]] | *[[VehicleScript.degreesSlow | degreesSlow]] | ||
[[VehicleScript.degreesFast | degreesFast]] | *[[VehicleScript.degreesFast | degreesFast]] | ||
[[VehicleScript.degreesBoost | degreesBoost]] | *[[VehicleScript.degreesBoost | degreesBoost]] | ||
[[VehicleScript.steeringRateSlow | steeringRateSlow]] | *[[VehicleScript.steeringRateSlow | steeringRateSlow]] | ||
[[VehicleScript.steeringRateFast | steeringRateFast]] | *[[VehicleScript.steeringRateFast | steeringRateFast]] | ||
[[VehicleScript.steeringRestRateSlow | steeringRestRateSlow]] | *[[VehicleScript.steeringRestRateSlow | steeringRestRateSlow]] | ||
[[VehicleScript.steeringRestRateFast | steeringRestRateFast]] | *[[VehicleScript.steeringRestRateFast | steeringRestRateFast]] | ||
[[VehicleScript.speedSlow | speedSlow]] | *[[VehicleScript.speedSlow | speedSlow]] | ||
[[VehicleScript.speedFast | speedFast]] | *[[VehicleScript.speedFast | speedFast]] | ||
[[VehicleScript.turnThrottleReduceSlow | turnThrottleReduceSlow]] | *[[VehicleScript.turnThrottleReduceSlow | turnThrottleReduceSlow]] | ||
[[VehicleScript.turnThrottleReduceFast | turnThrottleReduceFast]] | *[[VehicleScript.turnThrottleReduceFast | turnThrottleReduceFast]] | ||
[[VehicleScript.brakeSteeringRateFactor | brakeSteeringRateFactor]] | *[[VehicleScript.brakeSteeringRateFactor | brakeSteeringRateFactor]] | ||
[[VehicleScript.throttleSteeringRestRateFactor | throttleSteeringRestRateFactor]] | *[[VehicleScript.throttleSteeringRestRateFactor | throttleSteeringRestRateFactor]] | ||
[[VehicleScript.powerSlideAccel | powerSlideAccel]] | *[[VehicleScript.powerSlideAccel | powerSlideAccel]] | ||
[[VehicleScript.boostSteeringRestRateFactor | boostSteeringRestRateFactor]] | *[[VehicleScript.boostSteeringRestRateFactor | boostSteeringRestRateFactor]] | ||
[[VehicleScript.boostSteeringRateFactor | boostSteeringRateFactor]] | *[[VehicleScript.boostSteeringRateFactor | boostSteeringRateFactor]] | ||
[[VehicleScript.steeringExponent | steeringExponent]] | *[[VehicleScript.steeringExponent | steeringExponent]] | ||
[[VehicleScript. | *[[VehicleScript.skidAllowed | skidAllowed]] | ||
[[VehicleScript.dustCloud | dustCloud]] | *[[VehicleScript.dustCloud | dustCloud]] | ||
===axle=== | ===axle=== | ||
A vehicle can have multiple axle definitions. | A vehicle can have multiple axle definitions. | ||
[[VehicleScript. | *[[VehicleScript.axle.offset | offset]] | ||
*[[VehicleScript.axle.wheelOffset | wheelOffset]] | |||
*[[VehicleScript.axle.raytraceCenterOffset | raytraceCenterOffset]] | |||
*[[VehicleScript.axle.raytraceOffset | raytraceOffset]] | |||
*[[VehicleScript.axle.torqueFactor | torqueFactor]] | |||
*[[VehicleScript.axle.brakeFactor | brakeFactor]] | |||
==== wheels ==== | |||
*[[VehicleScript.axle.wheels.radius | radius]] | |||
*[[VehicleScript.axle.wheels.mass | mass]] | |||
*[[VehicleScript.axle.wheels.inertia | inertia]] | |||
*[[VehicleScript.axle.wheels.damping | damping]] | |||
*[[VehicleScript.axle.wheels.rotdamping | rotdamping]] | |||
*[[VehicleScript.axle.wheels.frictionScale | frictionScale]] | |||
*[[VehicleScript.axle.wheels.materialIndex | materialIndex]] | |||
*[[VehicleScript.axle.wheels.brakeMaterialIndex | brakeMaterialIndex]] | |||
*[[VehicleScript.axle.wheels.skidMaterialIndex | skidMaterialIndex]] | |||
*[[VehicleScript.axle.wheels.springAdditionalLength | springAdditionalLength]] | |||
==== suspension ==== | |||
*[[VehicleScript.axle.suspension.springConstant | springConstant]] | |||
*[[VehicleScript.axle.suspension.springDamping | springDamping]] | |||
*[[VehicleScript.axle.suspension.stabilizerConstant | stabilizerConstant]] | |||
*[[VehicleScript.axle.suspension.springDampingCompression | springDampingCompression]] | |||
*[[VehicleScript.axle.suspension.maxBodyForce | maxBodyForce]] | |||
==vehicle_sounds Properties== | ==vehicle_sounds Properties== | ||
Line 69: | Line 91: | ||
===state=== | ===state=== | ||
[[VehicleScript.SoundState.Name | Name]]<br> | [[VehicleScript.SoundState.Name | Name]]<br> | ||
== Example == | |||
<pre> | |||
// 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" | |||
} | |||
</pre> | |||
[[Category:Scripting]] | [[Category:Scripting]] |
Latest revision as of 21:29, 6 July 2019
Empires Scripting Documentation |
Scripting Overview | Vehicle Script Overview | Vehicle Handling Script Overview | Weapon Script Overview | Armor Script Overview | Building Script Overview | Infantry Script Overview | Hint Messages | Loading Screen Script Overview | Tutorials |
Overview
Vehicle handling scripts have quite a few variables. This tries to describe the parameters you can use to fine tune vehicle handling.
Also see: https://developer.valvesoftware.com/wiki/Vehicles_(Scripting_Parameters)
vehicle Properties
body
- massCenterOverride
- massOverride
- addGravity - Applies extra gravity to the vehicle
- tiltForce
- tiltForceHeight
- counterTorqueFactor
- keepUprightTorque
- maxAngularVelocity
engine
- horsepower
- maxRpm
- maxSpeed
- maxRevSpeed
- axleRatio
- throttleTime
- gearCount
- gearRatio
- shiftUpRPM
- shiftDownRPM
- boostForce
- boostDuration
- boostDelay
- boostMaxSpeed
- autobrakeSpeedGain
- autobrakeSpeedFactor
- torqueBoost
- isAutoTransmission
steering
- degreesSlow
- degreesFast
- degreesBoost
- steeringRateSlow
- steeringRateFast
- steeringRestRateSlow
- steeringRestRateFast
- speedSlow
- speedFast
- turnThrottleReduceSlow
- turnThrottleReduceFast
- brakeSteeringRateFactor
- throttleSteeringRestRateFactor
- powerSlideAccel
- boostSteeringRestRateFactor
- boostSteeringRateFactor
- steeringExponent
- skidAllowed
- dustCloud
axle
A vehicle can have multiple axle definitions.
wheels
- radius
- mass
- inertia
- damping
- rotdamping
- frictionScale
- materialIndex
- brakeMaterialIndex
- skidMaterialIndex
- springAdditionalLength
suspension
vehicle_sounds Properties
A vehicle_sounds entry can have multiple of the following sections:
state
Example
// 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" }