Rumpiraten Posted December 2, 2012 Author Share Posted December 2, 2012 (edited) Never mind the door closing times, I forgot to adjust the fTick value down again, and that apparently fixed it... or it could just be a user error, I did just recently hit my head pretty hard lol :D Edited December 2, 2012 by Rumpiraten Link to comment Share on other sites More sharing options...
Rumpiraten Posted December 3, 2012 Author Share Posted December 3, 2012 Hmm nope I was wrong, it's still semi random, any tips on how to fix that? :) Link to comment Share on other sites More sharing options...
Xaranth Posted December 3, 2012 Share Posted December 3, 2012 Hmm nope I was wrong, it's still semi random, any tips on how to fix that? :) Uhm... It OUGHTN'T be semi-random. At least no more random than your framerate in the area. Unless you're running a mod that plays with the GameTimeMultiplier settings. If not, then it could be that your framerate's fluctuating wildly. That GameMode block means the script executes every frame. If you're dropping to 15 or 10 frames per second the next tick after the timer cleans out could take a perceptible length of time. As for the switch, you can call the animation on it if you know what it is. Make it persistent and link the door to it as a linked reference, then use GetLinkedRef and PlayGroup or maybe PlayForward/PlayBackward. I'm too lazy and honestly don't care enough to try and hunt it down for you, but you can look at the pickable activator scripts to see how it would work. . Link to comment Share on other sites More sharing options...
Rumpiraten Posted December 3, 2012 Author Share Posted December 3, 2012 Uhm... It OUGHTN'T be semi-random. At least no more random than your framerate in the area. Unless you're running a mod that plays with the GameTimeMultiplier settings. If not, then it could be that your framerate's fluctuating wildly. That GameMode block means the script executes every frame. If you're dropping to 15 or 10 frames per second the next tick after the timer cleans out could take a perceptible length of time. Yeah a good ol' fashioned reboot, and closing all other programs helped with the randomness, my bad :) As for the switch, you can call the animation on it if you know what it is. Make it persistent and link the door to it as a linked reference, then use GetLinkedRef and PlayGroup or maybe PlayForward/PlayBackward. I'm too lazy and honestly don't care enough to try and hunt it down for you, but you can look at the pickable activator scripts to see how it would work. Haha fair enough man, I'll see if I can figure something out with the switch animation, if not, oh well, it's just a minor detail :)Thanks once again, I appreciate all your help :) Link to comment Share on other sites More sharing options...
Rumpiraten Posted December 3, 2012 Author Share Posted December 3, 2012 (edited) Dammit, the door randomness is still messing with me :( I tried running fraps to show FPS and I'm running a smooth 60fps, but sometimes the door closes less than a second after I open it o_O Edited December 3, 2012 by Rumpiraten Link to comment Share on other sites More sharing options...
Xaranth Posted December 3, 2012 Share Posted December 3, 2012 Well, the FPS thing was a guess. I've thought of two other things that could be causing the issue. The auto-close script might not be resetting fTick as it should be, or the door is reporting it's state as 'open' somewhat randomly. To go a little further with this, I need to know how your switch works. Is the switch scripted, or are you just using an activate parent? If it's scripted, please post the switch script, and also please post the exact door script you're using. And we'll see... what we can see. Link to comment Share on other sites More sharing options...
Quetzlsacatanango Posted December 3, 2012 Share Posted December 3, 2012 I think you guys are doing it the hard way...Put a trigger around the door, with a script on the trigger: Begin OnTriggerEnter Playerdoorref.setopenstate 1End Begin OnTriggerLeave Playerdorrref.setopenstate 0End This will open the door when the player gets close and close it behind him. I intentionally did not put in code box, it is just an outline.If you have lots of doors, you will probably want to set set up linked refs first. Link to comment Share on other sites More sharing options...
Xaranth Posted December 3, 2012 Share Posted December 3, 2012 :) That's probably what I would do were it me, but it's not the question that was asked. :happy: Link to comment Share on other sites More sharing options...
Rumpiraten Posted December 3, 2012 Author Share Posted December 3, 2012 (edited) Hey again. The script I'm using on my switch is this SCN 00HiddenDoorScript Ref MyLink Begin OnActivate Set MyLink to GetLinkedRef If MyLink.GetOpenState == 3 MyLink.SetOpenState 1 Activate ElseIf MyLink.GetOpenState == 1 MyLink.SetOpenState 0 Activate EndIf END And for the door I'm currently using this one scn 00DummyDoorAutoClose ref rMe float fTick Begin onLoad Set rMe to GetSelf end Begin GameMode if rMe.GetOpenState Set fTick to fTick + GetSecondsPassed if fTick > 5 Set fTick to 0 rMe.SetOpenState 0 endIf endIf end Hehe thanks for the suggestion Quetzlsacatanango, that does seem a lot less complicated, but I would really like it, if I could get the door to just auto close after 3 seconds or so.I've got a nice little switch on a desk, sorta like an alarm button in a bank, that I would very much like to keep :) Edited December 3, 2012 by Rumpiraten Link to comment Share on other sites More sharing options...
Guest Messenjah Posted December 3, 2012 Share Posted December 3, 2012 (edited) Or you could just do a combination of things. The poster above is referring to trigger activator.... not just a normal activator. It is basically an invisible box that detects if the player is inside of it or not and triggers depending if the player enters it, is currently inside of it, or has recently left it. So, OnTriggerLeave only detects if the player has been inside the trigger and has moved outside of the trigger box area. When this happens, it will run whatever script is attached to it song long as it is an OBJECT script. Then just tell the OnTriggerLeave event to open the door if it is closed when the player leaves the trigger box. Now, just set your normal activate script on your activator button on the desk. This works much nicer because that way, the door doesn't keep closing while you are trying to access whatever is behind the door but WILL close when you walk away from it. :) So you would put this on your trigger box: scn TriggerActivatorSCRIPT begin OnTriggerLeave doorref.setopenstate 0 End doorref would be whatever reference name you gave your door. Also, make sure that you tick the checkbox on your in-game door for "persistent reference." Now, for your button activator: scn SecretDoorActivatorSCRIPT ref linked begin OnActivate set linked to GetLinkedRef if linked.getopenstate == 3 linked.setopenstate 1 else Return endif End Edited December 3, 2012 by Messenjah Link to comment Share on other sites More sharing options...
Recommended Posts