Please or Register to create posts and topics.

Multiple Buttons

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.

Some of my Portal 2 maps || Mini-Faith || Careful Cube || Vertical Reach ||

|| Need help uploading a map...new user? Read my Map Uploading Guide ||
|| Want to play custom maps, but don't know how? Read my Playing Portal 2 Custom Maps Guide ||

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.

Image
ImageImageImageImage
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.

Some of my Portal 2 maps || Mini-Faith || Careful Cube || Vertical Reach ||

|| Need help uploading a map...new user? Read my Map Uploading Guide ||
|| Want to play custom maps, but don't know how? Read my Playing Portal 2 Custom Maps Guide ||

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

Winner of the Nobel Prize for Being Immune to Neurotoxin

Thanks for over 1,000 downloads: The Cold Shoulder

You can do it easily with outputs on your existing math_counter.

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

There is no "N" in "Turret."

Ah, I thought there was something like OnChangedFromMax, but I wasn't sure, so I went for the other method.

Image
ImageImageImageImage
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.

Some of my Portal 2 maps || Mini-Faith || Careful Cube || Vertical Reach ||

|| Need help uploading a map...new user? Read my Map Uploading Guide ||
|| Want to play custom maps, but don't know how? Read my Playing Portal 2 Custom Maps Guide ||

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.

Image
Now with 100% more inline comments!