CreateLight

From Multi Theft Auto: Wiki
Revision as of 16:27, 11 February 2015 by AlexTMjugador (talk | contribs) (Changed version from 1.4.0 to 1.5 (it wasn't implemented in 1.4))
Jump to navigation Jump to search

Accessories-text-editor.png Script Example Missing Function CreateLight needs a script example, help out by writing one.

Before submitting check out Editing Guidelines Script Examples.


This function creates a 3D light to the world.


[[{{{image}}}|link=|]] Note:
  • The direction of the light affects the light behavior only if the light type is spot light.
  • One light will only apply the illumination multiplier to peds, wheels and number plates - as seen here.
  • Two and more lights will apply the illumination multiplier to everything - as seen here.

Syntax

light createLight ( int lightType, float posX, float posY, float posX, [ float radius = 3, int r = 255, int g = 0, int b = 0, float dirX = 0, float dirY = 0, float dirZ = 0, bool createsShadow = false ] )

OOP Syntax Help! I don't understand this!

Method: Light(...)


Required Arguments

  • lightType: An integer representing the type of light to create.
    • 0: Point light, which illuminates surroundings evenly across the light radius.
    • 1: Spot light, which illuminates the direction of the light defined by dirX, dirY and dirZ.
    • 2: Dark light, which darkens its surrounding elements to full black.
  • x: A floating point number representing the X coordinate on the map.
  • y: A floating point number representing the Y coordinate on the map.
  • z: A floating point number representing the Z coordinate on the map.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • radius: A floating point number representing the radius of the light.
  • r: An integer number representing the amount of red to use in the colouring of the light (0 - 255).
  • g: An integer number representing the amount of green to use in the colouring of the light (0 - 255).
  • b: An integer number representing the amount of blue to use in the colouring of the light (0 - 255).
  • dirX: A floating point number representing the light direction's X coordinate on the map.
  • dirY: A floating point number representing the light direction's Y coordinate on the map.
  • dirZ: A floating point number representing the light direction's Z coordinate on the map.
  • createsShadow: A boolean representing whether or not does the light cast shadows.

Returns

Returns the light element if creation was successful, false otherwise.

Example

-- todo

Changelog

Version Description
1.4.0-9.07050 Addendum to r7048 (Applied source patch #8737 (PointLight Creation) by Lex128.)

See Also