Jump to content

Solar Panel Array [WIP]


Recommended Posts

At the moment I have the array setup as an activator and the electrical cabinet shown on the right side of the image has a lever. I’d like to connect the lever (open/close) state to an on/off state for the array (i.e., power is either on/off). Haven’t figured out how to do that yet. There is also an electrical connector on the cabinet where one can attached a wire. So at present the array is always on.

Link to comment
Share on other sites

At the moment I have the array setup as an activator and the electrical cabinet shown on the right side of the image has a lever.ÃàIâd like to connect the lever (open/close) state to an on/off state for the array (i.e., power is either on/off).ÃàHavenât figured out how to do that yet.ÃàÃàThere is also an electrical connector on the cabinet where one can attached a wire.ÃàSo at present the array is always on.

You can easily make a switch. It works as an activator with the same open / close sequences as a door. Or as an indicator. As an indicator, it can also work with on / off sequences.

https://youtu.be/7hJMYNMY6W8

Just find a ready made vanilla switch in ck, in activators and replace with your animation model.

https://disk.yandex.ru/i/pfhpbgOsCk7Ufw

Edited by South8028
Link to comment
Share on other sites

This looks extremely nice!

Reminds me of an idea I've got in the back of my head: "Realistic" Solar Panels that will stop producing power at night and during thunderstorms etc, as well as "working" batteries.

 

To make your array switchable on/off, you could either:

a) if the whole thing is an activator, give it the switchactivator (or whatever its called) keyword, then you can turn it on/off with SetOpen().

b) if the array cannot be an activator for any reason, make the connector a separate activator that snaps onto the array instead. Give the connector the keyword. You can then turn on/off the connector.

 

You might want to also add the BlockPlayerActivation keyword, so that Player may not directly interact (turn on/off) with the activator, but must use the lever instead (assuming the lever is a separate NIF, PlaceAtNode()'d onto the array).

Link to comment
Share on other sites

As it stands right now, the whole assembly is one nif, but the animation is setup on the lever. This not ideal as you can activate it any where along the perimeter of the array assembly. I tested it in-game using the workshopSwitchActivatorkeyword and the Default2StateActivator script, and this seemed to work okay. Niston, you idea of separate nifs with attach/snap points makes good sense to me. Takes to you and South8028 for the switch keyword suggestion. I think for simplicity I'll release the nif and textures as a modder's resource and let enterprise modders implement. Shouldn't be too hard to break apart the nif into respective pieces and add in those snap points.

 

[EDIT]...Here is the resource, use as you see fit in your mods.

FO4 Solar Panel Array

Edited by pepperman35
Link to comment
Share on other sites

Btw, you can easily spawn the lever from script - as it's an unpowered object by itself:

 

- Make sure there is a NiNode in the NIF that is named REF_ATTACH_NODE. You can rename the root node, or another node, doesn't matter which one. Can also create a new one - Just needs to be present.

- Add a new NiNode in the NIF where you want the lever to spawn

- Give the new NiNode a unique name, like SolarArray_AttachPowerSwitch.

- From a script on the solar array object, in it's OnLoad event handler, use Self.PlaceAtNode() with the lever Form and node name "SolarArray_AttachPowerSwitch" to spawn the lever at the named node and get an ObjectReference back.

- Set refattach parameter in the function call to true and also set deleteWhenAble parameter to true-

- In OnWorkshopObjectDestroyed Event handler, do a Lever.Delete()

 

The lever will be spawned exactly where you want it on load, and it will move with the Array when it's being moved around in workshop. It will get deleted when the workshop object is scrapped or stored, or when the cell unloads. You will possibly have to rotate the named NiNode to get the lever to appear with the correct orientation.

 

Can currently not recommend using the same approach for the power connector, due to the scrap crash problem with powered objects getting .Delete()'d (or removed by the game, such as when deleteWhenAble is being set to true!). The F4SE Team is working on a solution for safe Scrapping, but until that becomes available, the only safe way to "delete" a powered object from script is not to delete it, but to disable it instead - which brings along with it several drawbacks, the least of which is resource consumption by otherwise "dead" objects. Most significantly, disabled objects are still connected to the power grid.

 

So I recommend making the power connector snappable due to circumstances, but spawning the lever from script for user convenience. Perhaps you could exploit the fact that snappable objects may have more than one power connection and create a busbar object that, partly running underground, snaps to and connects several arrays in a line, provides a common power outlet connector in the form of an electrical box, or a power pole, perhaps.

Link to comment
Share on other sites

Btw, you can easily spawn the lever from script - as it's an unpowered object by itself:

 

- Make sure there is a NiNode in the NIF that is named REF_ATTACH_NODE. You can rename the root node, or another node, doesn't matter which one. Can also create a new one - Just needs to be present.

- Add a new NiNode in the NIF where you want the lever to spawn

- Give the new NiNode a unique name, like SolarArray_AttachPowerSwitch.

- From a script on the solar array object, in it's OnLoad event handler, use Self.PlaceAtNode() with the lever Form and node name "SolarArray_AttachPowerSwitch" to spawn the lever at the named node and get an ObjectReference back.

- Set refattach parameter in the function call to true and also set deleteWhenAble parameter to true-

- In OnWorkshopObjectDestroyed Event handler, do a Lever.Delete()

 

The lever will be spawned exactly where you want it on load, and it will move with the Array when it's being moved around in workshop. It will get deleted when the workshop object is scrapped or stored, or when the cell unloads. You will possibly have to rotate the named NiNode to get the lever to appear with the correct orientation.

 

Can currently not recommend using the same approach for the power connector, due to the scrap crash problem with powered objects getting .Delete()'d (or removed by the game, such as when deleteWhenAble is being set to true!). The F4SE Team is working on a solution for safe Scrapping, but until that becomes available, the only safe way to "delete" a powered object from script is not to delete it, but to disable it instead - which brings along with it several drawbacks, the least of which is resource consumption by otherwise "dead" objects. Most significantly, disabled objects are still connected to the power grid.

 

So I recommend making the power connector snappable due to circumstances, but spawning the lever from script for user convenience. Perhaps you could exploit the fact that snappable objects may have more than one power connection and create a busbar object that, partly running underground, snaps to and connects several arrays in a line, provides a common power outlet connector in the form of an electrical box, or a power pole, perhaps.

Thanks for the info. I had been reading up a bit on REF_ATTACH_NODE so this could be a perfect opportunity to experiment some.

Link to comment
Share on other sites

Update: Okay I pulled the lever assembly out from the solar array nif and make its own nif. The solar panel array now consists of the solar panels, the electrical cabinet and the electrical connector. It make sense to me to keep the connector as part of the cabinet. I set the array up as an activator, and put block player activation on it. Per Niston's suggestion, I added the two NiNodes to the Solar Panel Array nif, REF_ATTACH_NODE and SolarArray_AttachPowerSwitch. Added a script to spawn the lever at the named node. [Credit: deadbeeftffn for the script from the forum post, Is it possible to conjoin different activators into a single NIF?]

 

Next steps, gen up a little script for the lever to change the state of the solar panel array when the lever is activated.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...