EPDGaffney Posted January 24, 2018 Share Posted January 24, 2018 (edited) You do physics? I used to be a physics major, haha. Not that I got very far before the maths did me in. But the non-mathematical side of physics was always very easy for me and I loved it. I may be able to handle it now but who knows. OnOpen sounds like a good idea. I vaguely recall having trouble with it but I would try it, because if it does what it says on the tin, it cuts out a lot of work for you. I probably should have made it more clear as you're not used to this stuff yet, but when I called it a variable, that more or less means the user invented and declared the variable themselves; it's not a function. It's the same as DoOnce in that forum discussion, which is probably what I should have used as an example as it's used often enough that you probably would have found it. Weird, the formatting copies for me. I use Mozilla as my browser, and I assume you're a normal person and don't, so that could be the trouble (and the first time Firefox ever did anything worthwhile besides having better language support than Chrome). You can always use PasteBin in that case. If it helps, when typing in monospace like the code font here (and any normal coding for that matter), you can use the same number of spaces for each indent and it will always be consistent. For us, four spaces per indent seems to do it. What is AkPlayerRef? Likewise for AkActionRef? To check that the player is activating, you need to use If IsActionRef == Player because OnActivate is bugged and it will run when any actor activates the object to which the script is attached, even if you specify otherwise. But also, sorry I didn't catch this earlier, remember when I told you that GetSecondsPassed requires a GameMode block? So, OnActivate can be used to set the variables that GameMode checks to determine when it should be running its timer, but the timer has to be run in GameMode. Look here:https://geckwiki.com/index.php/SetOpenState There is no 4 for SetOpenState, only GetOpenState. Again, functions generally take parameters, and only in If statements will the vast majority use an operator in any way. You want SetOpenState 0 or SetOpenState 1. Perhaps you are thinking of GetOpenState, which is used in an If statement to check a value, which is why there's an operator after it in most cases. That operator however is not technically part of the function. EDIT: Try attaching this to your door, but merge it with the script you already have, as I haven't done an OnActivate block for you, with the messages and all that. scn BunkerDoorScript int DoTimer float Timer Begin GameMode If DoTimer == 0 If GetOpenState == 1 Set DoTimer to 1 EndIf ElseIf DoTimer == 1 Set Timer to 8 Set DoTimer to 2 ElseIf DoTimer == 2 Set Timer to Timer - GetSecondsPassed If Timer <= 0 SetOpenState 0 If GetOpenState == 3 Set DoTimer to 0 EndIf EndIf EndIf End------------------------------------------------------(Old Stuff)------------------------------------------------------ So, you may have a script like this: scn BunkerDoorSwitch1Script int DoTimer float Timer Begin OnOpen Set Timer to 10 Set DoTimer to 1 End Begin OnClose Set DoTimer to 0 End Begin GameMode If DoTimer Set Timer to Timer - GetSecondsPassed If Timer <= 0 SetOpenState 3 Set DoTimer to 0 EndIf EndIf EndShould more or less cover you, I think. Edit: I made a mistake here by using OnOpen and OnClose on the switch. I had initially intended to use OnActivate and do some checks, but then remembered to try these blocks and forgot I was writing for the switch. Try this on the door. I have to leave immediately so I can't proofread this and fix it yet. Edited January 25, 2018 by EPDGaffney Link to comment Share on other sites More sharing options...
RedNinja029 Posted January 24, 2018 Author Share Posted January 24, 2018 (edited) I guess I'm really over complicating things but its because I've made so many changes and often forget some of the stuff I had tried previously. Its a lot o take in (for me anyway) but the end of your last post more or less fried my brain probably doesn't help I'm already tired, I also believe I remembered trying to script some Skyrim a year or so ago and that's where akPlayerRef came from etc. The last 2 scripts you sent me just puzzled me a little. But just the recap on the current situation ensuring were on the same page; I have 3 Scripts currently Works great but making it auto close would be cool. SCN BunkerDoorSwitch1Script ;This is duplicated for each doors with a set of switches Begin OnActivate If IsActionRef Player If player.GetItemCount BunkerKeyCard == 0 MessageEx "You do not have the required Key Card!" ElseIf player.GetItemCount BunkerKeyCard >= 1 BunkerDoorA.Activate Player ;"BunkerDoorA" is the reference and is changed for each + instance of a keylocked door EndIf EndIf ;Does a second endif need to be here? I'm just curious. EndThen the referenced door matching with duplicate of the above script, detailed as follows; SCN BunkerDoorKeyCardScript Begin OnActivate Messageex "This door is activated via the Card Reader..." Return EndNow the third Script is the auto closing door that I want to be activated by anybody, these doors will be inside of the secure safehouse and will function just like normal doors but with the auto close feature. This is the original functioning script which you urged me to tidy a little due to the OnLoad, We've established it can be erroneous sometimes having looked it up it seems upon re-entering the cell if just left, the script was (I think) just copy pasted over. Works fine but if it could be made simpler by all means it would be preferable. So without further ado; SCN BunkerDoorAutoScript ;I have reverted back to the default of this script the way it is here exactly ; as mentioned further below for now ignoring all the stuff i mentioned Float Timer Begin OnLoad ; This whole block (if thats the correct term) If GetOpenState == 1 ;;;;;;;;;;;; is actually useless because SetOpenState 0 ;;;;;;;; The inner doors auto doors using this are more than 10s away If GetLockLevel 0 ;I should remove this anyway ;;;;;;; so this whole thing is useless in my opinion Lock ;I should remove this anyway EndIf EndIf End Begin OnActivate Set Timer to 10 Activate End Begin GameMode If Timer 0 Set Timer to Timer - GetSecondsPassed ElseIf GetOpenState == 1 SetOpenState 0 Set Timer to 0 If GetLockLevel 0 ; I should remove this Lock ; I should remove this EndIf EndIf If GetOpenState == 3 Set Timer to 0 EndIf EndSo if those above changes were made in what I listened to and learnt it should become this; SCN BunkerDoorAutoScript Float Timer Begin OnActivate Set Timer to 8 ; 8 seems more reasonable so I changed to this Activate End Begin GameMode If Timer 0 Set Timer to Timer - GetSecondsPassed ElseIf GetOpenState == 1 SetOpenState 0 Set Timer to 0 EndIf ;Deleted this one as it wouldnt let me save it EndIf If GetOpenState == 3 Set Timer to 0 EndIf End I'll edit this in just a second, standby testing *Ok Done - not sure how to strikethrough text either* So that doesn't work after changing it, not sure why but it just remains opened. I would implement your scripts if I was sure what exactly what i was meant to change. Was your door script for the normal auto doors? or the Keycarded door? I think I because I changed the script names earlier (they were worded inconveniently) maybe it threw you off or maybe Im just throwing myself off. Im presuming now its for the Normal doors not requiring the keycard *Scratch that I know your on about the keycard door so I have reverted the normal auto doors back to the default OnLoad script and I instead am attempting to alter the keycard door script* SCN BunkerDoorKeyCardScript int DoTimer float Timer Begin GameMode If GetOpenState == 1 Set DoTimer to 1 EndIf Begin OnActivate Messageex "This door is activated via the Card Reader..." If DoTimer == 1 Set Timer to 8 Set DoTimer to 2 ElseIf DoTimer == 2 Set Timer to Timer - GetSecondsPassed If Timer <= 0 SetOpenState 3 If GetOpenState == 3 Set DoTimer to 0 EndIf EndIf EndIf EndSo far I cant get it to save at all : Error mismatched block structurePurely because I'm not to sure where OnActivate would go precisely.Feeling hopeless but I'll keep tapping away second guessing myself. SCN BunkerDoorKeyCardScript int DoTimer float Timer Begin OnActivate Messageex "This door is activated via the Card Reader..." Return ; I know this will end the script as you said earlier but how else to stop it being accessed endIf ;put this here and it tells me I've got an error otherwise without its incorrect block structure Begin GameMode If GetOpenState == 1 Set DoTimer to 1 EndIf If DoTimer == 1 Set Timer to 10 Set DoTimer to 2 ElseIf DoTimer == 2 Set Timer to Timer - GetSecondsPassed If Timer <= 0 SetOpenState 3 If GetOpenState == 3 Set DoTimer to 0 EndIf EndIf EndIf EndBe back shortly, havent eaten today XD ill be back very shortly 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 I'm going to look at this more in-depth when I can, but I somehow missed that we have two completely separate types of doors. I may have to rethink my approach, as my understanding was that you wanted the doors with the switches to close of their own accord if the player didn't close them via the switch. I'll be back. Link to comment Share on other sites More sharing options...
Mktavish Posted January 24, 2018 Share Posted January 24, 2018 Here's a crazy Idea ... just put an npc door man by the doors you want to close and lock.Then their script sets an AI package on them to use the door and lock it. But sorry if this is just left field crazyness ... cuz I didn't read the whole thread. Link to comment Share on other sites More sharing options...
RedNinja029 Posted January 25, 2018 Author Share Posted January 25, 2018 @EPDGaffney your right currently there are sets of doors setup activated only via a switch, however i would like to add an auto close feature if possible but more importantly and more so entirely seperately is the rest of the door inside the complex which will just be normal doors but with a auto close feature initiated 10 seconds after opening. @Mktavish its a great idea but the setting of the bunker gives that it is derelict and abandoned upon discovery, so there wouldnt be any NPC to open doors. More so the keycard to gain initial entry would be obtained through a dead body/skeleton (but thats for later) for now its just a incomplete empty-ish cell with a set of keycarded doors in and out through the back of it leading to various places in the wasteland. Then The remainder of the doors as discussed will have an auto close (not auto open) feature scripted to them. I currently have SCN BunkerDoorAutoScript Float Timer Begin OnLoad ; if the player left the door open the last time he was in here, close it. If GetOpenState == 1 SetOpenState 0 If GetLockLevel 0 Lock EndIf EndIf End Begin OnActivate Set Timer to 8 Activate End Begin GameMode If Timer 0 Set Timer to Timer - GetSecondsPassed ElseIf GetOpenState == 1 SetOpenState 0 Set Timer to 0 If GetLockLevel 0 Lock EndIf EndIf If GetOpenState == 3 Set Timer to 0 EndIf Endwhich works fine for the inner doors. But EPDGaffney informed me of the re-entering cell bug whereby the doors could not auto close again seeing the same info on the GECK bethesda site I would like to iron out any bugs before they occur later, while possibly tidying the script. Even if this was left as is I would need to somehow implement the auto close function into the keycard/switch doors aforementioned which are separate entities mentioned previously. Link to comment Share on other sites More sharing options...
RedNinja029 Posted January 25, 2018 Author Share Posted January 25, 2018 Still cant seem to get it to work still, would say day wasted but I've still learned a few new things. I'll keep trying and browsing forums for a few more hours at least. Link to comment Share on other sites More sharing options...
EPDGaffney Posted January 25, 2018 Share Posted January 25, 2018 (edited) Your day wasnt even close to wasted, I assure you. You have done something to your brain. You have made it high. (sorry, reference, maybe you got it; if not, we'll move on) But you really have done something to your brain, which is that you've filled it with a whole lot of stuff that is very likely going to 'set' over the next couple of days. And besides that, your scripts are giving you errors because of simple little syntax mistakes; the logic in them is getting better constantly. From now on, you should probably google these errors, as I think they'd turn up. I'm not completely sure what's what with these scripts at the moment. I'm having trouble understanding which ones are your current scripts and what you want each thing to do. So, you have:1. A door that can't be opened or closed save via the switch, and it has a script to implement this as well as to give the player a message should they try to activate it directly.2. A switch that opens and closes these doors and requires a card key to do so, and this switch has a script to control the doors but which script produces a message if the player has no card key.3. The card key that goes to the switch and to my recollection has no script attached to it. (it is referenced by the switch's script, but has no script of its own, yeah?) 4. A completely separate type of door that stays open for 8 seconds maximum, then closes. Is this just for a cool æsthetic or do we need more functionality than this? Of the above four items, which is currently working? The script I gave you for the doors that close on a timer simply checks for the doors to be open and then if they are, it closes them after eight seconds (well, I think I put 10, but changing that should work fine). If that's all you need, that script is done. The rest of your stuff is just syntax errors. So, all Begin blocks must end with an End line. Example: This script SCN BunkerDoorKeyCardScript int DoTimer float Timer Begin OnActivate Messageex "This door is activated via the Card Reader..." Return ; I know this will end the script as you said earlier but how else to stop it being accessed endIf ;put this here and it tells me I've got an error otherwise without its incorrect block structure would compile once you used End instead of EndIf, though you would want to remove the Return line as well: SCN BunkerDoorKeyCardScript int DoTimer float Timer Begin OnActivate Messageex "This door is activated via the Card Reader..." End If statements end with EndIf, but Begin ends with End, and If statements are contained within Begin blocks. Does that make sense? Also, I'm not clear on what you want with the doors that have these timers, but if you want them to be card key doors as well, you had the right idea; you'd just skip a line or two (visual thing, code works regardless of how many lines you skip) and paste in my GameMode script, as you did. It would have worked but that you hadn't ended your OnActivate block with End as you will now. You've another script a bit further up that starts a Begin GameMode block and doesn't end it with End before starting a Begin OnActivate block, so if you had done that, it would have compiled (unless I missed something similar to this) but wouldn't have worked as you used GetSecondsPassed in that OnActivate block, which returns 0 all the time. I think the only other errors I saw were the ones where you used no operator in an If statement:Wrong: Begin GameMode If Timer 0 ; code stuff EndIf EndRight: Begin GameMode If Timer == 0 ; code stuff EndIf EndSorry, it's a little tough to keep track of everything, so I hope that I haven't missed anything. Edit: Use the SV console command to check variables in any Object script that is attached to the the object you've clicked (or used PRID on) in the console. SQV is the equivalent for quest scripts. Very important debugging tools. Edited January 25, 2018 by EPDGaffney Link to comment Share on other sites More sharing options...
RedNinja029 Posted January 25, 2018 Author Share Posted January 25, 2018 (edited) just got in had a birthday to go to today. Going to read through now, conked out last night on the pc (fell asleep at desk lol) lets see how it goes tonight. Prob edit this shortly after I have a play and read your message. 1. yes2.yes3.yes4. Just aesthetic and convenience. Well all that needs to be changed is the timer needs to be added. To the normal unlocked doors within the facility, 8 seconds timers auto close anyone can activate this so no strictly the player. SV console, PRID on, SQV... never heard of these before but I'll look it up whatever they are and function as. 2 things regarding doors to work on are both timers. Lets begin and stick to one thing at a time. First, with the simple auto door, this functions on activate normally by anyone accessing it NPC included. after 8 seconds it will automatically close itself. I dug out a script mentioned at the top of this page which functions fine. However you gave me knowledge of a bug meaning the OnLoad will no always function specifically when re-entering the cell. If I was just to change OnLoad to GameMode ? would it be more appropriate, or would you suggest a cleaner/simpler script with same function? I recall removing anything with the line "Lock" in it and I dont think it functioned anymore but I may have done something else concurrently to cause that issue, hard to say. I've just been guessing, saving and testing every 10 minutes or so (My Steam Friends must hate me for spamming their screens when starting FO:new vegas XD) So yeah, from the script at the top of the page. I have had the idea of changing OnLoad to GameMode. Or would this cause some kind of bloat? I'd like it to be as clean as possible yet functional. Currently its 100% functional but if I can learn a thing or 2 from this while providing a clean a mod as possible (because I know bloating has something to do with scripting or references right?) and secondly because I'd hate for the script to fail if using OnLoad. If statements end with EndIf, but Begin ends with End, and If statements are contained within Begin blocks. Does that make sense? this does make sense now yes. Begin is beginning the script with the relevant trigger (shall we say) and an if is a condition within the activation of that trigger. I can grasp that, its the format that throws me as well as the placement of terms. I like experimenting but things can become complex fast if your not sure what your doing. The G.E.C.K stuff has basic examples but its piecing that stuff together in the right format it becomes tricky. It just puts me in awe how people like yourself can just throw a script together, I guess its a skill set but a skill I'm lacking in (but learning). much appreciated for not deserting/abandoning me yet by the way :smile: I appreciate your guidance to date very much. So trying this now SCN BunkerDoorAutoScript Float Timer Begin OnOpen Set Timer To 8 End Begin GameMode If Timer == 0 SetOpenState 0 EndIf EndDidn't work assumed because the script doesnt include what time is being counted so used this http://geck.bethsoft.com/index.php?title=GetSecondsPassed SCN BunkerDoorAutoScript Float Timer Begin OnOpen Set Timer To 8 Set Timer to Timer - GetSecondsPassed ;Incorporated to indicate its seconds I want the timer, not minute,hour,years or millenia XD End Begin GameMode If Timer == 0 SetOpenState 0 EndIf EndStill nothing; going to try maybe following this tutorial mentioned above (http://geck.bethsoft.com/index.php?title=GetSecondsPassed) to put a > instead of an = maybe. But this I dont understand mathematically. > means equal or greater than and < equal or less than. So looking at this somehow made me reconsider my maths ability :O. Edited January 25, 2018 by RedNinja029 Link to comment Share on other sites More sharing options...
EPDGaffney Posted January 25, 2018 Share Posted January 25, 2018 (edited) Console commands: Starting with the easy stuff, SV, SQV, and PRID are all console commands to be used during gameplay. Press ` or ¬ or tilde or whatever (button in the upper-left corner below Esc) during a game to bring up the console. Then you can use it to cheat or have a laugh, or you can use it the way it was intended to be used: debugging. PRID is followed by the ID of what you want to be selected in the console. This is the same as clicking on it on the screen whilst the console is open, with the exception that you can use PRID even when the reference is not on the screen. Once either PRID or clicking on the reference is done, you can use commands on that reference without specifying it in the command when you enter said command. To use SV, bring up the console and click on anything that has a script attached to it, such as your door, and you'll see the name appear at the top of the screen. Enter SV and it will tell you what variables are in the script (like Timer or DoTimer) and what values are currently asigned to them. This would be a good way to confirm that your timer is working, as using SV every couple of seconds should give different values for Timer each time. If you had used a timer in an OnActivate block for example, you may see it return 0 every time you check with SV, and that could give you something to google or maybe even remind you that I told you that about OnActivate. SQV is the same as SV but for quests. It requires that you enter the Form ID of your quest, which you can get from the GECK, but you must use your mod index instead of the one in the GECK (the first two digits of the Form ID that shown in the GECK would be the mod index). -------------------------------------------------------------------------------------------------------------------------Scripts: This script is the easiest way to make your doors open and close normally, but close after eight seconds if they're left open: scn BunkerDoorScript int DoTimer float Timer Begin GameMode If DoTimer == 0 If GetOpenState == 1 Set DoTimer to 1 EndIf ElseIf DoTimer == 1 Set Timer to 8 Set DoTimer to 2 ElseIf DoTimer == 2 Set Timer to Timer - GetSecondsPassed If Timer <= 0 SetOpenState 0 If GetOpenState == 3 Set DoTimer to 0 EndIf EndIf EndIf EndNote that I caught an error in this, where I was using the GetOpenState parameter integers in the SetOpenState function, which would have made the door never close (which debugging with SV would have shown you). We could make this cleaner but I say we get it working for now. Making it cleaner would involve a quest script, as I've said above. It would involve turning this into one, slightly altering its end checks to stop the quest, and then controlling its start and stop to a degree based on checks during an OnActivate block script placed on the door itself. However, it's probably not a big deal to leave it as is. It may be worthwhile to start and stop the quest based on whether the player is in the cell with the doors, maybe. In my experience however, though these things add up, they're not as bad as they used to be, and at your level of experience, I wouldn't worry about it now unless you really want to. -------------------------------------------------------------------------------------------------------------------------Congratulations or whatever:No bother about helping out new modders. I used to be in the same position, and I still post questions here relatively often. I don't know everything. Far from it. I'm a self-taught genius with huge gaps in my knowledge that mess me up constantly. But it may be comforting to learn that whilst I have something of a game development background, I started scripting in this engine only a few months ago. My development background does include scripting, but only on a rudimentary level; I'm much more of a visual and audio developer by trade, at least historically. You keep experimenting and asking questions, and it won't take you long to get pretty comfortable I imagine.-------------------------------------------------------------------------------------------------------------------------Edit: I've revised the script again since first posting this. I've tested it as well and it defo works. Edited January 25, 2018 by EPDGaffney Link to comment Share on other sites More sharing options...
RedNinja029 Posted January 26, 2018 Author Share Posted January 26, 2018 (edited) Before applying it I am trying to visualise what the script is commanding as to attempt to learn something from it. So many questions I have to improve a little knowledge of mine regarding that script; I'll copy and paste the script again just to ask for a few pointers to increase my knowledge, I'd be grateful if you can help me decipher the commands and functions of the script scn BunkerDoorScript int DoTimer float Timer Begin GameMode If DoTimer == 0 ; 1-Firstly why == as opposed to = ? 2- DoTimer is resetting the Timer to 0 If GetOpenState == 1 ;If the Door becomes Open then... Set DoTimer to 1 ;Set The Counter Timer to 1 EndIf ElseIf DoTimer == 1 ;Not sure how to use ElseIf or when it should be used ;When it becomes 1 do the following Set Timer to 8 ;Is this Set Timer To 8 the threshold/limit for the timer? Set DoTimer to 2 ;This baffles me as I can't grasp how this DoTimer is working at this point ElseIf DoTimer == 2 Set Timer to Timer - GetSecondsPassed ; Would - be counting down and + be counting up? If Timer <= 0 ; This means if the timer is equal or less than 0? SetOpenState 0 If GetOpenState == 3 ; Same as before not sure difference between = and == Set DoTimer to 0 ; Does this mean the timer has stopped running EndIf EndIf ;Not sure why there are 3 EndIfs as opposedto 1? EndIf EndThis is a hard concept to grasp but I imagine if you understand laws/rules of scripting you can do almost anything. But Reading the G.E.C.K only shows so much IMO or from what I've seen. The other 80% of information and knowledge is from nexus forums in my experience. People like yourself are assets to the Nexus/Modding community in my beliefs. I guessed you may of had some experience. Myself come from a Military background with 0 skills in basic I.T other than school. I strive to learn but it can all so easily become very overwhelming at times. I think My first Mod was removed for copyright content (Conan music in Skyrim and main menu overhaul) which was a cluster-fudge anyway. Tried making a sword once and did it then lost the files DOH! I notice differences even between new vegas and Skyrim which is a tad confusing but anyway. I really appreciate the help (not all heroes wear capes). I will run and try out the script now. As for making it cleaner using a quest script. Could you define "Cleaner", I've read a lot about save bloat and even seen my saves gain size over time. would this accelerate the rate of bloating is this what you mean by cleanliness? My brain is a sponge XD . Sorry for overloading you :smile: I'll checkout your mods after but I'm sure I've seen your name around somewhere before or maybe just because I've played forum ping pong with you over the last few days. :smile: As for the console commands, I know they are there. I try to avoid cheating where possible (unless glitched or stuck typically TCL helps me) I know GBO returns the items ID. I'll check them out but assume I would know if the script runs anyway visually. But I guess it would show me where exactly it is becoming erroneous. Either way that script is something I wouldn't even have visualised. Back in a few mins Works Awesome, Thanks :) !!! Amended the time again down to 5 seconds feel it should be sufficient but yes an awesome script. Thank you again very much. Just going through lighting now. I've decided to keep the keycard door to manual access, this would avoid dilemma of a NPC companion getting stuck in foresight of things :) As for the lights I'm going to try to setup lights as references and have them enable and disable with a delay of 1 second (the visual lever animation delay of on to off) but still hope to hear back in reference to above maybe if you can help me understand the things i mentioned and also in the scriptbox. I will try to use this newfound knowledge to make the 1 second delay light script and see if it works :) (also if possible for immersion I maybe include a few sound effects later as well as enable / disable of a dummy pad to hide the scripted one when no power as well as ceiling fans from static to animated with sound effects also if that all makes sense. just a matter of referencing each item I guess then indicating enable and disable I guess.) p.s. downloaded you radio station mod. I look forward to using that :) Edited January 26, 2018 by RedNinja029 Link to comment Share on other sites More sharing options...
Recommended Posts