Please or Register to create posts and topics.

How do different buttons work?

Page 1 of 2Next

Obviously prop_button is very straightforward, but I've seen (in the real game and in mods) people use those switches that you pull down (I don't know what they're called and can't even find the worldmodel for them) or wall-mounted buttons... I was just wondering how this works because the valve wiki has failed me.

I hope it's as simple as it sounds and I just overlooked something.

edit: to clarify; I need a switch for a tractor beam to reverse directions, and then reverse back when switched again. As it stands, a prop_button only reverses the direction once (with the option of turning on a timer for the switch back). I want to be able to choose when it goes what direction.

func_buttons
and a switch model

So I just have a func_button play the animation of the switch and the outputs?

Sounds simple enough. Someone find me that damn switch model!

one is a button, used in the underground and bts maps
modelsprops_gameplaypush_button.mdl
the other is switch used in the coop maps
modelsprops_gameplaycircuit_breaker_box.mdl
modelsprops_gameplaycircuit_breaker_lever.mdl

modelsprops_gameplaycircuit_breaker_box.mdl and modelsprops_gameplaycircuit_breaker_lever.mdl
Doesn't have animations, so you have to play more with brushes, i.e create func_rotating and parent lever model to the brush.

Code: Select all
OnPressed > Door > Open > [Delay]*
OnPressed > func_rotating > Start**
OnPressed > func_rotating > Stop > [Delay]***

*choose same delay as lever stops delay, so door opens when lever is fully pulled down.
**Stop delay is for lever, when it stops at correct moment
***I don't remember output correctly but you'll find out

That is just quick example for levers, it takes more input/outputs to make more better.

The Corrupted - 1st place winner of the ThinkingWithPortals.com mapping contest 2012 !!

There are many topics out there on those switchs or circuit breakers or whatever you want to call them. search.

Image
I think in terms of boolean variables. Generally, it makes things easier.

You could use the normal prop_button to toggle the direction with logic_relays. One would have an output to set the linearforce to 250, the other to -250. The first would start disabled while the second one would start enabled. Pressing the button would trigger both relays. The relays would then send outputs to disable themselves and enable the other so the direction would be reversed the next time round.

You could also just use a single logic_branch with the outputs of OnFalse to set the linear force to -250(a negative number) and OnTrue to set the linear force to 250(a positive number). Then have the output of the button to be OnPressed>"your_logic_branch">ToggleTest. Which will switch the current state to the other one and perform the change. You could then also use the same logic_branch and use the input of SetValueTest (0/False or 1/True) to change the direction of the beam directly to what you want from a different button/trigger etc (pressing the original button will still toggle between the "current state" and the "other state")...

For the lever idea you could ToggleTest the branch at door outputs OnFullyOpened/OnFullyClosed, this will ensure that the direction won't change until the switch is moved all the way. (Providing that you can get the parenting of the func and model to look correct). See here for more information on rotating doors and specifically setting the "pivot" point!.((Although for a full 180deg arc for a circuit breaker it may be best to leave the origin in the center of the brush and align the model base to the center/origin point))... And setting the door flag of UseOpens if its placed "nodraw" over your model will make it appear the player has actually used the lever .... You could also use the "Delay Before Reset" of the door to make a timed lever... ...

Hope that helps you and I didn't start rambling too much!?!

Ok, I got the lever switch working, but it only triggers once (rotates downward), and then never moves again even though I'm spamming the use button -_-"

All the outputs work, but only once.

You would need to change the setting the setting to...Christ I cant remember but the setting something like reversing what you already asked it to do sorta like a on press open/On press close

Page 1 of 2Next