After numerous attempts at trying to make tileset light and placeable lighting work - lights off in the daytime and on at night, I finally came up with a workaround that appears to work 100% of the time.
-
Set all tileset source lights to black
-
Place an invisible object placeable in each source light - set to the XYZ coordinates so it is centered over the light’s holder (I usually change the appearance to “small flame” so I can get the position dead on, then it change it back to “invisible object”
-
Give the invisible object a unique tag such as “LIGHT_1”
-
In the Area’s OnEnter script, add this snippet of code:
//Set the lightsources to "on" at night
object oLight = GetObjectByTag("LIGHT_1");
if (!GetIsDay())
{
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_LIGHT_YELLOW_20), oLight);
CreateObject(OBJECT_TYPE_PLACEABLE, "plc_flamesmall", GetLocation(oLight), FALSE, "F_LIGHT_1);
}
else
{
RemoveEffectOfType(oLight, EFFECT_TYPE_VISUALEFFECT);
DestroyObject(GetNearestObjectByTag("FlameSmall"));
}
This code handles one light source. You can make it handle multiple lights by adding a for loop in the “if” and “else” statements, searching for “LIGHT_”+INT and “F_LIGHT_”+INT respectively.
So, what’s the benefit?
-
You can now have tileset source lights that actually function as they are supposed to, transitioning for day/night, as opposed to only working some of the time - if at all.
-
There is no need to RecomputeStaticLighting, as it is done automatically when the “light” VFX is applied. This might also resolve the crashing issue that people are experiencing when they use RecomputeStaticLighting in an area with “fancy mapped” objects.