Talk:Switch

From Valve Developer Community
Jump to: navigation, search

Not quite sure what this is supposed to be about. Is it supposed to be a tutorial on those push buttons? --Remmiz 00:17, 20 Nov 2007 (PST)

Yes. And I would write it, but I can't figure out how to make a ticking sound that is audible anywhere in the map. Using the flag "Play Everwhere" does not do it (it still fades out at distance, or if a wall comes between the entity location and player).
Anyway, what I do is: create a prop_dynamic with model switch001.mdl, and then make a 8x8x8 brush tied to entity func_button (flags: Don't Move, Use Activates). If you want a timed button, set the "delay before reset" to long enough to where it won't interfere with the sequence that the button triggers. A push-only-once button should have delay set to -1. Then I set outputs so that when it's pressed, it triggers a logic relay, which animates the switch down with SetAnimation down (as well as open a door, trigger other logics, etc). If it's a timed button I set the logic also to reset the button with SetAnimation up (also closing a door or triggering other logics).
But I definitely can't convince the button to trigger anything to tick continuously AND globally, while the button is pressed. Any help would be delightful --volt 02:51, 22 Nov 2007 (PST)
Just did some more work with it. I'm starting to think that "Play Everywhere" simply doesn't work in Portal. --volt 03:33, 22 Nov 2007 (PST)
I got this down pretty well, i'll work on a tutorial today. --Remmiz 12:30, 22 Nov 2007 (PST)
Looks good. For cases where the button and door are further apart, it may be helpful to some if this page described that the "Play Everywhere" flag of the tickloop doesn't function correctly if editing for Portal (or at the very least I can't get it to work, and I've tried everything). Alternate routes are to create more switch_sound_tick's or use a logic_choreographed_scene. --volt 23:57, 22 Nov 2007 (PST)
Ive noticed that if you leave the range on the ambient_genertic to the default, it will reach fairly far. You can also increase that if you so need to.--Remmiz 00:05, 23 Nov 2007 (PST)
Does the volume of the sound depend on if world geometry comes between the player and the sound? For example, my button requires that you press the button then fall down a deep hole with a portal at the bottom, which takes you across the map, launching across a chasm where you'll find the door that the trigger opened. See your talk page, Remmiz. --volt 00:20, 23 Nov 2007 (PST)

How about buttons that allow you to reset them while active by pressing again? It is probably a desired effect, but differs significantly from your walkthrough from what I understand. For mine, I have: (ex. 10sec timer)

func_button: delay before reset: 0

My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnPressed switch_logic CancelPending <none> 0.00 No
Io11.png OnPressed switch_logic Trigger <none> 0.01 No
Io11.png OnPressed switch_logic Trigger <none> 0.01 No

switch_logic:

My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnTrigger switch SetAnimation down 0.00 No
Io11.png OnTrigger door_left Open <none> 0.00 No
Io11.png OnTrigger door_right Open <none> 0.00 No
Io11.png OnTrigger door_opensound PlaySound <none> 0.00 No
Io11.png OnTrigger switch_sound_tickloop Enable <none> 0.00 No
Io11.png OnTrigger switch SetAnimation up 10.00 No
Io11.png OnTrigger door_left Close <none> 10.00 No
Io11.png OnTrigger door_right Close <none> 10.00 No
Io11.png OnTrigger door_closesound PlaySound <none> 10.00 No
Io11.png OnTrigger switch_sound_tickloop Disable <none> 10.00 No

Then you'd put in a logic_timer to refire the ticksound. What do you think? --volt 00:20, 23 Nov 2007 (PST)

won't the animation look kind of strange, repeating "down" all the time? how shall we do to keep it pushed down? --unsigned

No, when the animation is finished, the model goes idle, maintaining the most recent frame that it processed in an animation. In this case, the last frame of the "down" animation will be held until the model is given either another animation command, either "up" or "down". Also please sign your comments with two dashes followed by four tildes. --volt 16:18, 6 Dec 2007 (PST)

Misleading guide

This guide was slightly misleading, I changed it slightly --Mandrew (talk) 14:02, 23 July 2021 (PDT)

It was based on the exact setup used in the official Valve made Portal maps from decompiles. — Dr. Orange talk · contributions 14:05, 23 July 2021 (PDT)
Excuse my poor wording, I should've said "part of it" was slightly misleading. The part I was referring to was the brush size being 32w*64l*8h when it should be 64w*64l*8h, I know this response is way overdue but I for some reason never bothered checking the talk page and I actually forgot that I made that comment --Mandrew (talk) 02:17, 6 April 2022 (PDT)