Jump to content

Light Switch Script not working.


Niteslayer

Recommended Posts

Okay so I take the following steps.

 

I create a switch, put the script on the switch.

 

I create a light bulb, activate and/or enable parent (tried both so fa), and I link it to point at the switch, set the light to initially disabled.

 

I turn on the game, I flick the switch, The light turns on and the switch completely disappears.

 

How do I get the switch to stop disappearing?

 

I am using this script:

 

ScriptName LightSwitchScript

 

ref light

 

Begin OnActivate

if light == 0

set light to GetLinkedRef

endif

 

if light.GetDisabled

light.Enable

else

light.Disable

endif

Activate

End

 

 

Thanks for any advice.

Link to comment
Share on other sites

ScriptName LightSwitchScript

short IsOn

Begin OnActivate
if ( IsOn == 0 )
	"[color="#FF0000"]REFERENCE[/color]".Enable
	Activate
	set IsOn to 1
else
	"[color="#FF0000"]REFERENCE[/color]".Disable
	Activate
	set IsOn to 0
endif
End

 

REFERENCE being the light. If you have an light that is on and one that is off, set the one that is off to the parent, make that your REFERENCE instead, and set the one that is on and the light to opposite enable state of the parent.

Link to comment
Share on other sites

So the other script doesn't even work? It's on the geck website :(.

 

Anyways with this script you gave me if I wanted to add a chain of lights how would I incorporate that into the script?

Would it be something like reference, reference, reference .enable or :

reference.enable

reference.enable

reference.enable

 

?

 

Thanks for the help ill go try this one and see how it works out.

 

Nevermind, Figured it out. Thanks for all your help I had been trying to get that other script working for a couple hours lol.

Link to comment
Share on other sites

The script on that website is right, but your setup isn't. To me it seems too complicated to bother with. I find my method much easier.

 

You would want one parent reference ( the one referenced in the script ). It doesn't matter what your parent reference is, as long as you have the enable state opposite of parent for each object checked accordingly.

 

Let's say your parent is a LightCeilingVaultR02 ( in Static ), and you have three other LightCeilingVaultR02's.

 

You would want to give your parent a reference ID, and check its persistence ON. Then you would want to set the other three lights to use the first one as an enable parent, and the "pop in" box checked. You can find these properties by double-clicking the object.

 

http://geck.bethsoft.com/images/thumb/4/49/SetLockTutorial.jpg/300px-SetLockTutorial.jpg

 

Now you would place 4 of the LightCeilingVaultR02on, set their enable parent to the first LightCeilingVaultR02, but with "Set Enable State to Opposite of Parent" checked also.

 

With the grid on, move these lights into the same position as the off ones.

 

You would then create 4 lights, set the first LightCeilingVaultR02 as the enable parent with "Set Enable State to Opposite of Parent" checked, and move them into position.

 

It's also important that you have a '0' after Enable and Disable ( in your script ) if you don't want the objects to fade in and out.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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