DocClox Posted April 13, 2021 Share Posted April 13, 2021 I have a complex furniture nif that has a couple of attached lights. What I'd like to do is have the lights turn on when the furniture is in use and turn off again when not. It's not as simple as just toggling power to the lights: I want them off if the device is powered but empty. I can catch the events with OnActivate and OnExitFurniture, but I can't work out how to change the light state. Looking at the nif, I thought I might be able to send playidle("On") or playidle("TurningOn") or even playidle("UnpoweredOn") ... but I've had no luck. Last time I did this, I frigged it with separate addon meshes for on and off, and attaching light objects to provide the glow. I'll do that again if I have to, but it seems like a lot of fuss when there's a vanilla object with the functionality built-in. If only I can find the "on" switch. Link to comment Share on other sites More sharing options...
niston Posted April 13, 2021 Share Posted April 13, 2021 Try PlayGamebryoAnimation("<name>", true) You can see the anim names in preview window. Link to comment Share on other sites More sharing options...
DocClox Posted April 13, 2021 Author Share Posted April 13, 2021 (edited) Try PlayGamebryoAnimation("<name>", true) You can see the anim names in preview window.I keep forgetting about the preview window. And I've only tried from the console, so "PlayGamebryoAnimation" could well be what I'm missing. Thanks. I'll give that a shot. [edit] Good call about the preview window. Looks like I had the right event names from the nif, so my problem must have been that I was using "playidle" from the console rather than PlayGamebryoAnimation Edited April 13, 2021 by DocClox Link to comment Share on other sites More sharing options...
niston Posted April 13, 2021 Share Posted April 13, 2021 Some NIFs also just have havok anims. You can use PlayAnimation() for these. Link to comment Share on other sites More sharing options...
DocClox Posted April 13, 2021 Author Share Posted April 13, 2021 Thanks. I'm good with scripting, but animation and nif files are still a bit new to me. Link to comment Share on other sites More sharing options...
DocClox Posted April 14, 2021 Author Share Posted April 14, 2021 It's still not co-operating. objectreference function add_spot(string node) int count = 10 objectreference ref = placeatnode(node, DLC06VltLightCeiling, abForcePersist=true, abAttach=true) while ! ref.Is3dLoaded() && count > 10 count -= 10 utility.wait(0.1) endwhile ref.setscale(0.7) utility.wait(0.1) ref.playGamebryoAnimation("On", true) return ref endfunction I think the event is being processed by the graph, since subsequent attempts to turn the light on yield an error in the logs. But the light does not glow or emit. I tried setting up a generator and pylon ahead of time, but that doesn't seem to help. I did wonder if it was because I placed them from papyrus rather than the workshop, but the only thin I could think of to do in that case would be to point the light at the local workshop, and that property appears to be read only.Apart from that, I'm out of ideas. Link to comment Share on other sites More sharing options...
dylbill Posted April 14, 2021 Share Posted April 14, 2021 If it's a powered light, you can do this: Ref.PlayAnimation("Powered") Ref.Activate(Game.GetPlayer()) ;player activates light, turning it on.I do something similar in my Solar Street Lights mod. Link to comment Share on other sites More sharing options...
niston Posted April 14, 2021 Share Posted April 14, 2021 For that light, at least the texture should change when you play the On/Off animations. Does it?Also it has a p-AttachLight connection point. Maybe the actual light source is added by OMOD or something. I'm not familiar with this method, so I can't be more specific. Link to comment Share on other sites More sharing options...
DocClox Posted April 14, 2021 Author Share Posted April 14, 2021 For that light, at least the texture should change when you play the On/Off animations. Does it?Not a sausage. I'm wondering if I need to set a linked ref to the workshop. There's a lot I don't understand about script-pacing workshop items. Link to comment Share on other sites More sharing options...
niston Posted April 14, 2021 Share Posted April 14, 2021 A linked ref is not required to play gamebryo anims.Perhaps edit the nif in nifskope and rip out the havok behavior graph under extra data. Link to comment Share on other sites More sharing options...
Recommended Posts