Jump to content

Scripting Light Switches


woodrat

Recommended Posts

Yes I did try searching this, perhaps my search wasn't good enough but anyway my problem.

 

I'm trying to get a script so that when the player presses a switch several flood lights will light the perimeter of a fence. This includes the respective static lightbeam as well as an actual light.

 

I just can't seem to make heads or tails of it. I know this is most likely a simple thing to set up but I just don't know how to do it.

 

Any help please?

Link to comment
Share on other sites

Put this on a activator

 

Begin onActivate
If FLLight01REF.getdisabled == 1
FLLight01REF.enable
;And keep going to you have all refs here
else
FLLight01REF.disable
endif
end

 

Now if the lights if "off" when you start the game it will turn on first time you activate

and off second time

double click on a light in the render window, give it a REF like "FLLight01REF" "FLLight02REF" and so on

 

You can put several REF above "else" and put a .enable behind

under "else" have the same refs, but have a .disable behind

And befor .GetDisabled have the REF of one of your light

 

I just used "FLLight01REF" as a example, but you can make your own

 

PM if you need more help^^

Link to comment
Share on other sites

Create the lights you want in GECK normally but set them all to initially disabled and also give to each a reference name. Then in lightswitch's onactivate block have these lines:

if [lights are on; either check if one of them is on or use some global value to track this]

light1.disable

light2.disable

same for every light you have

else

light1.enable

.....

endif (or whatever this was. I'm not at geck atm and I keep mixing the syntax with programming languages)

This should work, at least in principle. I can't check it myself now.

 

 

Edit:

Seems that Alexx378 was faster and provided copypaste-ready code. I lose.

Link to comment
Share on other sites

[EDIT] did something stupid will report back if I can get it to work...

 

Yay, it was a stupid mistake on my part got it to work though.

 

Thanks to both of you for aiding me.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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