Zachary8222 Posted April 15, 2010 Share Posted April 15, 2010 Hey, I am making my first big mod and I am doing a vault. Okay here is the setup, you walk in through a cave just like vault 101, you hit the controls open the door(it works btw), then you are in the vault gear room you go through a door and you hit a hallway, in the hallway I have a door with a key that goes into the electrical room. The electrical room is going to have lots of switches to operate the vault and mechanical static pieces. Okay so I have created a rip off of electricalswitch02 that opens the vault gear door and it works.I have created the room and the switch and it all works. No problems there. Now, I want to create another switch that will open a door to the security section of the vault. You will need either the key or hit the switch to unlock it and then open it. I can do the key and the door part but I can't figure out how to get this switch to unlock and then activate(open) the door? What script should I use on the door?What script should I use on the activator(switch)?what ref should I use? thanks Link to comment Share on other sites More sharing options...
pkleiss Posted April 15, 2010 Share Posted April 15, 2010 Since you have set the door to be opened via a key, the standard way of ising an activate parent on the door to open the door via switch won't work. You will have to make your door persistent and give it a unique Reference Editor ID and use that ID in a script running on the activation switch. The script should look like this: SCN MyDoorSwitchScript Begin OnActivate If MyDoorRef.GetOpenState == 3 ;its closed MyDoorRef.SetOpenState 1 ;Open the door ElseIf MyDoorRef.GetOpenState == 1 ;its open MyDoorRef.SetOpenState 0 ;close the door MyDoorRef.Lock ;Lock the door so you'll need the key to open it directly Endif End MyDoorSwitchScript and MyDoorRef are examples, you can use any name you want. But the name you use for the door must be the Reference Editor ID of the Door. Link to comment Share on other sites More sharing options...
Zachary8222 Posted April 15, 2010 Author Share Posted April 15, 2010 Wow, that actually worked! You're the king man. Last question. I got the other switch, in the electrical room right now, that operates the vault gear door using the animation when you activate it. You see the little lever moving, is there a way to make the myrefdoor switch do the same thing? Link to comment Share on other sites More sharing options...
pkleiss Posted April 15, 2010 Share Posted April 15, 2010 Wow, that actually worked! You sound surprised. You see the little lever moving, is there a way to make the myrefdoor switch do the same thing?Just add the default activate command to each code segment like this: SCN MyDoorSwitchScript Begin OnActivate If MyDoorRef.GetOpenState == 3 ;its closed MyDoorRef.SetOpenState 1 ;Open the door Activate ElseIf MyDoorRef.GetOpenState == 1 ;its open MyDoorRef.SetOpenState 0 ;close the door MyDoorRef.Lock ;Lock the door so you'll need the key to open it directly Activate Endif End Of course, now you may get the wrong colored light on the switch if you open the door directly. You could then add a script to the door such that when its opened or closed manually, it changes the switch's animation to match. But that may not be a big deal to you. Link to comment Share on other sites More sharing options...
Zachary8222 Posted April 16, 2010 Author Share Posted April 16, 2010 Wow, that actually worked! You sound surprised. You see the little lever moving, is there a way to make the myrefdoor switch do the same thing?Just add the default activate command to each code segment like this: SCN MyDoorSwitchScript Begin OnActivate If MyDoorRef.GetOpenState == 3 ;its closed MyDoorRef.SetOpenState 1 ;Open the door Activate ElseIf MyDoorRef.GetOpenState == 1 ;its open MyDoorRef.SetOpenState 0 ;close the door MyDoorRef.Lock ;Lock the door so you'll need the key to open it directly Activate Endif End Of course, now you may get the wrong colored light on the switch if you open the door directly. You could then add a script to the door such that when its opened or closed manually, it changes the switch's animation to match. But that may not be a big deal to you.As a php developer I can't ever get anything working on my first try. Thanks, You've helped a tremendous amount. I'll make sure to send you a link to the mod if I upload it. Link to comment Share on other sites More sharing options...
FalloutFan6403 Posted April 20, 2012 Share Posted April 20, 2012 I'am a bit confused with the first script. Link to comment Share on other sites More sharing options...
Recommended Posts