MjrMalfunktion Posted July 28, 2022 Share Posted July 28, 2022 Hi all, Recently I dusted off and set up my trusty ol' rig and installed fallout 4, I installed some mods, barely made it to Red Rocket and started tinkering in the Creation Kit. I started making a player home that has a secret door hooked up to a switch, and also put in a a script by Felloutislife,(from his YT tutorials), so it can turn on lights aswel. The script runs perfect but since i have no experience in scripts and stuff i basically can only use his exact script. I'd like to add a delay to the lights turning on after the door has opened (as in a sequence). Is there anyone of you who has the knowledge to add a line in the script where i can put a value in so that the turning on of the lights is delayed? I would greatly appreciate it! The current script: ScriptName Testscriptlights 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(string asOldState) EnableMarker.Disable() EndEvent Event OnActivate(ObjectReference akActionRef) GoToState("LightsOn") EndEvent EndState State LightsOn Event OnBeginState(string asOldState) EnableMarker.Enable() EndEvent Event OnActivate(ObjectReference akActionRef) GoToState("LightsOff") EndEvent EndState Small secondary question: The workshop items that are found in the creation kit under lights show as if they have their own lightsources scripted in them (when toggeling the lights in CK it shows it as a light source, however if i try to attach it to a switch (either through parenting or an enable marker) they do nothing. Is there a script that i have to add that mimics workshop mode in-game? I appologize if i used any faulty terms that raises the hair more advanced modders' necks but like I said i have zero experience doing this. (Also forgive any language errors, as English is not my native tongue) Thank you. Link to comment Share on other sites More sharing options...
Zorkaz Posted July 28, 2022 Share Posted July 28, 2022 I'd use StartTimer() For instance like in Door Property TheDoor Auto ObjectReference Property TheLights Auto Event OnActivate(ObjectReference AkActionRef) If TheLights.isdisabled() TheDoor.PlayGamebryoAnimation("Open") StartTimer (5,10) Else TheDoor.PlayGamebryoAnimation("Close") TheLights.disable() Endif EndEvent Event OnTimer (Int AITimerID) If AITimerID == 10 TheLights.enable() Endif EndEventThis would activate the Lights 5 seconds after. The doors gamebryo animation might be called different, which can be accessed by "right-click preview window" Link to comment Share on other sites More sharing options...
MjrMalfunktion Posted July 28, 2022 Author Share Posted July 28, 2022 Thanks for your response! The door is activated through enable parent so it doesn't require a mention in the script (correct me if i'm wrong though^^) The setup works, only the lights turn on as soon as i push the button. I will try and write the script with the start timer line as soon as i get back home. (Dinner with parents in law, yuk..) I'll post it here for review if i failed. Anyway thanks again for your time, i appreciate it! Link to comment Share on other sites More sharing options...
greekrage Posted July 28, 2022 Share Posted July 28, 2022 (edited) Thanks for your response! The door is activated through enable parent so it doesn't require a mention in the script (correct me if i'm wrong though^^) The setup works, only the lights turn on as soon as i push the button. I will try and write the script with the start timer line as soon as i get back home. (Dinner with parents in law, yuk..) I'll post it here for review if i failed. Anyway thanks again for your time, i appreciate it!do you have the lights linked to the switch itself or with a enable marker as parent ? Also note the activate parent also has a box with time (secs) . have you tried adding a number like 5.0 secs etc ? Confirmed !!Adding a delay to the activate parent works. Meaning adding X secs to the activation will delay the lights or anything else you are using... This has to be done for every reference you want to delay.If you have too many lights you can use a "enable marker" and link the marker to the switch and all the lights to the marker (as enable parent ). Then you link the marker to the workshop with activate parent and the delay.(you still have to enable parent for the marker as well... Edited July 28, 2022 by greekrage Link to comment Share on other sites More sharing options...
greekrage Posted July 28, 2022 Share Posted July 28, 2022 Hi all, Recently I dusted off and set up my trusty ol' rig and installed fallout 4, I installed some mods, barely made it to Red Rocket and started tinkering in the Creation Kit. I started making a player home that has a secret door hooked up to a switch, and also put in a a script by Felloutislife,(from his YT tutorials), so it can turn on lights aswel. The script runs perfect but since i have no experience in scripts and stuff i basically can only use his exact script. I'd like to add a delay to the lights turning on after the door has opened (as in a sequence). Is there anyone of you who has the knowledge to add a line in the script where i can put a value in so that the turning on of the lights is delayed? I would greatly appreciate it! The current script: ScriptName Testscriptlights 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(string asOldState) EnableMarker.Disable() EndEvent Event OnActivate(ObjectReference akActionRef) GoToState("LightsOn") EndEvent EndState State LightsOn Event OnBeginState(string asOldState) EnableMarker.Enable() EndEvent Event OnActivate(ObjectReference akActionRef) GoToState("LightsOff") EndEvent EndState Small secondary question: The workshop items that are found in the creation kit under lights show as if they have their own lightsources scripted in them (when toggeling the lights in CK it shows it as a light source, however if i try to attach it to a switch (either through parenting or an enable marker) they do nothing. Is there a script that i have to add that mimics workshop mode in-game? I appologize if i used any faulty terms that raises the hair more advanced modders' necks but like I said i have zero experience doing this. (Also forgive any language errors, as English is not my native tongue) Thank you. all "workshop" lights have their own sources which is why we cant use them in the ck if we want to control them ...because if you link them to a switch the fixture itself will appear/disappear...(example a light post)... So you use the static fixture and add the needed sources which you will then control with a switch etc... Link to comment Share on other sites More sharing options...
MjrMalfunktion Posted July 28, 2022 Author Share Posted July 28, 2022 Thanks for your response! The door is activated through enable parent so it doesn't require a mention in the script (correct me if i'm wrong though^^) The setup works, only the lights turn on as soon as i push the button. I will try and write the script with the start timer line as soon as i get back home. (Dinner with parents in law, yuk..) I'll post it here for review if i failed. Anyway thanks again for your time, i appreciate it!do you have the lights linked to the switch itself or with a enable marker as parent ? Also note the activate parent also has a box with time (secs) . have you tried adding a number like 5.0 secs etc ? Confirmed !!Adding a delay to the activate parent works. Meaning adding X secs to the activation will delay the lights or anything else you are using... This has to be done for every reference you want to delay.If you have too many lights you can use a "enable marker" and link the marker to the switch and all the lights to the marker (as enable parent ). Then you link the marker to the workshop with activate parent and the delay.(you still have to enable parent for the marker as well...So there is basically no need to run a script for enabling the light sources? The setup im using now is: the switch is enabled as a parent for opening the door, the lights have an enable marker set as parent which is activated by the posted script added to the switch. When looking for info every source i found on connecting lights to a button used a script so i never bothered to try and parent the lights to the switch directly... Im going to try this tommorrow.. Also good shout about the delay checkbox of the lights going to the enable marker. I totally didn't think of that, i was too fixated on delaying the marker itself that i didn't think of delaying the seperate signals going from the marker to the lights! Thank you for taking the time to help! Link to comment Share on other sites More sharing options...
Recommended Posts