mannygt Posted February 27, 2012 Share Posted February 27, 2012 Hello,I'm a n00b about CK, but I know what I want. I've made a mod that add lanterns near bridges. These lanterns use a custom new light with ID: "lightLanternSkyrim" Now I'm trying to make lit lanterns only from 6:00 to 18:00.I don't know how to retrieve current clock time and I don't know how to modify light on/off. There is my "ideal" script here Function mainLanterns() RegisterForUpdateGameTime(1) endFunction Event OnUpdateGameTime() if currentTime>=6 && currentTime<=18 TurnOFFLightByID else TurnONLightByID endIf endEvent Of course, currentTime, TurnOFFLightByID and TurnONLightByID are not the real script stuff.What I've to do to get clock time and toggle lighting? Thank you! Link to comment Share on other sites More sharing options...
gsmanners Posted February 27, 2012 Share Posted February 27, 2012 It takes a bit more work. See: http://www.creationkit.com/Function_for_Time_of_Day Link to comment Share on other sites More sharing options...
mannygt Posted February 27, 2012 Author Share Posted February 27, 2012 Thanks for reply about daytime. Now how can I set ON/OFF a light? Thank you. Link to comment Share on other sites More sharing options...
fg109 Posted February 28, 2012 Share Posted February 28, 2012 Enable() and Disable(). Link to comment Share on other sites More sharing options...
flobalob Posted February 28, 2012 Share Posted February 28, 2012 Best way (asuming multiple lights) would be to a) put the light objects into the cellb) add an xmarker to the cellc) add an activator to the celld) set the xmarker to be the enable parent of the light objectse) set the xmarker to be the linked ref of the activatorf) attach a script to the activator that runs getLinkedRef().disable(true) to turn the lights off or getLinkedRef().enable(true) to turn them on. This may seem more complicated at first but the script can be re-used if need be without re-coding. Link to comment Share on other sites More sharing options...
mannygt Posted February 28, 2012 Author Share Posted February 28, 2012 (edited) Thanks all for reply :) Now I'm at office but I'm thinking about scripting my 'LightLanternOfSkyrim' custom light object and it will be: Function mainLanterns() RegisterForUpdateGameTime(1) endFunction float Function GetCurrentHourOfDay() float Time = Utility.GetCurrentGameTime() Time -= Math.Floor(Time) ; Remove "previous in-game days passed" bit Time *= 24 ; Convert from fraction of a day to number of hours Return Time EndFunction Event OnUpdateGameTime() float currentTime = GetCurrentHourOfDay() if currentTime>=6 && currentTime<=18 getLinkedRef().Disable(true) else getLinkedRef().Enable(true) endIf endEvent mainLanterns() I want to try to place this script directly to my custom base light object, so all lanterns in the bridges I made will works... What do you think about this? Edited February 28, 2012 by mannygt Link to comment Share on other sites More sharing options...
gsmanners Posted February 28, 2012 Share Posted February 28, 2012 Looks okay to me. I would try RegisterForUpdateGameTime(0.5) just to be sure the lights are prompt about reacting to the time of day (I think a half hour is a reasonable polling interval). Link to comment Share on other sites More sharing options...
mannygt Posted February 28, 2012 Author Share Posted February 28, 2012 Thanks for your suggestion :) I'll try it tonight and if works I'll update my mod. Thank you. Link to comment Share on other sites More sharing options...
flobalob Posted February 28, 2012 Share Posted February 28, 2012 Just as a possible alternative, have you tryed setting the external emittence on the light(s) to something like FXLightRegionInvertDayNight. See how that works for you and no scripting required. Link to comment Share on other sites More sharing options...
mannygt Posted February 28, 2012 Author Share Posted February 28, 2012 Just as a possible alternative, have you tryed setting the external emittence on the light(s) to something like FXLightRegionInvertDayNight. See how that works for you and no scripting required. Hello. No, I've no tried yet but I'll try it. BTW I want to make my first tiny script about papyrus :) Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts