Frictional Games Forum (read-only)
How do I trigger lights? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: How do I trigger lights? (/thread-17632.html)



How do I trigger lights? - Melvin - 08-10-2012

I've tried this

On the leveleditor: the SpotLight I want to use set on not active

In the script:


void Activate_Area(string &in item)
{
SetEntityActive("Suitor_Scare", true);
SetLightVisible("SpotLight_Shadow", true);
}

(This is after I pick up a key)



Note: The light is also on if I start the map, I didn't even triggered it yet.

Help would be appreciated, I won't doubt you can help cuz you guys always have helped me succefully in the past Smile


RE: How do I trigger lights? - Adny - 08-10-2012

Lights cannot be toggled via the level editor like most other entities, they only work through scripts. Use this function:

SetLightVisible(string& asLightName, bool abVisible);


Place it under void OnStart() and use false for the Boolean argument. When you want to use it in the function to trigger it, use it again, except making the bool true.

Hope that helped.


RE: How do I trigger lights? - Melvin - 08-10-2012

(08-10-2012, 02:46 AM)andyrockin123 Wrote: Lights cannot be toggled via the level editor like most other entities, they only work through scripts. Use this function:

SetLightVisible(string& asLightName, bool abVisible);


Place it under void OnStart() and use false for the Boolean argument. When you want to use it in the function to trigger it, use it again, except making the bool true.

Hope that helped.
That worked perfectly!
I was trying to make a Suitor walk past the hallway and cast a shadow using the SpotLight.
Even I got scared and jumped, the effects worked good, thanks!