• If Statements in Hammer
    7 replies, posted
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
[QUOTE=Miigga;18028666]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[/QUOTE] This. Hammer is rather... How to say, awkward? No, it's just. Illogical.
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. [editline]07:54PM[/editline] Logic_branch_listener?
for [I]if[/I] 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...
[QUOTE=Loli;18029014]I think I have a good system here...[/QUOTE] Do tell. [editline]01:50PM[/editline] Shit if i know but... I think a logic_branch does it, does it not..? [url]http://developer.valvesoftware.com/wiki/Logic_branch[/url]
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!
Sorry, you need to Log In to post a reply to this thread.