kinggath Posted November 1, 2016 Share Posted November 1, 2016 Does anyone know if it's possible to change whether something is receiving power or not through a script? Once something has power, you can turn it on and off with calls to Activate, but I want to toggle power entirely. Here's specifically what I am trying to do in case there's a better way I'm not seeing: I'm using PlaceAtMe to create workshopLightbulbLight objects, and even if they are near a power radiating object they stay unpowered until I pick them up in workshop mode. I've made sure they have the workshop as a linked ref on the WorkshopItemKeyword. I can't figure out where the IsPowered function is pulling it's information. I've monitored for variable, keyword, and actor value changes before and after I pick up the light in workshop mode and can't find anything that's changing. Could it be using the model's animation graph data to store that kind of information? Link to comment Share on other sites More sharing options...
kinggath Posted November 5, 2016 Author Share Posted November 5, 2016 In case anyone else comes across this looking for the same thing. It appears that controlling power is not directly possible via script (at the time of this post, SKSE might change that in the future). While you can Activate generators, to turn on power, you can't actually bypass the power system directly. You can, however, call PlayAnimation("Reset") and then PlayAnimation("Powered"). This places the item into a state that acts as if it's powered, even though the workshop UI will still show it as unpowered. Future calls to Activate(Game.GetPlayer(), true) will then toggle the item on and off. This works for all powered workshop objects classified as Activators or Lights in the CK. The exception is certain lights, such as the hanginglightbulb. These lights have the "Off by default" option set in the CK, and it appears there is no way to turn this off with Papyrus. To bypass this for a mod I needed it on, I was forced to create duplicates of these lights with that option unchecked. Link to comment Share on other sites More sharing options...
RuneDasRune Posted November 9, 2016 Share Posted November 9, 2016 Dear silverlock, please bring me a AddPower() function in skse for christmas, and a red rider BB gun! I've tried every keyword associated with power, I've tried replicating Home Plate (it has workshop light and conduits that are powered by default), ive tried replicating Zimonja station. I cannot get objects to power up by keywords or scripts, I think the hasPower keyword or property has to be inside the gambryo animation file or maybe inside a havok physics file. Or it could be something that's generated inside of a player save game (probably not as a coc_DmndPlayerHouse01 from opening menu has lights powered up). Or there is a hidden script that has some OnInit() function for assigning power. Im going to try duplicating objects like you suggested to see what kind of results I get. Im working on a puzzle based adventure mod and having power by script is ESSENTIAL for my plans. The chances are power was handled by some third party software Bethseda used but cannot distribute in creation kit. They use Havok, Gambryo, and some other software for terrain building and heighmaps in skyrim so its rights belong to another company. I really wish this could be solved our only hope for now is silverlock adding functions for f4se. Link to comment Share on other sites More sharing options...
kinggath Posted November 10, 2016 Author Share Posted November 10, 2016 Using the method I described above you can essentially create your own on/off state variable and use activate to control them. Though it would be excellent to have access to the power system instead of having to muck around like I did! One thing to watch for is items with a long power on animation, if you send activate to them before the power animation is over, you'll lose track of the sync because the activate command is ignored while the animations are playing, so you almost need to figure out the power on/off length of each thing you want to use and account for that in your scripts. It's a pain, but it works. Link to comment Share on other sites More sharing options...
RuneDasRune Posted November 10, 2016 Share Posted November 10, 2016 Well I guess that confirms the hypothesis that powered state is defined in gamebryo animation. I remember reading that papyrus can "lose track" of boolean values and this quote from creation kit wiki could be a good clue as to why they made the decision to let animation determine power state: "This event can be received out of order with OnTriggerLeave, so it's better to keep a count instead of a simple true/false value for when things are inside the trigger.Note, however, that because of the way Papyrus event handling and threading works, at any given moment, your count may be inaccurate, and there is a risk of the count becoming 'stuck' over time if events are not processed correctly. If your script requires precise accuracy, use the trigger's Interaction Conditions to restrict it to just the references you care about (eg. the player), then use GetTriggerObjectCount to verify that the reference is actually in the trigger at the time it matters."Papyrus can also lose count of integers. This is a huge flaw that Bethseda may want to look into fixing in the next 200 TES or FO releases. Keeping track of boolean and and integer values is important stuff. All that time creating the masterpieces known as Operation Anchorage and NukaWorld could have been invested in other ways, just sayin. -whining complete Again thank you for your posts that is priceless information for the modding community. Link to comment Share on other sites More sharing options...
chucksteel Posted November 10, 2016 Share Posted November 10, 2016 This is not related to scripts but, is about setting up a pre-Powered location like Home plate. It seems a function was cut from the Ckit we received. If you want to create a player home with power you need to fix the "Power Grid" and all of the connections between Generator, (Power Box), Spline, Conduit, Spline, Conduit and so on in xEdit. The keywords do need to still be set in the Ckit but even so the connection will not take in game until the player activates the wire (spline) and re-connects it unless you make the connection in xEdit. also even after making the proper connection in xEdit if the player moves a Power Box or, conduit before re-attaching the wire, the wire will be broken and just float in the air, unable to be activated again. My solution to this was just to move all of my power grid outside of the playable area because I wanted a fully powered home. I'm not on my Gaming PC at the moment but if anyone is interested in this and wants more clarification I can post some xEdit screens later fully explaining the needed edits. Link to comment Share on other sites More sharing options...
RuneDasRune Posted November 10, 2016 Share Posted November 10, 2016 This is not related to scripts but, is about setting up a pre-Powered location like Home plate. It seems a function was cut from the Ckit we received. If you want to create a player home with power you need to fix the "Power Grid" and all of the connections between Generator, (Power Box), Spline, Conduit, Spline, Conduit and so on in xEdit. The keywords do need to still be set in the Ckit but even so the connection will not take in game until the player activates the wire (spline) and re-connects it unless you make the connection in xEdit. also even after making the proper connection in xEdit if the player moves a Power Box or, conduit before re-attaching the wire, the wire will be broken and just float in the air, unable to be activated again. My solution to this was just to move all of my power grid outside of the playable area because I wanted a fully powered home. I'm not on my Gaming PC at the moment but if anyone is interested in this and wants more clarification I can post some xEdit screens later fully explaining the needed edits. Can you give a very basic explanation of how to make power connections in xEdit? Do i just set up my splines in CK and do something to those splines in xEdit?This could help me soooo much. I'll play around with it and see what i can find out by tinkering. Link to comment Share on other sites More sharing options...
chucksteel Posted November 10, 2016 Share Posted November 10, 2016 Yes, that's basically what you do. Set everything up in CK with the keywords for workshop item and workshop power (Sorry again not on my game PC so I can't remember the correct keywords) You need to then open in xEdit and find your workbench, near the bottom you'll see "Power Grid" it will be blank but needs info for power to work. (Look at Home Plate, that is partly how I figured this all out) The info is a connection to your Power Box or Generator. then for the power box or generator, it needs a spline connection set, Then the spline need a spline connection set to the power box or Generator and the first conduit. then the first conduit needs a spline connection set to the first spline. You then need to continue down the line until the entire power grid is set up and connected. (One of the issues I've found is that Splines are not getting the persistent flag set by the Ckit so you'll also need to set that in xEdit. ) (Helpful Hint: I gave my power system Ref ID's to make them easier to find in xEdit and be organized. Example, BTInt_PH_Spline_01, BTInt_PH_Concuit_01, BTInt_PH_Spline_02, BTInt_PH_Concuit_02 and so on. This way I knew which spline needed to be connected to which Conduit or Power box.) If you take a look at Home Plate's power grid and spline connections it will make sense, Home plate only has a small system. Again later tonight I can post some screens and give a better explanation. Edit to be clear, Look at Home Plates Power Grid and spline connections in xEdit not the Ckit. Link to comment Share on other sites More sharing options...
RuneDasRune Posted November 10, 2016 Share Posted November 10, 2016 You are a hero. Thank you so much I've been trying for weeks to figure this stuff out. I never thought to look at the workbench in FO4Edit, I've been looking at the splines and connectors all this time! Link to comment Share on other sites More sharing options...
chucksteel Posted November 10, 2016 Share Posted November 10, 2016 Well the credit really goes to zilav He pointed me in the direction of the workbench "Power Grid". Link to comment Share on other sites More sharing options...
Recommended Posts