Jump to content

Spawning and linking a light's position to another object's?


FiftyTifty

Recommended Posts

I've got a wee conundrum.

 

I've made a mod that replaces all the moveable statics in TTW with items that use the exact same mesh. Now, unfortunately, many lamps that are MSTT were frozen in place, with a light placed directly under the top half of the mesh. What I'd like to do, is link a light object to every lamp item, which the player can then toggle on/off. But I'm not quite sure how to do that.

 

I'm thinking it would have something to do with NiNodes, whatever those are? Take the vanilla .nif files, place a NiNode at a specific point in the mesh, and (de)spawn a light at runtime which is bound to the NiNode, so it will always be properly in place with it's respective item.

 

Took a quick look at GeckWiki, and I did find a function that could do the trick: MoveToNode. But that doesn't permanently attach a ref to the node, it just moves one reference to the node's position. That's not usable for dynamic objects, really.

Link to comment
Share on other sites

I think you'd have better luck with making lamp post a "LIGHT" form. You could use the existing meshes, but attach additional NiNode to it and inside of that NiNode attach NiPointLight Node. NiPointLight Node will enable you to position light inside of Light form by moving its parented NiNode.
I'm not sure if this will work, but then you could use "SetNifBlockFlag" to set the first flag (Hidden) to 1 in order to hide the NiNode holding the NiPointLight node.

Link to comment
Share on other sites

  • 2 weeks later...

I think you'd have better luck with making lamp post a "LIGHT" form. You could use the existing meshes, but attach additional NiNode to it and inside of that NiNode attach NiPointLight Node. NiPointLight Node will enable you to position light inside of Light form by moving its parented NiNode.

I'm not sure if this will work, but then you could use "SetNifBlockFlag" to set the first flag (Hidden) to 1 in order to hide the NiNode holding the NiPointLight node.

Unfortunately, that would involve a bunch of cell event processing to cycle through every item, to ensure previously turned on items display the light when the player reloads the cell. I think a middle ground would be to just delete the reference, then swap it with a moveable static. But that's not ideal, as it will affect any items that touch it's collision.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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