Jump to content

Geck scripting and other questions.


gunslinger6792

Recommended Posts

Well the best I've been able to accomplish is my light switch no longer disappearing but the lights are now permanently off. I'm too tired to try this more tonight and I'm probably making mistakes. I'm going to upload a link to my mod thus far. If you want to check it out in the geck or in the game. There is a crude door set up near the street of the novac tent/food thing. Maybe you'll be able to see what I'm doing wrong.

 

http://www.mediafire.com/download/yuuvu4agrorn2v2/industrial_house.rar

Link to comment
Share on other sites

Alright, you've made a couple of mistakes, but they're pretty easy to fix. :smile:

 

You've not set up the enable parent at all. To do this, double-click on one of the lights, you'll see the reference window. Click on the arrow on the left until you see a tab entitled "Enable Parent". Once you have that, click "Select Reference in Render Window", a red crosshair will appear. When you hover over your Xmarker with it, it will turn white. Double-click on your XMarker. Now, if you're editing an "on light" you're done! However, if you're editing an "off light", don't worry, I'll explain what I mean by that in a moment, tick the "Set enable state opposite of parent" box.

 

Now, the way I do lights is by having two lights occupy the same space. One will glow as if it were on and the other will not. To know which is which is fairly easy, in the object window, a suffix of either "on" or "off" can generally be found in the IDs of the items, the names that appear in the object window, you've only placed "OffRmLight01"s, so when you activate the switch, they'll just disappear, because you don't have any "off lights". This is easily remedied! simply drag, in your case, "OffRmLight01OFF" over to the object window, or use whatever method you prefer to add items to the game, here you should set up the enable parent of the off light and set it to a persistent reference You'll also need to tick the "initially disabled" box, since it'll be a little harder later. Then place it in the same spot as the light you want to be able to turn off. An easy way to do this is to copy the coordinates from the "on light" to the "off light" from the reference window. Then rinse and repeat for the rest of your lights. :smile:

 

One other thing I ought to mention, I noticed that you had two switches linked to the same XMarker, that means that they'll control the same lights. If you want to have them control different lights, you'll need to link the other switches to their own XMarkers and then parent the lights you want to control to that XMarker.

 

Alternatively you can give all the lights their own unique references and then use those in a script. I'd advise against this, since it lengthens your script for no good reason, and you'd have to write multiple scripts for different switches.

 

I apologise if anything's at all unclear, as always, I'm happy to explain anything I failed to the first time around!

Edited by Jojash
Link to comment
Share on other sites

Well I finally got my lights working hurrah!!!!! I would like to set up some sort of terminal that locks and unlocks a door. I'm able to set a locked door that a terminal unlocks but I'd like the same terminal to lock. In additin to that is it possible to have a terminal do that and have key that can unlock the door also?

Link to comment
Share on other sites

The easiest way to go about doing that is to use the "GetOpenState" function. This checks to see if a door is open, 1, or closed, 0.

 

Open your terminal's statistics window and click on the menu item that you want to open the door. Then, right-click in the "item-conditions" box. Now, find "GetOpenState" and select it, after that you need to set the "value" box to "0" and then the "Run on" box to "Linked Reference". Type in the "Item Result Script" box:

 

ref rDoor
set rDoor to GetLinkedRef
rDoor.SetOpenState 1

 

This will open the door. If you just want to unlock it, replace "SetOpenState 1" with "Unlock" and "GetOpenState" with "GetLocked".

 

To lock or close the door, just replace all of the ones with zeros in my explanation! :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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