I've replaced the static Vacuum Tube Lights and Railway Lamps with pickable and placeable ones that you can turn on and turn off. For this I copied how it's done in http://www.nexusmods.com/fallout3/mods/13490/? but tweaked the scripts etc. a bit. It works perfectly (and I actually think http://static-8.nexusmods.com/15/images/120/1768079-1432506379.jpg when removing the "fake lights" and have "real" lamps instead), but it's basically set up so there are two different objects/meshes that are replaced via the script - one is the lamp when lit, one is the lamp when unlit - and it's a bit "immersion breaking" that you actually notice that the lamp nifs get switched when turned on and off. Also, when the lamps are placed a bit unstable, they can turn over in the process.
So I thought that I'd have a script that rather adds a light to the item when lit and removes the light when turned off, but how would I do this?
As it is the scripts for the Railway Lamps look like this:
scn lowllamp01turnonshort iButtonshort iButtonPressedref rMySelfBegin onactivate Player set rMySelf to GetSelf ShowMessage lowlightoff set iButtonPressed to 1endBegin GameMode if iButtonPressed == 1 set iButton to GetButtonPressed if iButton > -1 set iButtonPressed to 0 if iButton == 0 ; Enable ? rMySelf.disable rMySelf.PlaceAtMe lowllamp01 rMySelf.markfordelete elseif iButton == 1 ;take ? rMySelf.disable Player.Additem lowllamp01off 1 rMySelf.markfordelete elseif iButton == 2 ;do nothing ? endif endif endif endifend
And
scn lowllamp01turnoffshort iButtonshort iButtonPressedref rMySelfBegin onactivate Player set rMySelf to GetSelf ShowMessage lowlighton set iButtonPressed to 1endBegin GameMode if iButtonPressed == 1 set iButton to GetButtonPressed if iButton > -1 set iButtonPressed to 0 if iButton == 0 ;Disable ? rMySelf.disable rMySelf.PlaceAtMe lowllamp01off rMySelf.markfordelete elseif iButton == 1 ;take ? rMySelf.disable Player.Additem lowllamp01off 1 rMySelf.markfordelete elseif iButton == 2 ;do nothing ? endif endif endif endifend
Can I just create a light and then add it via a
rMySelf.PlaceAtMe lowllamplight
line? And how would I remove it when it's turned off? I guess it's (hopefully) rather simple, but I svck at scripting so I'm a bit lost on how to change the scripts so it works as I'd like.