Light control script.
Add to lights and control entities, name the lights 'Light_num1_num2' where num1 is the sensitivity value and is the fade speed (if needed).
Name the control entities 'Fade_num', 'FlickerStart_num' or 'FlickerAlways_num' where num is the trigger range for the entity. Any other name is simple on/off of light.
When the player is within the specified range of a control entity it will act upon all lights where the light range value multiplied by the sensitivity value overlaps the control entity.
*** Edited to add: Change flicker modes to FlickerStart and FlickerAlways. ***
Attach the script to lights and control entities, the lights need to be called 'Light_n1_n2' where n1 is sensitivity and n2 is fade speed (if needed). The control entities can be named either 'Fade_n' where n is the trigger distance or FlickerStart_n or FlickerAlways_n or anything else.
if the control entity is called Fade_n then when the player comes withing n distance any lights within range (I'll explain that in a bit) will fade up. Move away and they will fade down. Speed of fade governed by the n2 value attached to the light.
if the control entity is called FlickerStart_n then similar except the lights will flicker for a bit before coming on full (like fluorescent lights).
if the control entity is called FlickerAlways then the lights will continuously flicker until you move away.
The range of the light itself multiplied by the sensitivity value determines in an entity triggers it or not, so if the range of the light is 500 and sensitivity is 2 then if the light is within 1000 units of the control entity it will be triggered by it.
If the control entity is called anything else then the light will just come on straight away.
You can have as many lights and as many control entities and the script sorts it all out.
*** Edited to add extra functionality ***
Lights and control entities can now take an identifier parameter. This links specific controls to specific lights (they still have to be in range though).
e.g. 'Light_2_5_fred' and 'Fade_200_fred' will be linked so only lights with 'fred' on the name will be controlled by control entities with 'fred' on the name.
Also added the following functionality to control entities:
'Motion' : if the name of the control entity starts with this then it activates only when the player is in motion.
'OnOnly' : if the name starts with this then the lights are only turned on by this entity
'OffOnly' : if the name starts with this the lights are only turned off by this entity.
For example: 'OnOnlyFade_200_betty' if the control entity is called this then when the player is within 200 units of the entity all lights within range that have 'betty' on the end of their names will be turned on with fade.
Be careful to exactly follow the naming conventions, Lua is case sensitive!
*** new version added 'zone' as trigger distance, e.g. if script is added to a zone marker set the trigger distance to 'zone' and the trigger will occur when the player is in the zone.
For example 'FadeStart_zone'
*** new version added 'Switch' option to the control entity so you can attach the script to switches, e.g. 'SwitchFlickerStart_80' when the player is within 80 units and looking at the entity you will get a prompt to press the E key to operate the switch. Add a 'click' sound to sound slot 0 and it will play when you press E.
Also added a variable called motionDelay to the script, if you select the 'Motion' type then this will determine how long after you stop moving the lights will trigger.
Been there, done that, got all the T-Shirts!