EngineSetObjectGroupPhysicalProperty

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function sets physical property of given properties group.

Syntax

bool engineSetObjectGroupPhysicalProperty ( int groupID, objectgroup-modifiable property, var newValue )

Required Arguments

  • groupID: the id of physical properties group which you wish to set a property of.
  • objectgroup-modifiable: the property which you wish to set, as per table below.
  • newValue: new value of the property, with proper type as specified in table below

Returns

Returns true if everything went well, error is raised otherwise.

Properties

Physical properties

Property Type Description
mass float Mass of an object
turn_mass float Turn mass (kg m^3) of an object
air_resistance float Air resistance of an object
elasticity float Elasticity of an object
buoyancy float Buoyancy of an object
uproot_limit float How much force is needed to uproot the object
col_damage_multiplier float Force multiplier used when colliding with object
col_damage_effect DamageEffect Dictates which damage effect is applied to object on collision
special_col_response CollisionResponse Dictates how object responds to being collided with
avoid_camera bool Dictates whether camera passes throught the object
cause_explosion bool Dictates whether objects exploded upon collision
fx_type FxType Dictates when particles will be created when colliding with object
fx_offset Vector3D Offset from center of mass where particles will be created upon collision
fx_system FxEffect(string) Effect that will be used upon collision
smash_multiplier float Force multiplier when destroying object
break_velocity Vector3D Velocity and direction in which the object is destroyed
break_velocity_randomness float Randomness of velocity and direction in which the object is destroyed, 0 means that object uses break_velocity without any randomness
break_mode BreakMode Dictates how object can be damaged
sparks_on_impact bool Dictates whether object creates sparks upon impact

Damage effect

Effect Description
none Object doesn't change at all once it's damaged
change_model Some of the objects change model on collision, those use this
smash Object is smashed
change_smash First CHANGE_MODEL, afterwards smash on collision
breakable Object is breakable normally
breakable_remove object.dat says: '(ie. never regenerated after destroyed)'

Collision Response

Response Description
none Object doesn't respond in any special way
lamppost Objects acts like an lamp post
small_box -
big_box -
fence_part -
grenade -
swingdoor -
lockdoor -
hanging -
poolball -

Fx Type

Type Description
none No particles effect played on collision
play_on_hit Particles effect is played on collision, even if object isn't destroyed
play_on_destroyed Particles effect is played only once object is destroyed
play_on_hitdestroyed Particles effect is played both when hit and destroyed

Break Mode

Mode Description
not_by_gun not breakable by gun
by_gun -
smashable -

Fx Effect

effect Description
wallbust -
shootlight -
puke Puke effect
explosion_door -
explosion_crate Crate break
explosion_barrel Barrel explosion
blood_heli Heli cutting peds
tree_hit_palm -
tree_hit_fir -
water_swim Water ripples
water_splsh_sml -
water_splash_big -
water_splash -
water_hydrant -
tank_fire -
riot_smoke -
gunsmoke Gun smoke when firing
gunflash Gun flash when firing
explosion_tiny -
explosion_small -
explosion_molotov Molotov explosion
explosion_medium -
explosion_large -
explosion_fuel_car -
exhale -
camflash Camera photo flash
prt_wake Wake on water behind boats

Requirements

Minimum server version n/a
Minimum client version 1.5.7-9.19626

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.5.7-9.19626" />

Example

Click to collapse [-]
Client
function lamppostCollision()
engineSetObjectGroupPhysicalProperty(111, "cause_explosion", true)
end
addEventHandler("onClientResourceStart", resourceRoot, lamppostCollision)

--Every time you hit a lamppost, an explosion will be created

See Also