Stop a prop_dynamic performing a delayed animation? [Solved]

Avatar
GODFATHER
26 Posts
Posted Aug 26, 2011
Hi all,

I've almost completed my first map. But I have one small issue, that although is not a puzzle breaker, is very annoying. So hoping some of you experienced mappers can help.

The issue is that I have a floor button. When its pressed it tells a prop_dynamic (telescope arm in this case) to move up 90degrees. When the button is unpressed it tell it to move back down after a delay of 8 seconds. (Using animations ofc)

While standing on the button I want it to stay up, but if I get off and back on again, after a few seconds the delayed on unpressed command kicks in and moves it down.

So is there a way to cancel an instruction that is attached to a delay after it has been triggered?

Advertisement
Registered users don’t see ads! Register now!
Avatar
Rubrica
305 Posts
Posted Aug 26, 2011
Replied 58 minutes later
Add an output to the button: OnPressed;!self;CancelPending. Do the same for OnUnPressed. I think that's what you're looking for, anyway.
Avatar
Will T.
163 Posts
Posted Aug 26, 2011
Replied 7 minutes later
Telling a button to CancelPending on itself will crash the game when you try to activate it. I learned this the hard way. :razz:

Instead, move all of the current OnPressed commands into a logic_relay, and all OnUnpressed commands into another logic_relay. Add the button outputs like this:

OnPressed -> logic_relay-1 -> Trigger
OnPressed -> logic_relay-2 -> CancelPending

OnUnpressed -> logic_relay-2 -> Trigger
OnUnpressed -> logic_relay-1 -> CancelPending

EDIT: I haven't actually tried telling a button to CancelPending OnUnpressed. That may work, but I'm not sure. I know doing it OnPressed will crash Portal 2.

Advertisement
Registered users don’t see ads! Register now!
Avatar
GODFATHER
26 Posts
Posted Aug 26, 2011
Replied 4 hours later
Given Will's comment on crashing I went straight for the relay method, worked a treat!

Thanks for help. One of those occasions where searching for something told me everything except what I needed to know.