Jump to content

Recommended Posts

Posted (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 by Rumpiraten
Posted
  On 12/3/2012 at 2:01 AM, Rumpiraten said:

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.

 

.

Posted
  Quote
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 :)

 

  Quote
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 :)

Posted (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 by Rumpiraten
Posted

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.

Posted

I think you guys are doing it the hard way...

Put a trigger around the door, with a script on the trigger:

 

 

Begin OnTriggerEnter Player

doorref.setopenstate 1

End

 

Begin OnTriggerLeave Player

dorrref.setopenstate 0

End

 

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.

Posted
:) That's probably what I would do were it me, but it's not the question that was asked. :happy:
Posted (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 by Rumpiraten
Guest Messenjah
Posted (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 by Messenjah
  • Recently Browsing   0 members

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