If Statements in Hammer

Are “if” Statements Possible?
I’ve found the logic_branch which allows me to use “bool”

Basically here is what I have…

3 Pipes all spewing Gas.
The player has to solve a puzzle to turn the gas off.
If they don’t they die.

I am currently using Bools to check if the gas is on or not.
So I either need something for IF statements or
Something to check if all 3 bools are set to 0

Math_counter with a max of 3
Add 1 every time a gas pipe is turned off.
OnHitMax --> trigger whatever you want it to trigger


Hammer is rather…

How to say, awkward? No, it’s just.


That won’t work. See the player presses a button and 2 will turn off but on more will be left on.
But then when pressed again 1 will turn off but a different one will turn on.



for if statements (unless your doing sometihng that can be done with a math_counter) you can have whatever iot is you want to measure constantly triggering a logic_relay, then disable (or enable depending on the previous state) the relay and then make it trigger (or stop triggering) your desired effect, this is the ONLY way i have found to do it in hammer/ the source engine :saddowns:

I think I have a good system here…

Do tell.


Shit if i know but…

I think a logic_branch does it, does it not…?

I have

3 x “Func_Button”
3 x “Logic_Branch”
1 x “Logic_Branch_Listener”

When the correct button is “in” it sets the corresponding “Logic_Branch” value to 0
The “Logic_Branch_Listener” Then decides if all are true or false and do the corresponding action!