;usage :
;[object,[x,y,z]] exec "light.sqs"
;x = + for front/- for back
;y = + for right/- for left
;z = + to place above object/ - = below object
;example :
;[myCar,[3,2,0.5]] exec "light.sqs" (this put a light at 3m infront of mycar and 2m to the right)
;[myCar,[3,-2,0.5]] exec "light.sqs" (this put 3m infront of myCar and 2m to the left)
;so you got a car with the headlights!
;example2 :
;[PoliceCar,[0,0,0.5]] exec "light.sqs" (you got a police car with a siren turned on!)
_object = _this select 0 ;
_lightPosition = _this select 1 ;
_lightX= _lightPosition select 0
_lightY= _lightPosition select 1
_lightZ= _lightPosition select 2
_lightColor = []
;light colors
;format is [r,g,b]
_cred=[1,0,0]
_cblue=[0,0,1]
_cgreen=[0,1,0]
_cwhite=[1,1,1]
;change _white to any of the above to change the color(this affects ALL of the lights created by this script)
_lightColor = _cwhite
_light="#lightpoint" createvehicle position _object
_light setpos [(getpos _object select 0)+_lightX*sin(getDir _object)+_lightY*cos(getDir _object),(getpos _object select 1)+_lightX*cos(getDir _object)-_lightY*sin(getDir _object),(getPos _object select 2)+_lightZ]
_light setlightcolor _lightColor;
_light setlightambient [0.5,0.5,0.5];
_light setlightbrightness [1/7] ;
exit
If requested, I can further expand this script with additional features (light size,color,brightness,duration,movewithobject,etc ,etc)
Regards,
Haroon1992