This is MTA:SA custom vehicles lights system resource. It allows you to create any lights you want (break, reverse, indicators, sirens, etc, concrete name doesnt matter) and manage they. It is based on simple shader (for brighting light textures) and custom coronas (for emulating light effect).
The resource provides only client-side lights API. For ready to use lights system see improved_vehicle_lights resource.
- One shader per vehicle
- Single light texture (or you can use more if you need)
- Up to 48 lights per vehicle (technically it can be extended in future)
- Flexible configuration
- Non-discrete light power (from 0 to 1)
The resource uses custom directional coronas to emmulate light effect. So it requires extended_custom_coronas resource (it is modified version of custom_coronas resource by Ren712 - thx him for coronas).
float getVehicleCustomLightPower(element vehicle, string lightName)boolean setVehicleCustomLightPower(element vehicle, string lightName, float power)(power is from 0.0 to 1.0)float getVehicleCustomLightSize(element vehicle, string lightName)boolean setVehicleCustomLightSize(element vehicle, string lightName, float size)int, int, int, int getVehicleCustomLightColor(element vehicle, string lightName)boolean setVehicleCustomLightColor(element vehicle, string lightName, int r, int g, int b, int a)
Firstly look at cvl_config.xml. Here is lights properties. Use it as is or change it as you want.
The "textures" node tells what textures will be used for lights:
namename of the texture
The "lights" node defines custom lights:
nameunique name of the light (used in functions)flagmaterial diffuse rgb value of the texturedummyvehicle dummy name, used for custom coronasizesize of custom coronacolorcolor of custom coronamirrroreduse it if u want to mirror dummy position (it's usually used for left-side lights)
The "models" block has the lights unique settings for concrete vehicle models. For example, some models might have red indicators.
namename of the customizable light (must be defined in global "lights" node)sizesize of custom coronacolorcolor of custom coronarotationrotation of custom corona (it is recommended to define light rotation by model dummies, not by this config)
Steps by example of reverse_r light:
- create material with texture named
vehiclelights(this is just default name, you can change it or add another in config) - define material diffuse color equals to
flagvalue, forreverse_rit is255,58,1 - apply material to light polygons
- create unique dummy named
reverselightsand define its rotation (remember that ZModeller has wrong axis, check any "ImVehFt" vehicle model, or just add additional dummy with suffix_dir, for examplereverselights_dir, which means light direction vector) - done
Note: if you works with ZModeller, remember that DFF importing resets all diffuse colors! Work with ZModeler project files.
