SetModelHandling: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (They weren't optional) |
||
Line 5: | Line 5: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setModelHandling ( int modelId, | bool setModelHandling ( int modelId, string property, var value ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 09:33, 5 August 2014
This function is used to change the handling data of all vehicles of a specified model.
Syntax
bool setModelHandling ( int modelId, string property, var value )
Required Arguments
- modelId: The vehicle model you wish to set the handling of.
- property: The property you wish to set the handling of the vehicle to, or nil if you want to reset the all the handling properties.
- value: The value of the models's handling property you wish to set, or nil if you want to reset the handling property to its default value.
Returns
Returns true if the handling was set successfully, false otherwise.
Handling Properties
See below a list of valid properties and their required values:
http://web.archive.org/web/20140223160252/http://projectcerbera.com/gta/sa/tutorials/handling
Property | Value | Minimum value | Maximum value | Notes |
---|---|---|---|---|
mass | Float | 1.0 | 100000.0 | |
turnMass | Float | 0.0 | 1000000.0 | |
dragCoeff | Float | -200.0 | 200.0 | |
centerOfMass | Table = { [1]=posX, [2]=posY, [3]=posZ } (floats) | -10.0 | 10.0 | Get returns a table, set needs a table. |
percentSubmerged | Integer | 1 | 99999 | |
tractionMultiplier | Float | -100000.0 | 100000.0 | |
tractionLoss | Float | 0.0 | 100.0 | |
tractionBias | Float | 0.0 | 1.0 | |
numberOfGears | Integer | 1 | 5 | |
maxVelocity | Float | 0.1 | 200000.0 | |
engineAcceleration | Float | 0.0 | 100000.0 | |
engineInertia | Float | -1000.0 | 1000.0 | Inertia of 0 can cause a LSOD. (Unable to divide by zero) |
driveType | String | N/A | N/A | Use 'rwd', 'fwd' or 'awd'. |
engineType | String | N/A | N/A | Use 'petrol', 'diesel' or 'electric'. |
brakeDeceleration | Float | 0.1 | 100000.0 | |
brakeBias | Float | 0.0 | 1.0 | |
ABS | Boolean | true | false | Has no effect. |
steeringLock | Float | 0.0 | 360.0 | |
suspensionForceLevel | Float | 0.0 | 100.0 | |
suspensionDamping | Float | 0.0 | 100.0 | |
suspensionHighSpeedDamping | Float | 0.0 | 600.0 | |
suspensionUpperLimit | Float | -50.0 | 50.0 | Can't be equal to suspensionLowerLimit. |
suspensionLowerLimit | Float | -50.0 | 50.0 | Can't be equal to suspensionUpperLimit. |
suspensionFrontRearBias | Float | 0.0 | 1.0 | Hardcoded maximum is 3.0, but values above 1.0 have no effect. |
suspensionAntiDiveMultiplier | Float | 0.0 | 30.0 | |
seatOffsetDistance | Float | -20.0 | 20.0 | |
collisionDamageMultiplier | Float | 0.0 | 10.0 | |
monetary | Integer | 0 | 230195200 | Get works, set is disabled. |
modelFlags | Hexadecimal/Decimal | N/A | N/A | Property uses a decimal value, generated by a hexadecimal value. Either use 0x12345678 or tonumber ( "0x12345678" ). See projectcerbera for possible values. |
handlingFlags | Hexadecimal/Decimal | N/A | N/A | Property uses a decimal value, generated by a hexadecimal value. Either use 0x12345678 or tonumber ( "0x12345678" ). See projectcerbera for possible values. |
headLight | String | N/A | N/A | Get works, set is disabled. Available values: 'long', 'small', 'big', 'tall'. |
tailLight | String | N/A | N/A | Get works, set is disabled. Available values: 'long', 'small', 'big', 'tall'. |
animGroup | Integer | ?? | ?? | Get works, set is disabled due to people not knowing this property was vehicle-based and caused crashes. |
Example
Click to collapse [-]
ServerThis example script changes the handling of all Bullet.
function handlingChange() setModelHandling(541, "mass", 1890) setModelHandling(541, "turnMass", 3780) setModelHandling(541, "dragCoeff", 0.7) setModelHandling(541, "centerOfMass", {0.0, 0.1, -0.2} ) setModelHandling(541, "percentSubmerged", 75) setModelHandling(541, "tractionMultiplier", 0.70) setModelHandling(541, "tractionLoss", 0.90) setModelHandling(541, "tractionBias", 0.50) setModelHandling(541, "numberOfGears", 5) setModelHandling(541, "maxVelocity", 407) setModelHandling(541, "engineAcceleration", 50) setModelHandling(541, "engineInertia", 10) setModelHandling(541, "driveType", "awd") setModelHandling(541, "engineType", "petrol") setModelHandling(541, "brakeDeceleration", 11) setModelHandling(541, "brakeBias", 0.45) setModelHandling(541, "ABS", false) setModelHandling(541, "steeringLock", 30) setModelHandling(541, "suspensionForceLevel", 0.80) setModelHandling(541, "suspensionDamping", 0.20) setModelHandling(541, "suspensionHighSpeedDamping", 0.0) setModelHandling(541, "suspensionUpperLimit", 0.10) setModelHandling(541, "suspensionLowerLimit", -0.09) setModelHandling(541, "suspensionFrontRearBias", 0.5) setModelHandling(541, "suspensionAntiDiveMultiplier", 0.6) setModelHandling(541, "seatOffsetDistance", 0.3) setModelHandling(541, "collisionDamageMultiplier", 0.50) setModelHandling(541, "monetary", 1460000) setModelHandling(541, "modelFlags", 0xC0222004) setModelHandling(541, "handlingFlags", 0x1400000) setModelHandling(541, "headLight", 1) setModelHandling(541, "tailLight", 1) setModelHandling(541, "animGroup", 0) end addEventHandler("onResourceStart", resourceRoot, handlingChange)
This function will reset the handling of Bullet vehicles to its default state.
function resetHandling() for k,_ in pairs(getModelHandling(541)) do setModelHandling(541, k, nil) end end addEventHandler("onResourceStop", resourceRoot, resetHandling)
See other vehicle functions
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates