daisy8 Posted March 31, 2017 Share Posted March 31, 2017 Thanks Caleb. I'll give it a try. What does your off/on script look like ? And which switch in the kit do you use ? CheersDaisy Link to comment Share on other sites More sharing options...
caleb68 Posted March 31, 2017 Share Posted March 31, 2017 (edited) I have several power toggle scripts, my complex one is based off of a default script that isn't used in the game (CircuitBreakerScript) But you can find it attached to CircuitBreaker01OLD in the activators. some slight modifications were made to it for my purposes. This one is a simpler version that I setup for reuse for toggling power switches, its pretty basic, Keyword[] is filled with the keywords on the linkrefs you've linked to the switch, and it will cycle through each keyword, grab the reference and activate the switch itself, its the same script I used in the hawthorne mod I did: Scriptname ActivatorToggleScript extends ObjectReference Hidden Const Keyword[] Property Activators Auto Const Mandatory Event OnLoad() Self.SetNoFavorAllowed() EndEvent Event OnActivate(ObjectReference akActionRef) int curCount = 0 while(curCount < Activators.length) keyword objecttoget = Activators[curCount] if (GetLinkedRef(objecttoget)) GetLinkedRef(objecttoget).Activate(akActionRef) endif curCount += 1 endwhile EndEvent Far as what switches that I use, it just depends on what im using them for, i.e. like my hawthorne estate mod here at nexus, i just took and used a Panel_Lock activator and toss the script on it, if your just using the onactivate event you can pretty much use any model as long as you make it a activator. Far as the basic enable / disable script: Scriptname calEnableDisableScript extends ObjectReference Hidden Const Keyword Property EnablerRef Auto Const Mandatory Event OnActivate(ObjectReference akActionRef) if (Game.GetPlayer() == akActionRef) ObjectReference TmpRef = GetLinkedRef(EnablerRef) if (TmpRef.IsDisabled() == true) TmpRef.Enable() else TmpRef.Disable() EndIf endif EndEvent the above script only allows the player to activate the switch - period, no exceptions. if you want companions to be able to activate it, remove the line with game.getplayer, and the last endif If none of these scripts for the basic enabler everyones posted aren't working for you, make sure you have your lights linked properly to the EnableMarker, they can't be linked refs they need to have it set as their enable parent. You'd edit each light and go to the enable parent tab and select the EnableMArker as their parent. The EnableMarker wouldn't have a enable parent, if it did, then you would not be able to toggle it to a on/off state either. As a shortcut, you can select all the lights that will be connected to the Enable Marker, then move your render window so the enable marker is visible, and with the render window still in focus, press insert and wait a moment, a reference batch action window will pop up, on the right side select the option 'set enable parent', then down at the bottom left, click select reference in render window, click on the enablemarker, set a keyword if any is needed (usually not), and click do. It takes it a momement or two, depending on how many lights you have selected, but once you can select something else in the render window, you can close the reference batch window. That saves some time in setting up links for enablers. Edited March 31, 2017 by caleb68 Link to comment Share on other sites More sharing options...
daisy8 Posted April 3, 2017 Share Posted April 3, 2017 Hi caleb I have tried to set up a switch with the second script above and still not had any luck. The setup I have tried is this: Use a RedR_ButtonBoxPut your second script on it in the reference dialog box and leave the existing script there and unchanged(What do you use in the properties of your script ? I can't find a keyword for the enable/disable marker ??) Set the enable parent of the initially disabled lights to the enable/disable marker and set the marker to initially disabled Does the ObjectReference TmpRef = GetLinkedRef(EnablerRef) line mean I need set the linkref on the red button to the enable marker ? Still can't find a keyword though ? Thanksdaisy Link to comment Share on other sites More sharing options...
caleb68 Posted April 4, 2017 Share Posted April 4, 2017 (edited) if your using the second script you need to edit the properties of the script and set a keyword to it, i usually use linkcustom01 Then go to the 'linked reference' tab of the switch and add a link to the enabler or to a light (if only one light is working) and set the keyword on that to linkcustom01 as well. Also if you leave the keyword blank on the script, and link the switch to the enabler or light, it will grab the first linkref on the switch that doesn't have a keyword. Don't link the enabler / light to the switch, thats backwards and won't work. must be switch to the enabler / light. If you need I can take some screenshots and post them to show what to do if your still lost after the above. Edited April 4, 2017 by caleb68 Link to comment Share on other sites More sharing options...
daisy8 Posted April 4, 2017 Share Posted April 4, 2017 Hi caleb Here is a collection of pics of my setup, that still isnt working. The enable marker is the enable parent for both lights and the lights and marker are all disabled initially. Cheersdaisy Link to comment Share on other sites More sharing options...
daisy8 Posted April 4, 2017 Share Posted April 4, 2017 The script property is set to linkcustom10 as well. Link to comment Share on other sites More sharing options...
caleb68 Posted April 4, 2017 Share Posted April 4, 2017 it looks like you have something setup wrong just looking at the picture but I'll build a mini esp anyhow. The lights - they select both of them, with the render window in focus, press insert (this will bring up the batch window), on the right hand side click the option for 'Set Enable Parent', down on the bottom click 'select reference in render window, and click on the enable marker. Then click do, wait a second, and close that window. That will link both lights to the enable marker with it as parent (quicker then doing one at a time), from everything else in the picture you showed all looks correct. From your picture it looks like you have the linkage between the enable marker and the lights wrong. I'll go build that mini esp and upload it then add it here so you can grab it and take a look just in case that doesn't fix it for you. Link to comment Share on other sites More sharing options...
caleb68 Posted April 4, 2017 Share Posted April 4, 2017 okay here ya go:http://www.caleb68.com/Fo4/Samplelights.7z that little zip has a sample esp, along with the second script (and source). after you've added the files to your fallout 4 data folder, you can load the mod up and coc to 000TestLights from the main menu, in this cell you'll be able to trigger several different lights using different activators to make them trigger, including the switch your using in your example, all the lights toggled on and off for me without any problems. Open the mod in Creation kit, and go into the cell 000TestLights and you can take a look at how each object is setup along with the linkage. The lights themselves have the enablemarker set as their enable parent. Hope that helps :) Link to comment Share on other sites More sharing options...
daisy8 Posted April 5, 2017 Share Posted April 5, 2017 Hi caleb Awesome, thanks for the zip. But none of the light switches work on my game ??? I re installed the game and the creation kit, but still nothing ?? They worked on your game ? Link to comment Share on other sites More sharing options...
caleb68 Posted April 5, 2017 Share Posted April 5, 2017 yep they all work in my game without a glitch. Did you coc from the main menu to the cell (not loading a game first) ? Sometimes currupt saves can cause scripts to stop functioning properly, coc'ing from the main menu eliminates this as a possible problem. Did you try it without any other mods installed? Its possible you have a mod installed that is causing issues for you to get the lights to work. I tested with vanilla fallout 4 + dlc and it worked fine for me without any problems before zipping it up and uploading it. The little test esp doesn't require any of the official dlc just fallout. make sure everything is in its proper place: 0Samplelighttest.esp should be in the fallout 4\Data directorycalEnableDisableScript.pex Should be in the fallout 4\Data\Scripts directorycalEnableDisableScript.psc Should be in the fallout 4\Data\Scripts\Source\User directory to be able to see the source code in the creation kit. Link to comment Share on other sites More sharing options...
Recommended Posts