Anyone mind helping me with a very basic script?

Post » Tue Sep 29, 2015 10:02 am

So in a mod im making I have some unique Light ID's. These special lights actually make the room much darker. Im trying to make an activator that the player can hit in order to disable these special lights and make the cell much brighter. Here is what I've tried and it doesn't work. (the light ID is Dark_1000)

begin light_switch

If ( onactivate == 1 )

"dark_1000"->disable

endif

end

User avatar
Marcia Renton
 
Posts: 3563
Joined: Fri Jan 26, 2007 5:15 am

Post » Tue Sep 29, 2015 6:20 am

Hopefully someone else with more empirical information shows up but IIRC, disabling lights doesn't really work as the game won't update properly. But I think that you can move them...

With that said, I just found that I was able to disable a light and the game updated just fine for something else that I am working on. But I am thinking that could be because I had MGEXE's Per Pixel Lighting activated which modifies the way lights are rendered.

With that all said, just as a matter of best practice, I would recommend using a unique prefix for your IDs like w5_Dark_1000. This will help make it so that your mod does not conflict with other mods. Especially with such a generic ID.

User avatar
Ross Zombie
 
Posts: 3328
Joined: Wed Jul 11, 2007 5:40 pm

Post » Tue Sep 29, 2015 1:36 am

ok thanks for the advice. I will try looking into scripts to move the lights instead of enabling/disabling them.

User avatar
Reanan-Marie Olsen
 
Posts: 3386
Joined: Thu Mar 01, 2007 6:12 am

Post » Tue Sep 29, 2015 2:35 am

Disabling works fine for removing lights in my experience. Try doing your script like this:

You'll need to create one global (short), here I called it "MyLights_Toggle". Attach the Local script to your light sources and the Switch script to your activator. This includes the ability to re-enable the lights. If you didn't want that just don't include the elseif sections.

begin MyLights_Localif ( MyLights_Toggle == 1 )    if ( GetDisabled == 1 )        set MyLights_Toggle to 0        return    endif    Disableelseif ( MyLights_Toggle == 2 )    if ( GetDisabled == 0 )        set MyLights_Toggle to 0        return    endif    Enableendifend
begin MyLights_Switchshort MyLights_Statusif ( OnActivate )    if ( MyLights_Status == 0 )        set MyLights_Status to 1        set MyLights_Toggle to 1    elseif ( MyLights_Status == 1 )        set MyLights_Status to 0        set MyLights_Toggle to 2    endifendifend
User avatar
Veronica Martinez
 
Posts: 3498
Joined: Tue Jun 20, 2006 9:43 am

Post » Tue Sep 29, 2015 4:15 am

What Melchior Dahrk means I think is that disabling/enabling the light source may not update the scene light immediately.
In my experience, If the main light source is what you are disabling, usually moving the light a little after changing its enabled/disabled state will work, else best workaround is to add a light to player, move player a little, remove light from player (works with e.g. herbalism mod changing kwama eggs)
User avatar
Helen Quill
 
Posts: 3334
Joined: Fri Oct 13, 2006 1:12 pm

Post » Tue Sep 29, 2015 10:40 am

Thanks, abot. I knew there was something about disabling and moving... :D

User avatar
jennie xhx
 
Posts: 3429
Joined: Wed Jun 21, 2006 10:28 am

Post » Tue Sep 29, 2015 1:36 am

Thank you so much guys. This helped me a lot!

User avatar
Cash n Class
 
Posts: 3430
Joined: Wed Jun 28, 2006 10:01 am

Post » Tue Sep 29, 2015 8:28 am

No idea if this would work (disabled lights seem to perform as expected on my end), but perhaps calling the http://www.uesp.net/wiki/Tes3Mod:SetAtStart function after disabling could force the light origin to be updated.

User avatar
Imy Davies
 
Posts: 3479
Joined: Fri Jul 14, 2006 6:42 pm

Post » Tue Sep 29, 2015 4:00 am

Out of curiosity, Greatness7: did you test it without PPL?

User avatar
Guy Pearce
 
Posts: 3499
Joined: Sun May 20, 2007 3:08 pm

Post » Tue Sep 29, 2015 9:20 am

Yeah, tested with and without and worked fine for me. Might be something to do with what kind of light source you use though.

User avatar
jasminĪµ
 
Posts: 3511
Joined: Mon Jan 29, 2007 4:12 am

Post » Tue Sep 29, 2015 2:47 am

I think that when you disable/enable item in cell you are currently in, it will not be correctly lit. Is it possible you meant this problem with enabling/disabling? :)

User avatar
Maria Leon
 
Posts: 3413
Joined: Tue Aug 14, 2007 12:39 am

Post » Tue Sep 29, 2015 1:50 am

Potentially (I know that the CS doesn't update well when duplicating items). I don't know anymore - perhaps I have been operating under false pretenses for a while. If there's no issue, there's no issue. Like I said, I have a light disabling in my mod at the moment and it seems to work fine, lol. I've just been avoiding doing so for a while based on what I thought I knew.

User avatar
Britney Lopez
 
Posts: 3469
Joined: Fri Feb 09, 2007 5:22 pm

Post » Tue Sep 29, 2015 2:31 am

Try this https://www.dropbox.com/s/p58x6j5k80yw9v6/LightTest.esp?dl=0 of the scripts I posted above. It'll add 5 lights and a light switch to your inventory, just drop them and toggle the switch and it seems to work on my end. Things also work fine when I just walk up and disable any light in the room, so if there is a problem I'm not sure what causes it.

User avatar
Charity Hughes
 
Posts: 3408
Joined: Sat Mar 17, 2007 3:22 pm


Return to III - Morrowind