Logic gates and one way invisible-wall
Quote from solix on August 23, 2012, 5:25 amHi, I'd like to add logic gates to my map, but there are no logic_gate entity or anything like that and the wiki does not cover it.
So how do you make simple gates surch as AND OR and XOR (I see how to build the XOR with one logic branch but there got to be an easier solution...)
I successfully built an AND gate with one logic compare but when one input got a falling edge the "close" animation of the door would play. Obviously I want it to play the animation only if it was open, as you would expect...Then I would like an invisible wall (player_clip) toggle-able and one direction. When not activated the player can go both ways in the door. And when activated the player can go one way (if he is on the right side when the wall is activated) but can not come back.
I know it sounds weird but this is to prevent cheating with bunny hop.Thank you
Hi, I'd like to add logic gates to my map, but there are no logic_gate entity or anything like that and the wiki does not cover it.
So how do you make simple gates surch as AND OR and XOR (I see how to build the XOR with one logic branch but there got to be an easier solution...)
I successfully built an AND gate with one logic compare but when one input got a falling edge the "close" animation of the door would play. Obviously I want it to play the animation only if it was open, as you would expect...
Then I would like an invisible wall (player_clip) toggle-able and one direction. When not activated the player can go both ways in the door. And when activated the player can go one way (if he is on the right side when the wall is activated) but can not come back.
I know it sounds weird but this is to prevent cheating with bunny hop.
Thank you

Quote from ChickenMobile on August 23, 2012, 5:54 amThe wiki does cover logic gates. You must have missed it.
https://developer.valvesoftware.com/wiki/Logic_gateAlso preventing cheating solutions, fine. However stopping bhoppers: this is a little outrageous. 99% of all people that will play your map cannot bhop and therefore is a lot of extra work for a small audience.
If this is purely a timing issues which can be beaten, then move the corridor etc futher away.
The wiki does cover logic gates. You must have missed it.
https://developer.valvesoftware.com/wiki/Logic_gate
Also preventing cheating solutions, fine. However stopping bhoppers: this is a little outrageous. 99% of all people that will play your map cannot bhop and therefore is a lot of extra work for a small audience.
If this is purely a timing issues which can be beaten, then move the corridor etc futher away.
Quote from Brainstone on August 23, 2012, 6:01 amYou probably are looking for a logic_branch_listener. It can listen to multiple logic_branches you give and has the Outputs "OnAllFalse" "OnMixed" OnAllTrue". the Outputs are fired when one of the branches change state.
AND-Gate is OnAlltrue
XOR-Gate is OnMixed
OR-Gate is when you perform the same actions with the OnMixed and the OnAllTrue Output (Probably you want to trigger the same logic_relay which has then several OnTrigger Outputs.)For your invisible wall: You may tie a playerclip brush into a func_brush, which you then can enable/disable. But that's not exactly what you want. You could try a strong trigger_push which is enabled/disabled. The player will notice though, when he is speeded up while passing in the allowed direction.
You probably are looking for a logic_branch_listener. It can listen to multiple logic_branches you give and has the Outputs "OnAllFalse" "OnMixed" OnAllTrue". the Outputs are fired when one of the branches change state.
AND-Gate is OnAlltrue
XOR-Gate is OnMixed
OR-Gate is when you perform the same actions with the OnMixed and the OnAllTrue Output (Probably you want to trigger the same logic_relay which has then several OnTrigger Outputs.)
For your invisible wall: You may tie a playerclip brush into a func_brush, which you then can enable/disable. But that's not exactly what you want. You could try a strong trigger_push which is enabled/disabled. The player will notice though, when he is speeded up while passing in the allowed direction.
Quote from solix on August 23, 2012, 6:29 amI might not add a player clip for bhop, if they can bhop they probably deserve bypassing this part of the puzzle...
As for the logic gate, it works fine except for the closing door part, the door closes when it's already closed.
OnAllTrue | ExitDoor | SetAnimation | open
OnMixed | ExitDoor | SetAnimation | closeThe problem is, if all the inputs are low and one goes high it triggers the OnMixed output... How am I supposed to fix that ?
I might not add a player clip for bhop, if they can bhop they probably deserve bypassing this part of the puzzle...
As for the logic gate, it works fine except for the closing door part, the door closes when it's already closed.
OnAllTrue | ExitDoor | SetAnimation | open
OnMixed | ExitDoor | SetAnimation | close
The problem is, if all the inputs are low and one goes high it triggers the OnMixed output... How am I supposed to fix that ?
Quote from zivi7 on August 23, 2012, 7:26 amYou could use a math_counter.
Make your different test elements add 1 to the counter when they're activated and subtract 1 when they're deactivated. If you have 5 test elements that need to be activated at once for the door, set the maximum value of the math_counter to 5. Give it an output to open the door "OnHitMax" and to close the door "OnChangedFromMax".
You could use a math_counter.
Make your different test elements add 1 to the counter when they're activated and subtract 1 when they're deactivated. If you have 5 test elements that need to be activated at once for the door, set the maximum value of the math_counter to 5. Give it an output to open the door "OnHitMax" and to close the door "OnChangedFromMax".

Quote from ChickenMobile on August 23, 2012, 7:45 amYou could always disable the relevant relay to close it once it has been triggered to close and then enable once it is fully open etc.
You could always disable the relevant relay to close it once it has been triggered to close and then enable once it is fully open etc.
Quote from FelixGriffin on August 23, 2012, 8:33 amBut XOR would have to be more than OnMixed, you'd need to find if it were even or odd.
But XOR would have to be more than OnMixed, you'd need to find if it were even or odd.
Quote from solix on August 23, 2012, 8:54 amThank you all for your help, zivi7's technique is just perfect !
By the way, why when I place a prop_static with this world model : models/props/portal_door_bits_left.mdl it doesn't show in portal ?
Thank you all for your help, zivi7's technique is just perfect !
By the way, why when I place a prop_static with this world model : models/props/portal_door_bits_left.mdl it doesn't show in portal ?
Quote from Bluntman on August 23, 2012, 10:40 amsolix wrote:By the way, why when I place a prop_static with this world model : models/props/portal_door_bits_left.mdl it doesn't show in portal ?In case you didn't figured it out myself: use prop_dynamic for this model (check the info tab in model browser for available prop types)
In case you didn't figured it out myself: use prop_dynamic for this model (check the info tab in model browser for available prop types)