How do different buttons work?
Quote from Kaleido on March 16, 2012, 8:08 pmObviously 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.
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.
Quote from spongylover123 on March 16, 2012, 8:27 pmfunc_buttons
and a switch model
func_buttons
and a switch model
Quote from Kaleido on March 16, 2012, 8:37 pmSo 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!
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!
Quote from spongylover123 on March 16, 2012, 8:44 pmone 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
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
Quote from Pitkakorvaa on March 17, 2012, 4:05 ammodelsprops_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 outThat is just quick example for levers, it takes more input/outputs to make more better.
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.
Quote from Spam Nugget on March 17, 2012, 5:13 amThere are many topics out there on those switchs or circuit breakers or whatever you want to call them. search.
There are many topics out there on those switchs or circuit breakers or whatever you want to call them. search.

I think in terms of boolean variables. Generally, it makes things easier.
Quote from mtxd on March 17, 2012, 10:07 amYou 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 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.
Quote from RustyDios on March 17, 2012, 6:23 pmYou 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!?!
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!?!
Quote from Kaleido on March 17, 2012, 6:42 pmOk, 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.
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.
Quote from andyb on March 17, 2012, 8:01 pmYou 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
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
