RedNinja029 Posted January 23, 2018 Share Posted January 23, 2018 After looking at a couple of videos and reading several threads and having a jab at doing it myself a dozen times I can;t get what I need to happen, happen. I have a door called "DoorBunker" which IS set as a persistent reference.I have a switch Called "BunkerDoorSwitch" I have created a script called "LockDoorSwitch" I want the Door to close and locked (requiring key) on activation of the switch.I have a key card setup so that's done with. But there's something wrong with the script As mentioned door is set as a persistent reference. The switch itself is linked to it. =================================scn LockDoorSwitch begin onactivate player ref myLinkset myLink to getLinkedRefmyLink.lock end===================================^ i know that is just locking the door i copied the script from a terminal thought using a linked ref would apply the same effect but it does not work at all. then i discovered this script>>>>>>>============================scn DoorCloseLockAvgOnActivate;;This script will cause a door to close and lock on activation from a reference other than the player;;================================== begin onActivate if isActionRef player == 0lock 2setOpenState 0elseactivateendif end=================================this did not work either.Where am I failing here...I right clicked and made new script, save it then pressed the red compile save button then closed and saved the plugin. Also the last script maybe erroneous in the fact i wish to use a key for it anyhow instead an average lock. I'm guessing lock 0 is a key like the console commands. As you can see I've done some research before posting here I hope someone can guide me here in a solution for a simple door close+lock activated switch which i want to be able to use multiple time not just once. Incase I caused confusion, the would be unlockable as per normal activation with a keycard. the switch wouldn't require the keycard but just initiate a lockdown of that specific door upon activation by the player him/herself. Anyone able to help me with this so I can progress and on with my mod would be greatly appreciated. It's one of the final things I need to do in the main cell. The other being auto closing door script but I've seen many scripts for that which haven't yet worked for me but I'm sure one of them will. hopefully. When I upload the mod I'll credit you in name in the description for your time, input and help. Link to comment Share on other sites More sharing options...
EPDGaffney Posted January 23, 2018 Share Posted January 23, 2018 (edited) Red Compile button? You don't mean...Recompile All Scripts...do you? Please do not save your file if you did that. I'll look at the rest of what you wrote but I'm putting this through immediately in hopes that you have not saved yet or have a back-up. Edit: Oh, you did save. Well, if there's a back-up, you can use that, or you can use FNVedit. It's a good practise to clean your mod with FNVedit anyway, so just make sure you do that. What that button does is it copies all vanilla scripts into your .esp, which is really not good for a lot of reasons. Edited January 23, 2018 by EPDGaffney Link to comment Share on other sites More sharing options...
EPDGaffney Posted January 23, 2018 Share Posted January 23, 2018 (edited) So, tell me do I understand this right: you want a switch to open and close the door and you want it only possible to open or close by activating that switch, and you want it only possible to activate that switch if the player has the keycard. Correct? That would be this pair of scripts: scn BunkerDoorSwitchScript Begin OnActivate If IsActionRef Player If player.GetItemCount KeyCard >= 1 ; replace 'KeyCard' with the name of your key card. DoorBunkerREF.Activate Player ; note that I am using 'REF' in the name of your door reference; just a visual thing that helps with organisation EndIf EndIf End scn DoorBunkerREFScript Begin OnActivate Return End To make it look a bit nicer you may wish to do some more advanced stuff with the prompts, but I'm not completely sure what you're doing, so I'll wait on that. Edited January 23, 2018 by EPDGaffney Link to comment Share on other sites More sharing options...
RedNinja029 Posted January 24, 2018 Author Share Posted January 24, 2018 Hey Gaffney going to try those out now. You seem alot more knowledgeable than me. To keep it short and sweet to explain made a quick sketch of the setup simplified. Uploaded to imgur here https://imgur.com/a/w81IE The three items are the door "DOORBUNKER" the switch "BUNKERDOORSWITCH" and the keycard "BunkerKeycard" I have enabled both the doorx2 and switchesx4 to be "persistent references" The switch will be the activator requiring keycard at each side of a door the room is meant to be securable. Each door would not conflict with the other so they will run seperately with their own switches. So door A and door B on unlocking with opening from the switch activator they will unlock ONLY with the keycard. but when closing via the same switch they will not only close but also lock "requiring the same keycard" only which i believe would be a setting of lock to 255 if im not mistaken. if running back from a nightkin/supermutant/deathclaw i want to be able to open the door from the switch on the outside....run through turn and close/lock the door with the inside switch. As the same when i leave i will leave through the door accessing the inner switch and then secure it after myself with the outer switch upon leavingI hope it makes more sense. Bonus points if the door is scripted to be inoperable the by manual activation so must be locked/unlocked with the switches+keycard (which is what the second script for the door looks like without trying it) Hope this helps you Link to comment Share on other sites More sharing options...
RedNinja029 Posted January 24, 2018 Author Share Posted January 24, 2018 I guess the lock wouldnot be needed but the reason I added it was because I was worried the AI would be able to open it still somehow. Not sure how AI would work. Link to comment Share on other sites More sharing options...
RedNinja029 Posted January 24, 2018 Author Share Posted January 24, 2018 (edited) Fackkkk Yes I did press the red compile all I have a backup pre navmesh :S I'll have to go back. What a waste of a day. But if using FNV edit will undo what I have done then I will do that instead as it will save me hours more of navmesh and fixing things. So future reference I should never press the red save button... just the normal one right??? I'm pretty sure this is wrong as I said my experience is very little but going by what I know or want it wouldlook something like this maybe? scn BunkerDoorSwitchREFScript Begin OnActivate If IsActionRef Player If player.GetItemCount BunkerKeyCard >= 1 If DoorBunkerRef=locked DoorBunkerRef.Unlock;pause needed here between unlock and open? DoorBunkerRef.OpenElse DoorBunkerRef.Close ; some kind of tiny pause while the door plays its animation before locking would be good on the next line;some kind of .5 second pause here maybe DoorBunkerRef.Lock 255 ;requires bunkerkeycard EndIfEnd the second script you gave me look like it could work but would I put work? Also not quite sure what DoorBunkerRef would do as I wouldn't want Door B to open while I'm only wanting Door A to open. So hoping the script would run of each door separately with its own switches like mentioned previously (see above). Updated edit: After trawling through countless threads and trying to get knowledge and change a few bits I tried this but couldn't get the script to save I'm guessing there's an error with the script? But here is what I have now. scn BunkerDoorSwitchREFScript Begin OnActivate if(Player.GetItemCount BunkerKeycard == 0);Does The player have the keycard? Return endif if(DoorBunker.GetOpenState == 3 && BunkerDoor.GetLockLevel == 255);Is the door Closed? DoorBunkerRef.Lock 0 ;Unlock the door DoorBunkerRef.SetopenState 1 ;Open the Door else ;Otherwise DoorBunkerRef.Lock 255 ;Relock the door but is a paused required during 0.5 second animation? DoorBunkerRef.SetOpenState 0 ;Close The Door endifEnd That's what I came up with piecing from what else I've seen. But like I said the script wont allow me to update or save changes to it :S its just keeps prompting me to save but not saving/updating I guess an error? Put the doors reference as DoorBunkerREF not sure if its needed but did anyway. Also I'm not sure how you pasted the script in a tidy box like you did EPDGaffney. ^^^ Any pointers or corrections appreciated. :thumbsup: Edited January 24, 2018 by RedNinja029 Link to comment Share on other sites More sharing options...
EPDGaffney Posted January 24, 2018 Share Posted January 24, 2018 (edited) (In hindsight, everything I said below may be interpreted as terse but it isn't so I hope you won't take it that way.) I'm confused as to why you aren't using the scripts I gave you. They appear to do exactly what you want. So, using a lock really complicates things unnecessarily because the door is inoperable by standard means anyway. Use my scripts and only change what you need to to get this working. Then we can work on stuff like making it appear to be locked in prompts. Additionally, you will need a quest script to do almost anything involving time, and I do believe that locking and closing a door in the same block wouldn't cut it, meaning you'd need to pause, meaning you'd need to use a quest script in addtion to what you have. Edit: Sorry, this is not correct. A GameMode block could be used in the Object script to refer to GetSecondsPassed, but all the same, it's not needed here. In your last script, Return is not used that way, as it stops the rest of the script even running. It works in GameMode blocks similar to what you appear to be doing with it because the script will run again soon afterwards and do the check a subsequent time (and keep doing that until the script is turned off). I used it to make sure the door couldn't be activated directly. What may have confused you is in the other script, the switch does activate the door, but that's because calling Activate without specifying it's perameter will use the standard Activate function, but if I had called Activate with its flag set to 1 (entered as Activate ActorRef 1), then it would run the OnActivate block in the script attached to the door, which in our case does literally nothing, so the door would never open or close. Scripts simply don't save if they can't compile. You will almost certainly need JIP LN and NVSE eventually, so I would run the GECK with those. To do that, make a shortcut to the NVSE_loader, and then open its properties, and then where it designates the Target of the shortcut, add a space and put -editor This will give you some incredible options for modding but in this case I'm recommending it because it will explain to you what's wrong with your scripts (more or less anyway) when they don't save. It's an immense help. Also, you will need two sets of items. So, Switch A can be duplicated for Door A, requiring two modded base items, one of which is copied in the game, yielding three total references; and then Door B will need a Switch B used similarly, and the script will need to be adjusted to reflect the correct references, meaning two unique scripts, one for each set of items, and one door script that can be used to stop any door opening. And last, yes, the red button is the devil and has more or less no purpose. Use only the regular, black disk icon to save. FNVedit is what people tend to use to fix this, yes. Edited January 24, 2018 by EPDGaffney Link to comment Share on other sites More sharing options...
RedNinja029 Posted January 24, 2018 Author Share Posted January 24, 2018 Read and received 4:10am here and after trying several more things I have decided I've probably messed everything up with doing that and possibly overwriting so starting the whole mod from scratch again *facepalm*. Once I've done the basic layout I'll setup the doors, switches and keycard and save a backup before proceeding. I'll probably have to read this several times tomorrow to grasp the concept or be able to attempt it. I'll post again when I've tried it. I will try to get it working for one set of switches and door before the next. I most likely misread or misplaced what you said previously as I didn't see a lock function in the script and like I said I had it in mind somehow the AI could perhaps bypass it and just open the door naturally? I weren't sure if they would obey the script. But hey-ho fresh day tomorrow. I'll let you know how I get on. Link to comment Share on other sites More sharing options...
EPDGaffney Posted January 24, 2018 Share Posted January 24, 2018 Sorry you have to go through this but I promise you'll get it soon. My second script makes it so that when the door is activated outside of a script, nothing happens, so AI can't open or close your doors if that script is attached. We can get a bit fancier later once we know how the functionality works, and maybe add messages only when the player tries to activate the door, or maybe use a nice, informative prompt or something. If you look on the toolbar when making these posts, where you see the bold, italic, and underline buttons, a bit to the right is something that looks like< >and that's how you format stuff as code in a forum post. Tell me how it goes. Also note my edit above. Everything I've told you still stands, but I was wrong about one piece of my reasoning, which is that you don't need a quest script for a timer, but it's still more efficient to use one (as you can turn it on and off at will instead of doing constant condition checks for no reason, the latter being how an object script would handle it), and it's still more complex than it needs to be. Link to comment Share on other sites More sharing options...
RedNinja029 Posted January 24, 2018 Author Share Posted January 24, 2018 (edited) Decided to work through it after a Redbull :laugh: so here I am. Created + Placed all objects this time; BunkerDoorSwitch 1BunkerDoor1BunkerKeycard made both switches and the door persistent references and linked them via the render window Created blank script titled BunkerDoor1REF SCN BunkerDoor1REFand BunkerDoorSwitch1REF SCN BunkerDoorSwitch1REF>>>>>*SAVED BACKED UP*<<<<< :thumbsup: :thumbsup: :thumbsup: Copied and changed a few details in your script name wise to match new criteria. Not sure if I'm meant to but changed the Reference Editor ID box (top box) when double clicking door in render to BunkerDoorA if it makes any difference at all? Anyway did the following in the door script and it saved fine and let me resume SCN BunkerDoor1REF Begin OnActivate Return EndNow I did the script for the Switches... and I'm stuck here SCN BunkerDoorSwitch1REF Begin OnActivate If IsActionRef Player If player.GetItemCount BunkerKeyCard >= 1 BunkerDoor1REF.Activate Player EndIf EndIf EndSomethings up with it and its not letting me save and resume. Tried removing 1 and both EndIf Not sure whats happening if I'm honest. Any guidance based on information given? EDIT: Changed to SCN BunkerDoorSwitch1REF Begin OnActivate If IsActionRef Player If player.GetItemCount BunkerKeyCard >= 1 BunkerDoorA.Activate Player EndIf EndIf Endand its saved. testing now Cell Loads I first activate door as per norm and it opens (it shouldn't) I then close itactivate the switch with no card. Nothing happens to the doorThen I Pick the keycard and try the switch to no avail. I'll try once more GOT IT WORKING> posted on next page Edited January 24, 2018 by RedNinja029 Link to comment Share on other sites More sharing options...
Recommended Posts