[Question] Logical Door 'OR' type

Avatar
carlymx
58 Posts
Posted Jul 13, 2011
Hello.
I have a problem, I need two buttons to activate independently a bridge of light, everything is going well until I remove one of the cubes.

I know what I need is to simulate a logic gate type 'OR' and it uses a 'Logic_compare' but not working.

Can you help?

I leave the code for. VMF

Logical Door 'OR' Type (help me)

img

Advertisement
Registered users don’t see ads! Register now!
Avatar
Mevious
205 Posts
Posted Jul 13, 2011
Replied 9 minutes later
For situations thike this I usually go with a math_counter. To OR two buttons, you make the buttons add 1 when pressed and subtract 1 when unpressed. Then activate the bridge when the count is 1 or more, deactivate when it hits 0.

Edit: For a more detailed explanantion check this tutorial. It describes a setup for two buttons ANDing to open a door, but the basic concepts are the same.

Avatar
ChickenMobile
2,460 Posts
Posted Jul 14, 2011
Replied 9 hours later
@Mevious: the better solution would be using two logic_branch's and using a logic_branch_listener to activate the bridge when 'OnAllTrue' and Deactivate on 'OnMixed' and 'OnAllFalse'.

This will guaranteed work

Avatar
WinstonSmith
940 Posts
Posted Jul 14, 2011
Replied 14 hours later

chickenmobile wrote:
@Mevious: the better solution would be using two logic_branch's and using a logic_branch_listener to activate the bridge when 'OnAllTrue' and Deactivate on 'OnMixed' and 'OnAllFalse'.

This will guaranteed work

While that method's good too, I disagree that it's any better. You can set up a math_counter with a minimum value of 0, a maximum value of 1, and an initial value of 0. Then set the outputs so that when the counter hits the maximum value the light bridge goes on and when it hits the minimum value the light bridge goes off. When both buttons are on, the counter will have a value of 2 and the light bridge will still be on.

The math_counter method wil "guaranteed work" as well, and it uses fewer entities.

Advertisement
Registered users don’t see ads! Register now!
Avatar
carlymx
58 Posts
Posted Jul 23, 2011
Replied 8 days later
Thank you very much.

After seeing the info I created for "Math_Counter" what I needed.

I also created a sample map for those who need it.

http://forums.thinking.withportals.com/downloads.php?view=detail&df_id=1106

img