How do different buttons work?

Avatar
Kaleido
272 Posts
Posted Mar 16, 2012
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.

Advertisement
Registered users don’t see ads! Register now!
Avatar
spongylover123
944 Posts
Posted Mar 16, 2012
Replied 19 minutes later
func_buttons
and a switch model
Avatar
Kaleido
272 Posts
Posted Mar 16, 2012
Replied 9 minutes later
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!

Avatar
spongylover123
944 Posts
Posted Mar 16, 2012
Replied 7 minutes later
one is a button, used in the underground and bts maps
models\props_gameplay\push_button.mdl
the other is switch used in the coop maps
models\props_gameplay\circuit_breaker_box.mdl
models\props_gameplay\circuit_breaker_lever.mdl
Avatar
Pitkakorvaa
200 Posts
Posted Mar 17, 2012
Replied 7 hours later
models\props_gameplay\circuit_breaker_box.mdl and models\props_gameplay\circuit_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.

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.

Avatar
Spam Nugget
492 Posts
Posted Mar 17, 2012
Replied 1 hour later
There are many topics out there on those switchs or circuit breakers or whatever you want to call them. search.
Avatar
mtxd
5 Posts
Posted Mar 17, 2012
Replied 4 hours later
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.
Avatar
RustyDios
154 Posts
Posted Mar 17, 2012
Replied 8 hours later
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!?!

Avatar
Kaleido
272 Posts
Posted Mar 17, 2012
Replied 19 minutes later
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.

Avatar
andyb
257 Posts
Posted Mar 17, 2012
Replied 1 hour later
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
Avatar
RustyDios
154 Posts
Posted Mar 17, 2012
Replied 2 hours later

Kaleido wrote:
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.

Well, I'm glad that it at least works once!
I think the issue here (if your using the func_door_rotating idea) is that "UseOpens" obviously does exactly what it says... use opens.. ie use again doesn't close, it opens again... .... .. maybe have two identical func_door_rotating side by side, but mirrored. Have the outputs on both set to do their thing OnFullyOpen and also to close the other one. That way you should always have a "closed" door to open (onuse) .... erm .. now you'll also need to swap the Parent of the Model to the other/sister/mirror door as well... ..

Hell there must be an easier way then all that...
How about trying out this ...

Avatar
HMW
806 Posts
Posted Mar 18, 2012
Replied 17 hours later
Are you using a func_rot_button? That's the one you want for moving the lever, not func_door_rotating or func_rotating. (Sorry if you've already figured this out; I don't see func_rot_button mentioned anywhere in this thread.)

Make sure you parent the moving part of the switch to it, and set the "toggle" flag; that way the player can flip it on and off repeatedly. Use the OnIn and OnOut signals to change the funnel direction. I don't think you need any additional logic control entities, as the toggle function is already built into the button itself.

(The "X axis", "Y axis" and "Distance (deg)" work the same as for the func_door_rotating.)

Avatar
Kaleido
272 Posts
Posted Mar 19, 2012
Replied 10 hours later
I changed it to a func_rot_button but now it doesn't work at all...
Avatar
Kaleido
272 Posts
Posted Mar 21, 2012
Replied 2 days later
This is what I have... ignore the random shit and crappy textures in that room, I deleted the puzzle elements in order to not spoil what my puzzle is :razz:

Someone either explain to me why this doesn't work, or re-upload a working version pleeeease...

i've tried a bunch of things, and none of them work... the one I posted is with the func_rot_button that... doesn't work either... T_T

Attachments
button_halp.vmf
0.10 MB 34 downloads
Avatar
spongylover123
944 Posts
Posted Mar 21, 2012
Replied 53 minutes later

Kaleido wrote:
This is what I have... ignore the random shit and crappy textures in that room, I deleted the puzzle elements in order to not spoil what my puzzle is :razz:

Someone either explain to me why this doesn't work, or re-upload a working version pleeeease...

i've tried a bunch of things, and none of them work... the one I posted is with the func_rot_button that... doesn't work either... T_T

I fixed a lot of things for you.

EDIT: EDITED THE FUNC_BUTTONS

Attachments
button_halp.vmf
0.08 MB 40 downloads
Avatar
Kaleido
272 Posts
Posted Mar 21, 2012
Replied 18 minutes later
Are you sure you uploaded the right file? I literally see no difference with my setup and it doesn't work still...
Avatar
HMW
806 Posts
Posted Mar 24, 2012
Replied 2 days later

Kaleido wrote:
Someone either explain to me why this doesn't work, or re-upload a working version pleeeease...

You're almost there, actually. You just need to enable the "use activates" and "touch activates" flags. And you may want to make the button brush a bit larger so it's easier to hit.

Here's a modified version with those changes implemented:

Avatar
Kaleido
272 Posts
Posted Mar 24, 2012
Replied 2 hours later
Oh... "Use activates" ... T_T

That makes me feel so stupid. Note to future self: check flags before asking dumb questions

Thank you soooo much!!!

:biggrin: :biggrin: :biggrin:

Advertisement
Registered users don’t see ads! Register now!
Avatar
HMW
806 Posts
Posted Mar 25, 2012
Replied 14 hours later
Don't feel stupid! I don't believe that there is a more cryptic way to describe what that flag does than "Use activates". (I had to look it up on the VDC again while looking at your file.)

Also minor correction: I wrote "touch activates" above where I meant "toggle" :redface:
But I assume that you figured that one out already :smile: