Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Toggleable lights and the SetPos command


Citrus
 Share

Recommended Posts

I want to make toggleable lights. Simple enough, heh? I already have a script going and it works by changing an "Off" light for an "On" light when I activate it. The "Off" light is the activator and the "On" light is just a regular light. I am using the SetPos command to move them up and down to position in order to simulate the lighting action. The problem is, the lights don't update. You can see that the "On" light came down but it only lights itself; the surroundings stay the same.

I have read it may be a problem with the SetPos command and that it isn't updating (or doesn't update) the lights. I also tried the PositionCell command but the sucker doesn't move the "On" light to where I want it to; maybe I'm doing something wrong but I've looked where I could have missed something but didn't find anything. Either way, any help is appreciated.

For the record, here is the script I'm using:

scn ePCandle2ndFloor

short OnOff

Begin OnActivate

;turn on the light
if OnOff == 0
Candle01On.SetPos Z 67.9321
Candle01Off.SetPos Z 1000.9321
set OnOff to 1

;turn off the light
elseif OnOff == 1
Candle01Off.SetPos Z 67.9321
Candle01On.SetPos Z 1000.9321
set OnOff to 0
endif
End[/codebox]

Link to comment
Share on other sites

scn ePCandle2ndFloor


short OnOff


Begin OnActivate


          ;turn on the light

        if OnOff == 0

               disable Candle01On

               Candle01On.SetPos Z 67.9321

               Enable Candle01On

                    Disable 

                    Candle01Off.SetPos Z 1000.9321

                    Enable

                    set OnOff to 1

End

I think thats what it would need to look like... have you looked at I think its called "turnflameson" and "hasflames" or something like that? I've not looked into it but it sounds like what your trying to do... someone around here probably knows more :)

Link to comment
Share on other sites

Bear is right, when you move persistent references you should disable-then-move-then-enable so the engine will visually update their position.

I've made a lot of toggle-able lights, and I usually just enable/disable instead of moving them. Sometimes the lights themselves are activators, and sometimes I use a tiny collision box as the activator and plop it in front of the lights instead, just depending.

Link to comment
Share on other sites

Moving lights is tricky, because lights don't behave like other objects when moved.

Disable and enable do not solve it, I am afraid.

I once did a lot of tests to answer a question on the Beth forums and found a perfect solution.

Problem is: the thread is gone and I don't remember the details.

I must have the answer in a text file somewhere in my PC, but I cant look for it today.

If you are interested, I will find it tomorrow and post the solution.

Link to comment
Share on other sites

scn ePCandle2ndFloor


short OnOff


Begin OnActivate


          ;turn on the light

        if OnOff == 0

               disable Candle01On

               Candle01On.SetPos Z 67.9321

               Enable Candle01On

                    Disable 

                    Candle01Off.SetPos Z 1000.9321

                    Enable

                    set OnOff to 1

End

I think thats what it would need to look like... have you looked at I think its called "turnflameson" and "hasflames" or something like that? I've not looked into it but it sounds like what your trying to do... someone around here probably knows more :)

I used that script, with a slight correction at the end (to terminate the If cycle and it doesn't work. The "On" candle comes down and the "Off" candle doesn't go up, resulting in strange graphical anomalies. It doesn't light anything but itself, just like what happened with me.

The HasFlames command you mentioned is from OBSE; I won't use it for such a simple mod. Still, thanks for the help, mate.

Bear is right, when you move persistent references you should disable-then-move-then-enable so the engine will visually update their position.

I've made a lot of toggle-able lights, and I usually just enable/disable instead of moving them. Sometimes the lights themselves are activators, and sometimes I use a tiny collision box as the activator and plop it in front of the lights instead, just depending.

Hmm, do both of your lights (the "On" and "Off" ones) are activators? Do you keep both in the same exact place (same exact coordinates) and have one disabled and the other one enabled, and then you switch their states as you activate one? Nevermind, I'll take a look at one of your house mods and see if I can find an answer.

Moving lights is tricky, because lights don't behave like other objects when moved.

Disable and enable do not solve it, I am afraid.

I once did a lot of tests to answer a question on the Beth forums and found a perfect solution.

Problem is: the thread is gone and I don't remember the details.

I must have the answer in a text file somewhere in my PC, but I cant look for it today.

If you are interested, I will find it tomorrow and post the solution.

Ok, I'll wait. This is basically the last scripting thing I have left to do so I have time. That also allows me to run through the mod tweaking some more things.

Link to comment
Share on other sites

Hmm, do both of your lights (the "On" and "Off" ones) are activators? Do you keep both in the same exact place (same exact coordinates) and have one disabled and the other one enabled, and then you switch their states as you activate one? Nevermind, I'll take a look at one of your house mods and see if I can find an answer.

Actually, have a peek at greenwarden's cabin here at TESA. I rigged the outdoor lights, and the method I used there has become my favorite.

Link to comment
Share on other sites

Actually, have a peek at greenwarden's cabin here at TESA. I rigged the outdoor lights, and the method I used there has become my favorite.

:wallbash: I feel incredibly stupid now. I can't even believe I was trying to go through the complicated road. I needed the "On" lamp disabled for starters but I couldn't figure out how to do it. Turns out there's a checkbox in the the Reference pop-up to make it initially disabled. That way, what you and Bear said makes absolute sense. If it worked in Greenwarden's cabin, it'll have to work on my house too. Thanks a lot for the help. This turned out to be my rush in getting things done right rather than a big scripting problem.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...