pepperman35 Posted February 5, 2021 Share Posted February 5, 2021 If SIIR_WSPowerNode01 is a workshop generator and it is placed into the world, do these statements accomplish the same thing. If I understand the CK wiki correctly, .setopen(false) should place the switch (i.e., generator) in a closed position thus allow electricity to flow. Similarly, setopen(true) should place the switch (i.e., generator) in an open position and not allow electricity to flow. It seems Activate should simply change the state of the switch to opposite of what it was to begin with. SIIR_WSPowerNode01.SetOpen(false) SIIR_WSPowerNode01.Activate(Game.GetPlayer(), true) Am I understanding this correctly, or totally FUBAR. Link to comment Share on other sites More sharing options...
FatalityGrogen Posted February 5, 2021 Share Posted February 5, 2021 (edited) The open state in papyrus is not the same as in an open circuit. Open simply means on. Besides, i don't think the SetOpen() Function would work for a generator, it is for doors i believe. take a look at this https://www.creationkit.com/index.php?title=GetOpenState_-_ObjectReference Edited February 5, 2021 by FatalityGrogen Link to comment Share on other sites More sharing options...
pepperman35 Posted February 5, 2021 Author Share Posted February 5, 2021 Okay, is there a function or set of functions that work on generators? Basically, to turn them on and off via a terminal. Link to comment Share on other sites More sharing options...
pepperman35 Posted February 6, 2021 Author Share Posted February 6, 2021 (edited) Generator added with keyword WorkshopStartUnpoweredOff and linked to workshop with workshopitem keyword Script fragment added to terminal int openState = SIIR_WSPowerNode01.GetOpenState()Debug.Trace("Initial state of WSP Node is , " + openState)if (openState == 1 || openState == 2) ; Open or opening Debug.Trace("Initial state of WSP Node is open or opening, " + openState) Debug.Trace("We have no power, " + openState) SIIR_WSPowerNode01.Activate(Game.GetPlayer(), true) ; give it some time to register Utility.Wait(5.0) Debug.Trace("State of WSP Node after activating , " + SIIR_WSPowerNode01.GetOpenState())EndifSIIR_RadWeatherController01.enable()SIIR_FireworksMortar01.enable(); SIIR_FireworksMortar01.Activate(Game.GetPlayer(), true); Add some shells to the mortarSIIR_FireworksMortar01.addItem(DLC05FireworkShellWeatherClear, 100, true) It appears to be working and the debug trace shows the follow [02/06/2021 - 12:59:57AM] Initial state of WSP Node is , 1[02/06/2021 - 12:59:57AM] Initial state of WSP Node is open or opening, 1[02/06/2021 - 12:59:57AM] We have no power, 1[02/06/2021 - 01:00:02AM] State of WSP Node after activating , 3 Edited February 6, 2021 by pepperman35 Link to comment Share on other sites More sharing options...
Evangela Posted February 6, 2021 Share Posted February 6, 2021 Alright, so if I understand right, you can now power on/off a generator through a terminal? Link to comment Share on other sites More sharing options...
pepperman35 Posted February 6, 2021 Author Share Posted February 6, 2021 (edited) Yes, it appears to be working as desired. Edited February 6, 2021 by pepperman35 Link to comment Share on other sites More sharing options...
Evangela Posted February 6, 2021 Share Posted February 6, 2021 Good, now I can go update the wiki page for GetOpenState. Link to comment Share on other sites More sharing options...
niston Posted February 8, 2021 Share Posted February 8, 2021 You can use SetOpen() on anything that has the power switch keyword. Similar with GetOpenState().Open = Circuit Open = Power does not flow, Closed = Circuit Closed = Power does flow.The issue with .Activate() is that it may take an arbitrary amount of time to complete, depending on the on/off animations of the object - But the function call returns immediately. Link to comment Share on other sites More sharing options...
pepperman35 Posted February 8, 2021 Author Share Posted February 8, 2021 (edited) First, I freely admit my Padawan status when it comes to scripting but niston and SKK50 have helped me understand a lot more than I did when I first started. Much more to learn of course, but wanted to give these guys a big shout out. Here is the script that seems to work okay. It activates the generator which provides power to the monitoring switch. Monitoring switch from UncleChubby's Electronics mod keeps a lookout for radstorms and sends power to the mortar launcher as required to fire a clear weather shell. The script also loads up the mortar with the clear weather shells. Scriptname SpecIslandInstReborn:InitalizeWCSScript extends ObjectReference Const{ Script designed to initialize the custom weather control station on Spectacle Island.Power connections have been made via F04edit. Script placed on terminal to activate.};;-- Properties --------------------------------------;Group BaseGameQuest Property pWorkshopParent Auto Const mandatoryKeyword Property pWorkshopItemKeyword Auto Const mandatoryEndGroupGroup PepperGlobalVariable Property pSIIR_WCSStatusGlobal Auto Const mandatoryObjectReference Property pSIIR_WSPowerNode01 Auto Const mandatoryObjectReference Property pSIIR_RadWeatherController01 Auto Const mandatoryObjectReference Property pSIIR_FusionPulseChargeDummy Auto Const mandatoryObjectReference Property pSIIR_FireworksMortar01 Auto Const mandatoryMiscObject Property pDLC05FireworkShellWeatherClear Auto Const mandatoryMessage Property pSIIR_NoWorkshopMsg Auto Const mandatoryEndGroup;-- Variables ---------------------------------------;-- Functions ---------------------------------------Function ActivateWCS()If (pSIIR_WCSStatusGlobal.GetValue() == 0 as float)ObjectReference ThisWorkshop = Self.GetLinkedRef(pWorkshopItemKeyword)If (ThisWorkshop == None)Debug.Trace("SpecIslandInstReborn:InitalizeWCSScript.ActivateWCS ERROR NoWorkshop", 0)pSIIR_NoWorkshopMsg.Show(0, 0, 0, 0, 0, 0, 0, 0, 0)Else; Swap out dummy generator with a live one; live generator has WorkshopStartUnpoweredOff keywordpSIIR_WSPowerNode01.disable()pSIIR_FusionPulseChargeDummy.enable()pSIIR_WSPowerNode01.enable()pSIIR_FusionPulseChargeDummy.disable()pSIIR_WSPowerNode01.enable(False)int iWorkshopID = (ThisWorkshop as workshopscript).GetWorkshopID()If ((pSIIR_WSPowerNode01 as workshopobjectscript).WorkshopID != iWorkshopID)(pWorkshopParent as workshopparentscript).BuildObjectPUBLIC(pSIIR_WSPowerNode01, ThisWorkshop as workshopscript)Debug.Trace("SpecIslandInstReborn:InitalizeWCSScript.ActivateWCS pSIIR_WSPowerNode01.WorkshopID " + pSIIR_WSPowerNode01 as string + " " + (pSIIR_WSPowerNode01 as workshopobjectscript).WorkshopID as string, 0)EndIf; Check generator state and turn it onint openState = pSIIR_WSPowerNode01.GetOpenState()Debug.Trace("Initial state of power supply node is , " + openState)If (openState == 1 || openState == 2) ; Open or openingDebug.Trace("Initial state of power supply node is open or opening, " + openState)Debug.Trace("We have no power, " + openState)pSIIR_WSPowerNode01.Activate(Game.GetPlayer(), true); give it some time to registerUtility.Wait(5.0)If (openState == 3 || openState == 4) ; Open or openingDebug.Trace("State of power supply node after activating , " + pSIIR_WSPowerNode01.GetOpenState())Debug.Trace("We have power, " + pSIIR_WSPowerNode01.GetOpenState())EndifEndifpSIIR_RadWeatherController01.enable()If ((pSIIR_RadWeatherController01 as workshopobjectscript).WorkshopID != iWorkshopID)(pWorkshopParent as workshopparentscript).BuildObjectPUBLIC(pSIIR_RadWeatherController01, ThisWorkshop as workshopscript)Debug.Trace("SpecIslandInstReborn:InitalizeWCSScript.ActivateWCS pSIIR_RadWeatherController01.WorkshopID " + pSIIR_RadWeatherController01 as string + " " + (pSIIR_WSPowerNode01 as workshopobjectscript).WorkshopID as string, 0)EndIfpSIIR_FireworksMortar01.enable()If ((pSIIR_FireworksMortar01 as workshopobjectscript).WorkshopID != iWorkshopID)(pWorkshopParent as workshopparentscript).BuildObjectPUBLIC(pSIIR_FireworksMortar01, ThisWorkshop as workshopscript)Debug.Trace("SpecIslandInstReborn:InitalizeWCSScript.ActivateWCS pSIIR_FireworksMortar01.WorkshopID " + pSIIR_FireworksMortar01 as string + " " + (pSIIR_WSPowerNode01 as workshopobjectscript).WorkshopID as string, 0)EndIfpSIIR_FireworksMortar01.addItem(pDLC05FireworkShellWeatherClear, 100, true)EndifEndifEndFunction Edited February 8, 2021 by pepperman35 Link to comment Share on other sites More sharing options...
niston Posted February 8, 2021 Share Posted February 8, 2021 Be careful with unclechubby's electronics mod. Some of the stuff in it causes scrap crash. Link to comment Share on other sites More sharing options...
Recommended Posts