Jump to content

Geck scripting and other questions.


gunslinger6792

Recommended Posts

I'm trying to get a little more advanced with the geck. While I don't know how to write code I think I may be able to reverse enginer a few bits here and there.

 

1) I'm trying to rig my main lights to a light switch. After looking at the GECK's website and poking around a few mods I came up with this.

ScriptName LightSwitchScript

 

ref light

 

Begin OnActivate

if light == 0

set light to GetLinkedRef

endif

 

if light.GetDisabled

light.Enable

OffRmLight01onREF.enable 0

OffRmLight02onREF.enable 0

OffRmLight03onREF.enable 0

OffRmLight04onREF.enable 0

OffRmLight05onREF.enable 0

OffRmLight06onREF.enable 0

OffRmLight01onREF.disable

OffRmLight02onREF.disable

OffRmLight03onREF.disable

OffRmLight04onREF.disable

OffRmLight05onREF.disable

OffRmLight06onREF.disable

 

else

light.Disable

OffRmLight01onREF.enable 0

OffRmLight02onREF.enable 0

OffRmLight03onREF.enable 0

OffRmLight04onREF.enable 0

OffRmLight05onREF.enable 0

OffRmLight06onREF.enable 0

OffRmLight01onREF.disable

OffRmLight02onREF.disable

OffRmLight03onREF.disable

OffRmLight04onREF.disable

OffRmLight05onREF.disable

OffRmLight06onREF.disable

 

endif

Activate

End

 

Will that work?

 

2) What are X-markers?

 

3) What are north markers? I see them used a lot in vanilla and I have clue what they're there for.

 

4) I'd like to rig a terminal to lock a door can anyone provide a tutorial on that or give me a few pointers?

 

I know this is a lot to ask but I am willing to do the work so thank you for reading this any help you can give.

 

Edit after testing my script out I got current== and it won't save so I know I'm typing something wrong in or more like missing something.

Edited by gunslinger6792
Link to comment
Share on other sites

1) "Light" seems fairly useless in that script, assuming that the other references are persistent references, are you aware of "enable parents"? These will let you disable or enable multiple references without having to list them all as you have. As for the script not saving, my guess would be that the references you've listed aren't persistent references and can't be used. I'd recommend changing the references there to be children of "light" so that you can shorten your script to:

ScriptName LightSwitchScript
 
ref rlight
 
Begin OnActivate
        if rlight == 0
               set rlight to GetLinkedRef
        endif
 
        if rlight.GetDisabled
               rlight.Enable 0
        else
              rlight.Disable
        endif
        Activate
End

2 & 3) Here's an explanation of both X-markers and North-markers, if that doesn't quite clear it up though, I'm happy to answer any questions.

 

4) the "My first Vault" tutorial actually covers this, here's a link. Again, if anything's unclear I'm happy to help.

 

I hope this is of some use! :smile:

Edited by Jojash
Link to comment
Share on other sites

1) "Light" seems fairly useless in that script, assuming that the other references are persistent references, are you aware of "enable parents"? These will let you disable or enable multiple references without having to list them all as you have. As for the script not saving, my guess would be that the references you've listed aren't persistent references and can't be used. I'd recommend changing the references there to be children of "light" so that you can shorten your script to:

ScriptName LightSwitchScript
 
ref rlight
 
Begin OnActivate
        if rlight == 0
               set rlight to GetLinkedRef
        endif
 
        if rlight.GetDisabled
               rlight.Enable 0
        else
              rlight.Disable
        endif
        Activate
End

2 & 3) Here's an explanation of both X-markers and North-markers, if that doesn't quite clear it up though, I'm happy to answer any questions.

 

4) the "My first Vault" tutorial actually covers this, here's a link. Again, if anything's unclear I'm happy to help.

 

I hope this is of some use! :smile:

The script you made saved however when I went in game to test the light switch when I pressed it it literally disappeared. As for the lights themselves. I named all of them because they're other lights in the house I only want to turn off most of the lights. I also have no idea what persistent references are. I'll look it up though. The other things you listed look helpful so thank you :)

Link to comment
Share on other sites

To turn off most of the lights, just parent the ones you'd like to turn on and off to "light". The reason they disappeared is because that's what "disable" does, to stop that from happening you need to set the enable state to "opposite of parent" on the "off" lights, so that when you turn off the lights the "on" lights, the ones that glow, are disabled and the "off" lights, the ones that don't, are enabled. I really should have mentioned that to start with, shouldn't I? Sorry! :)

Link to comment
Share on other sites

What have you linked the light switch to? I've been assuming that it's linked to either an Xmarker or one of the lights themselves that you've been using as the "enable parent". If not, you need to link it to your "enable parent", that should stop it from disappearing.

Edited by Jojash
Link to comment
Share on other sites

I'm not sure if you understand. The lights didn't disappear just the light switch. What do you mean opposite of the parent and how would I write that?

 

Hey gunslinger,

 

So this is how I do it for a bunch of lights and one switch (I use a script similar to the one Jojash gave you).

 

I put into the render window one activator, one xmarker and several light objects.

 

I right click edit on the activator (usually a switch, but it can be any static model that you want to use to turn on/off any effect that you want to enable/disable) and link ref it in the LinKed ref tab to the xmarker. Xmarkers are always persistent references by default and I also mark them, on the first page, as initially disabled.

 

Then I go to each light object and one by one do the following:

Rightclick edit and on the first page tick persistent reference and initially disabled. Then I go to the enable parent tab and connect it to the xmarker that I just set up as the Linked Ref to the activator and then I tick it to "Pop In" which is a box directly underneath where you pick the reference you have attached it to.

 

Once that is all set up I attach the script to the activator and test it in game the next time I go in to test.

 

 

The only time I do enable opposite of parent is when I have one activator and one object that is activated. But if there is the intermediary of the Linked Ref I leave the xmarker and the object being enabled in the same state (both being enabled and disabled at the same time).

 

I've written it all down like this hoping it helps you. All the pieces are here in the thread, but I thought all at once might be clearer. I figured it out by reverse engineering it so I assume it's correct as it always works.

 

:smile: llama

Link to comment
Share on other sites

First off I didn't know that it needed to be linked to anything. I tried just now (before daemonGrin and llama posted) to link the switch to an xmarker so far I haven't successful in doing so.

 

@daemonGrin Honestly I'm not sure. Trying to do a script when I don't know how to write script is like an illiterate person trying to read a car manual lol.

 

I"m going to break down what llama said and try again.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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