Multiple Buttons

Avatar
Lostprophetpunk
409 Posts
Posted Jul 21, 2011
Heya there,

I am 3/4 of the way through creating my second map. However I have come across a problem.

I want to use multiple floor buttons (three of them) for one door. I have followed the tutorial on the developer Valve wiki but cannot seem to get it to work.

I have a math counter near my door with...

Initial value - 0
Min value - 0
Max value - 3

Each of my buttons I have set up an output for unpressed/pressed to subtract/add to the math counte.

Once all the three buttons are pressed, it's fine. However, if I remove a cube to leave one button unpressed, the door stays open.

This is my first time attempting to use math counters by the way.

Advertisement
Registered users don’t see ads! Register now!
Avatar
Rubrica
305 Posts
Posted Jul 21, 2011
Replied 5 minutes later
The way I'd do this would be by setting each button to toggle the state if a logicmbranch depending on its state, and use a logic branch listeners, with an output of OnAllTRue to open the door, and OnMixed or OnAllFalse to close it.
Avatar
Lostprophetpunk
409 Posts
Posted Jul 21, 2011
Replied 1 minutes later

Rubrica wrote:
The way I'd do this would be by setting each button to toggle the state if a logicmbranch depending on its state, and use a logic branch listeners, with an output of OnAllTRue to open the door, and OnMixed or OnAllFalse to close it.

That made no sense to me. :S

I have never dealt with logic branches at all, and have no idea how to use them.

Avatar
Marise
249 Posts
Posted Jul 21, 2011
Replied 48 minutes later
Create three entities of the type logic_branch. One for each button. Name them something like branch1, branch2 and branch3. Now give each button outputs like this:

OnPressed > branch1 > SetValue > 1
OnUnPressed > branch1 > SetValue > 0

Then create an entity of the type logic_branch_listener. In its properties, you can tell it what branches to listen to. It will have a bunch of fields named something like Logic Branch 01. In the first three of those fields type in branch1, branch2 and branch3.

Next give the listener these outputs:

OnAllTrue > door > Open
OnAllFalse > door > Close
OnMixed > door > Close

Avatar
Will T.
163 Posts
Posted Jul 21, 2011
Replied 18 minutes later
You can do it easily with outputs on your existing math_counter.

OnHitMax -> Door -> Open
OnChangedFromMax -> Door -> Close

Avatar
Rubrica
305 Posts
Posted Jul 21, 2011
Replied 10 minutes later
Ah, I thought there was something like OnChangedFromMax, but I wasn't sure, so I went for the other method.
Avatar
Lostprophetpunk
409 Posts
Posted Jul 21, 2011
Replied 1 minutes later

Will T. wrote:
You can do it easily with outputs on your existing math_counter.

OnHitMax -> Door -> Open
OnChangedFromMax -> Door -> Close

Thanks for this. =]

Thanks to all the other solutions as well, much appreciated.

Advertisement
Registered users don’t see ads! Register now!
Avatar
WinstonSmith
940 Posts
Posted Jul 21, 2011
Replied 4 hours later
First of all, I'm with Will T. on this; I know the logic entity method is cool and all but if you use a math_counter it's simpler. Honestly. Fewer entities.

Anyway, I had no idea there was an OnChangedFromMax output either. The way I learned was OnHitMax-->!self-->SetMin-->[max -1].

Actually, looking at it now it turns out there's a new SetHitMinNoFire output with Portal 2. Huh.