DOWNLOAD MODS
Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...
Cipscis
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Tutorials
Gallery
Store
Events
Posts posted by Cipscis
-
-
Don't forget we have actual states now, they can be really convenient. I've written a similar light switch script that uses states, that I put up on the wiki a while ago - Light Switch
Cipscis
EDIT:
Here's the actual light switch script:
ScriptName ManualLightSwitch extends ObjectReference {Controls a set of lights with a master enable parent marker (EnableMarker) and a switch with this script attached to turn on and off when the switch is activated} ObjectReference Property EnableMarker auto {The marker set as the enable parent of all the lights} Event OnInit() If (EnableMarker.IsDisabled()) GoToState("LightsOff") Else GoToState("LightsOn") EndIf EndEvent State LightsOff Event OnBeginState() Disable() EndEvent Event OnActivate(ObjectReference akActionRef) GoToState("LightsOn") EndEvent EndState State LightsOn Event OnBeginState() Enable() EndEvent Event OnActivate(ObjectReference akActionRef) GoToState("LightsOff") EndEvent EndState
Also, an automatic variation that works on a timer:
ScriptName TimedLightSwitch extends ObjectReference {Controls a set of lights with a master enable parent marker with this script attached to turn on and off at the times of the day specified by the properties LightsOffTime and LightsOnTime} float Property LightsOffTime = 7.0 auto {The time at which lights should be turned off} float Property LightsOnTime = 18.0 auto {The time at which lights should be turned on} float Function GetCurrentHourOfDay() global {Returns the current time of day in hours since midnight} 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 Function RegisterForSingleUpdateGameTimeAt(float GameTime) {Registers for a single UpdateGameTime event at the next occurrence of the specified GameTime (in hours since midnight)} float CurrentTime = GetCurrentHourOfDay() If (GameTime < CurrentTime) GameTime += 24 EndIf RegisterForSingleUpdateGameTime(GameTime - CurrentTime) EndFunction Event OnInit() If (GetCurrentHourOfDay() > LightsOffTime) GoToState("LightsOff") Else GoToState("LightsOn") EndIf EndEvent State LightsOff Event OnBeginState() Disable() RegisterForSingleUpdateGameTimeAt(LightsOnTime) EndEvent Event OnUpdateGameTime() GoToState("LightsOn") EndEvent EndState State LightsOn Event OnBeginState() Enable() RegisterForSingleUpdateGameTimeAt(LightsOffTime) EndEvent Event OnUpdateGameTime() GoToState("LightsOff") EndEvent EndState
Cipscis
Hitting an object with a specific item in hand.
in Skyrim Script Repository
Posted
Just a note, _echo. You never need to declare native functions in your script in order to use them - any functions you declare should not be native.
Cipscis