cypher2012 Posted December 12, 2017 Share Posted December 12, 2017 (edited) Hey guys. Currently working on a simple mod. It's a switch you can build in workshop mode, that activates/deactivates during day/night. I've pretty much finished the scripting already. I'll make a few adjustments so you can have powered on during the day or night. You can choose a pylon that is active during the day, or one that is active during the night. This mod is aimed at somebody that for example, wants an easy way to have lights turn off during the day. Nexus: https://www.nexusmods.com/fallout4/mods/28476 Bethesda PC: https://bethesda.net/en/mods/fallout4/mod-detail/4045742 Bethesda Xbox: https://bethesda.net/en/mods/fallout4/mod-detail/4045743 I've done some modelling. Recycled the power pylon and modeled a little solar panel to it: Edited December 12, 2017 by cypher2012 Link to comment Share on other sites More sharing options...
montky Posted December 12, 2017 Share Posted December 12, 2017 cool!this'll go great with Massigest and FiftyTifty's electronics parts,better conditional logic switches etc. hehe, i can even have your 'indiana jones'/'rollercoaster' be only online during daylight hours... hehe. thanks Cypher2012!I can't wait to see what you'll come up with next. Link to comment Share on other sites More sharing options...
cypher2012 Posted December 12, 2017 Author Share Posted December 12, 2017 Code for anybody thinking of doing something similar: Scriptname SSS:SSS_SolarSwitch extends ObjectReference 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} Bool Property bNightActivated = True Auto Const {If bNightActivated to true, power will be enabled at night. Reverse if set to false.} 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 CheckIfStateChangeNeeded() StartTimer(10.0, 0) float fCurrentTime = GetCurrentHourOfDay() If (fCurrentTime > LightsOffTime && fCurrentTime < LightsOnTime) GoToState("DayTimeState") Else GoToState("NightTimeState") EndIf EndFunction Event OnTimer(int aiTimerID) CheckIfStateChangeNeeded() EndEvent Event OnInit() CheckIfStateChangeNeeded() EndEvent State NightTimeState Event OnBeginState(string sOldState) if(bNightActivated) Self.SetOpen(false) else Self.SetOpen(true) endif EndEvent EndState State DayTimeState Event OnBeginState(string sOldState) if(bNightActivated) Self.SetOpen(true) else Self.SetOpen(false) endif EndEvent EndState Link to comment Share on other sites More sharing options...
Recommended Posts