Rapid button pressing

Avatar
KenJeKenny!?
238 Posts
Posted Jun 22, 2011
Hey guys! Yet another qeustion!

At the moment i have 4 panels opening up on when a normal floor button is pressed and they also close when unpressed.
I set this up using logic_relay's sending SetAnimation outputs and i have tried all kind's of delays, i tried sending both relay's a CancelPending input on trigger, Allow fast retrigger is not flagged and i also tried some other things and searched the forum/googled alot but i cannot get it to work properly...
the panels keep going crazy when you jump up and down on the button for example...

Current situation: (2 panels only)
NWS_cEWZTnk

How to fix this!? :S

Thanks in advance!

Advertisement
Registered users don’t see ads! Register now!
Avatar
Kasc
77 Posts
Posted Jun 22, 2011
Replied 4 minutes later
Not tried this myself but when it's been asked before it usually involves the SetPlayBackRate (?) to -1 option for model inputs.
Avatar
Marlovious
111 Posts
Posted Jun 22, 2011
Replied 9 minutes later
I had this same issue in a map I'm working on. I was able to fix it by having the open relay disable the close relay on start and then re-enabling the close after the animation finished and vice versa for the close relay.
something like:
open_rl > ontrigger > close_rl > disable > 0.0
do the animation...
open_rl > ontrigger > close_rl > enable > 2.0

and

close_rl > ontrigger > open_rl > disable > 0.0
close_rl > ontrigger > open_rl > enable >2.0

Avatar
KenJeKenny!?
238 Posts
Posted Jun 22, 2011
Replied 5 minutes later

Kasc wrote:
Not tried this myself but when it's been asked before it usually involves the SetPlayBackRate (?) to -1 option for model inputs.

This solves most of the problem... if i get off while the animation is halfway it returns to its original state in a fluid move... but strafing on and off the button still makes it go wild a bit...

atm i have on pressed SetAnimation (by default arms are on idle animation) and on unpressed SetPlaybackRate -1.

Marlovious wrote:
I had this same issue in a map I'm working on. I was able to fix it by having the open relay disable the close relay on start and then re-enabling the close after the animation finished and vice versa for the close relay.
something like:
open_rl > ontrigger > close_rl > disable > 0.0
do the animation...
open_rl > ontrigger > close_rl > enable > 2.0

and

close_rl > ontrigger > open_rl > disable > 0.0
close_rl > ontrigger > open_rl > enable >2.0

I tried something similair to that... but if you get off the button before the animation is done... the button will trigger the unpressed relay which is then disabled... so the panel/door stays open/closed and does not return to it's original state.

Avatar
Marlovious
111 Posts
Posted Jun 22, 2011
Replied 4 minutes later
I guess I'll have to play with it more. I'll get back to you.
Avatar
Marlovious
111 Posts
Posted Jun 22, 2011
Replied 25 minutes later
Got it working correctly. Just change the delay's to what you need them to do.
Attachments
marlowtest2.vmf
0.01 MB 40 downloads
Avatar
Kasc
77 Posts
Posted Jun 22, 2011
Replied 8 minutes later
You need to set up some variables with branches or counters, whichever you prefer.

The button needs to do different things depending on what's currently happening.

i.e.

If the panel is open then it needs to set a close animation and visa versa.
If the panel is opening and the button is Unpressed then it needs to set the playback rate to -1.

The next part is a bit harder:

If the panel is closing and the button is pressed, and it's not doing a reversed animation then the panel needs have it's playback rate set to -1.

If the panel is closing and the button is pressed, and it is doing a reversed animation then the panel needs to have its playback rate set back to 1.

p.s. All the while you need to be setting the correct default animation.

It's certainly not easy, the way doors open and close are really good examples of what you want, but it's a shame they are controlled within an entity rather than in an instance!

Avatar
Kasc
77 Posts
Posted Jun 22, 2011
Replied 5 minutes later
Another way I did a similar thing, which was not as clean but is certainly easier, was to only allow the panel to open/close it if was closed/opened through the setting of branches named is_closed and is_open.

The button changes branches named panel_wants_to_open and panel_wants_to_close accordingly.

A listener then triggers the panel to close if panel_is_open and panel_wants_to_close are true.

Another listener triggers the panel to open if panel_is_closed and panel_wants_to_open are both true.

Avatar
Marlovious
111 Posts
Posted Jun 22, 2011
Replied 23 minutes later

Kasc wrote:
Another way I did a similar thing, which was not as clean but is certainly easier, was to only allow the panel to open/close it if was closed/opened through the setting of branches named is_closed and is_open.

The button changes branches named panel_wants_to_open and panel_wants_to_close accordingly.

A listener then triggers the panel to close if panel_is_open and panel_wants_to_close are true.

Another listener triggers the panel to open if panel_is_closed and panel_wants_to_open are both true.

That's pretty much what my example does. The listener controls everything.
Button > branch1 (true for pressed, false for unpressed)
open and close relays > branch 2(set to false if the panel is moving, true when it isn't)
both relays disable eachother while the panel is moving

The listener
onfalse -panel not moving and button not pressed - fire close relay
ontrue -panel not moving and button pressed - fire open relay
onmixed -panel moving and button changed position - delay and test self. This will not allow anything to happen until the panel has stopped moving.

Avatar
Kasc
77 Posts
Posted Jun 22, 2011
Replied 22 minutes later
It's not very user friendly though, I did download but decided after a quick glance I couldn't be bothered to work out what was going on :razz:
Avatar
Marlovious
111 Posts
Posted Jun 22, 2011
Replied 7 minutes later
I guess it could be made a little cleaner by using a logic case.
Avatar
-ArttyIntel-
76 Posts
Posted Jun 22, 2011
Replied 1 hour later
Id set a delay to the button. To make it where the play wont accidentally come across the problem.
Avatar
KenJeKenny!?
238 Posts
Posted Jun 23, 2011
Replied 8 hours later
I got it working almost perfectly now... the movement is fluid and the panels wont freak out anymore... only the telescopic arm still freaks a tiny bit... the "panel frame" is coming through the panels sometimes...

vZWgMeTOSKU

Avatar
KenJeKenny!?
238 Posts
Posted Jun 23, 2011
Replied 4 hours later
I even tried some different animations... but the arms keep comming through the panels :S
Avatar
Kasc
77 Posts
Posted Jun 23, 2011
Replied 4 minutes later
How are you doing this?
Avatar
Marlovious
111 Posts
Posted Jun 23, 2011
Replied 1 hour later
If the models are still clipping the panels, try making the panels a little thicker.
Avatar
KenJeKenny!?
238 Posts
Posted Jun 23, 2011
Replied 43 minutes later

Kasc wrote:
How are you doing this?

http://www.youtube.com/watch?v=Q5na8Llhk8k

Marlovious wrote:
If the models are still clipping the panels, try making the panels a little thicker.

Yeh but i want them to be lined up with the floor once they are down... and in order to do that it has to be as thin as possible... it's 1 unit wide right now and only 1 unit lower then the floor when it is done.

Avatar
Marlovious
111 Posts
Posted Jun 23, 2011
Replied 23 minutes later
Aren't most of the arms with panels already attached about 4 units thick? Honestly, a panel that sticks out 3 extra units will be almost unnoticeable to most people. Or put it this way, which looks worse, a panel that is slightly thicker than the surrounding wall or a model that clips through it's panel.
Avatar
KenJeKenny!?
238 Posts
Posted Jun 23, 2011
Replied 1 hour later
I already got it fixed! FINALLY! :biggrin:

No more ugly animation resets or panels/arms sticking out EVER!

It's all in the manner that you trigger the animation...

This is how i finally fixed it:

Set the prop_dynamic's DefaultAnimation to a "idle" animation that has the starting position you want (I'm using makeramp_06close_idle in this example). And make sure Hold animation is set to yes!

prop_floor_button
OnPressed > Button_OnPressed_Relay > Trigger > 0.10 delay
OnPressed > Button_OnUnPressed_Relay > CancelPending > 0.10 delay !!!
OnUnPressed > Button_OnUnPressed_Relay > Trigger > 0.10 delay

Button_OnPressed_Relay
OnTrigger > Panel_01 > SetAnimation > makeramp_06close > 0.10 delay ( FIRE ONCE ! ) !!!
OnTrigger > Panel_02 > SetAnimation > makeramp_06close > 0.20 delay ( FIRE ONCE ! ) !!!
OnTrigger > Panel_03 > SetAnimation > makeramp_06close > 0.30 delay ( FIRE ONCE ! ) !!!
OnTrigger > Panel_04 > SetAnimation > makeramp_06close > 0.40 delay ( FIRE ONCE ! ) !!!
OnTrigger > Panel_01 > SetPlaybackRate > 1 > 0.10 delay !!!
OnTrigger > Panel_02 > SetPlaybackRate > 1 > 0.20 delay !!!
OnTrigger > Panel_03 > SetPlaybackRate > 1 > 0.30 delay !!!
OnTrigger > Panel_04 > SetPlaybackRate > 1 > 0.40 delay !!!

Button_OnUnPressed_Relay
OnTrigger > Panel_01 > SetPlaybackRate > -1 > 0.10 delay
OnTrigger > Panel_02 > SetPlaybackRate > -1 > 0.20 delay
OnTrigger > Panel_03 > SetPlaybackRate > -1 > 0.30 delay
OnTrigger > Panel_04 > SetPlaybackRate > -1 > 0.40 delay

I watched some tutorial videos before and during the creating of these panels and all of them have 1 relay set a animation and the another relay set the playbackrate to -1. This will however create problems when triggering buttons really fast. But not if you do it the above way. The outputs marked with !!! are what is different from most tutorials and works in cases like these.

Advertisement
Registered users don’t see ads! Register now!
Avatar
MissStabby
160 Posts
Posted Jun 23, 2011
Replied 5 hours later
But what if you wanted to use 2 different animations?
Some animations show the weight of certain panels very well.
Like a heavy panel dropping 90 degrees out of a ceiling, the "out" animation drops the panel quite quickly, but the "in" animation first shows the arm being put under tension before actually moving the panel itself.

The "makeramp_xx" animations show this very well