MTA:Eir/functions/engineCreateLight
Jump to navigation
Jump to search
This function creates a RenderWare RpLight object. A light is an object that affects its surrouding RpAtomic instances in a certain radius and casts effects on them. The most notable effect is the pointlight, that colors its surroundings based on attenuation settings.
Syntax
rplight engineCreateLight ( string type )
Arguments
- type: decides which type that light should have, can be point, spot or spot_soft (currently only point works)
Returns
Returns the rplight object if creation was successful, false otherwise.
Example
Click to collapse [-]
ClientThis snippet creates a RenderWare light object and sets it up properly.
local light = engineCreateLight( "point" ); -- creates the new point light light.setColor(1, 1, 1, 1); -- gives the point light a bright color light.setAttenuation(0.8, 1.4, 4); -- makes the light fade somewhat light.setRadius(100); -- makes the light affect atomics in a 100 unit radius local lightFrame = engineCreateFrame(); -- create a 3D transformation for the light light.setParent( lightFrame ); -- attaches the light to its frame, the light can now be active in the world. light.addToScene(); -- activates the light object, so it illuminates its surroundings