Making laser receiver with time requirement

Avatar
El Farmerino
393 Posts
Posted May 15, 2012
Helping zivi7 with one of his maps and we were thinking of adding a requirement to a laser puzzle where two receivers have to be active for, say, 3 seconds in order for the output to fire. I know this is possible because neco used it in part 3 of The Ledge, but I'm still a Hammer noob and I'm afraid I have no idea how to go about it... Can anyone help?
Advertisement
Registered users don’t see ads! Register now!
Avatar
Brainstone
401 Posts
Posted May 15, 2012
Replied 2 hours later
Basically, what you do is enable a logic_timer, when the laser catcher is activated and disable it when the catcher is deactivated. OnTimer, the timer disables itself and do whatever you wish to be done.

If the two catchers need to be active at the same time you either need
- two logic_branches and one logic_branch_listener OR
- a logic_compare

Hope I could help.

Avatar
Lpfreaky90
2,842 Posts
Posted May 15, 2012
Replied 16 minutes later
I've helped zivi with this too:

Laser_relay one had a logic_relay called laser_relay_on_1 and laser_relay_off_1
And there was a math_counter called laser_counter that was used to check if they were both fired. (with a maximium legal value of 2)

The laser_relay one had outputs:
Instance:Onpowered; logic_relay_on_1; trigger
Instance:OnUnpowered; logic_relay_off_1; trigger

Logic_relay_on_1:
OnTrigger, logic_relay_off_1; cancelpending 0.00
Ontrigger, laser_counter; add; 1; 1.00

Logic_relay_off_1
OnTrigger, logic_relay_on_1; cancelpending 0.00
OnTrigger, laser_counter; subtract; 1; 0.05

then the same for the second relay but with 1 replaced by 2.

Then have laser_counter, onhitmax, <<what you want to do>>

Avatar
El Farmerino
393 Posts
Posted May 16, 2012
Replied 14 hours later
Thanks guys, both very helpful answers. And I didn't know about the cancelpending command either - very handy!
Advertisement
Registered users don’t see ads! Register now!
Avatar
josepezdj
2,386 Posts
Posted May 16, 2012
Replied 1 hour later

El Farmerino wrote:
And I didn't know about the cancelpending command either - very handy!

Well, ever since I discovered it, I use it all the time overall for every element that allows at least 2 possibilities. on and off (closed/open, disable/enabled, etc.). It's crucial to avoid bugs. It's important to have always a pair of relays where the first thing each does is to cancelpending the other... and the the rest settings you need with a delay of 0,20 secs for example...