Disabling "lights" activating area's... - 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: Disabling "lights" activating area's... (/thread-29648.html) |
Disabling "lights" activating area's... - Amnesiaplayer - 02-23-2015 i searched in the engine scripts and there is nothing i can find. but i want, that if i pick a lantern, the "light" will disappear (i have a big lightbox, and i want that the whole box will disappear, so "de activating" i tried setentityactive false but it didn't worked, and i tried this one to SetLightVisible(string& asLightName, bool abVisible); but it doesn't work to... is this even possible and i want a Area that was inactive, will become active after picking the lantern... i think that works with the Setentityactive thing but the light my script about this: SetEntityPlayerInteractCallback("Lantern", "BadThings", true); void BadThings(string &in asItem, string &in asEntity) { SetLightVisible("Lamp", false); } thanks if you can help me! RE: Disabling "lights" activating area's... - Romulator - 02-23-2015 Instead of SetEntityPlayerInteractCallback, try PHP Code: SetEntityCallbackFunc("Lantern", "BadThings"); //This will go in OnStart() RE: Disabling "lights" activating area's... - Amnesiaplayer - 02-24-2015 (02-23-2015, 02:31 PM)Romulator Wrote: Instead of SetEntityPlayerInteractCallback, try Yes!! it worked!! but can i let it happen after some time delay... like after 3 seconds (you picked the Lantern) the lights will go off.... so you pick the lantern, wait 3 seconds and then the lights go off... it's really funny if i just pick up a lantern and boom xD RE: Disabling "lights" activating area's... - Romulator - 02-24-2015 Yep, make use of a timer. Code: AddTimer(string& asName, float afTime, string& asFunction); You can leave asName blank, but still need to declare it. You don't need to remove the timer, so simply making it "" will do. afTime is how long you want in seconds, and as a float, can be decimal. We'll make it 3.0f. asFunction is like the "BadThings" from before. It is the name of the function which we add code to. For the function, we make use of the Callback syntax, which can be seen above. We just change MyFunc to the name of the Function, which in this case will be called "Lights_Out". We make the Timer count down in BadThings, then we define what should happen. PHP Code: void BadThings(string &in asEntity, string &in type) Make sure to keep the SetEntityCallbackFunc in your OnStart()! RE: Disabling "lights" activating area's... - Amnesiaplayer - 02-24-2015 (02-24-2015, 04:56 PM)Romulator Wrote: Yep, make use of a timer. Thankss!! it worked!! and i finally understand about the timer!!! (02-24-2015, 04:56 PM)Romulator Wrote: Yep, make use of a timer. Thankss!! it worked!! and i finally understand about the timer!!! |