Custom button sound

Now we come to a harder part of this tutorial. The button sound manipulation.
First, you need to know that if you create a button and activate it, the default sound gets played in the center of it. With this information in mind we must think of an idea to get the sound being played outside of the level.

For this create a small box (completely caulked) far away in the void under the level box. Now copy the button from the map, place it into the box, DIRECTLY under the real button and put the caulk texture onto it.

(Image button box editor)
(Image button boxoutsideeditor)

If you don't place it under the button the result will be an awkward looking button starting somewhere next to the wooden box in the air.
Select both buttons and convert them together again into one func_button. If you did it correctly both two buttons (real and fake) should be selected when you hold Ctrl+Alt and click on one of them. The default sound will be played somewhere in the middle of this button.
With the button being selected open the entity window, choose the right angle, set a wait key and connect it with the target_score again. I also used a lower speed value so it fits better to the sound:

(Image button button entity)

Now we just need the sound source. For this create a small trigger_multiple which wraps up the button (1 unit more than the button on each side) so that the player really activates the button AND the trigger at the same time (if you only put the trigger in front of the button the player could activate the button from the top of it without triggering the sound):

(Image button trigger)
(Image button trigger aroundbutton)

Set the same wait key like you used in the button window and connect it with a target_speaker you will create now (I already copied one, since the sound was to gentle again).

(Image button trigger entity)

For the speaker you have again the opportunity to tick the spawnflags as you like [link jumppad tut falls es mehrere gibt].
I used none because I want everyone to hear the activation sound when they are close to the button.

(Image button speaker entity)

Now, do the same with the second button, starting from the beginning of this text (meaning: creating box, copy the button and convert it into a new one etc.):

(Image button bothbuttons)

Perhaps you ask yourself why we need a caulk box around the fake button. If there wasn't any, then the engine thinks that the button is in the void. Every entity in the void is getting marked as a leak.

There are some critical aspects to mention, though. It could be that the player only runs into the trigger but not into the button. It still plays the sound. You could put the trigger into the button, but then it could be that the player only activates the button without running into the trigger. So we just have to hope that the player still presses forward when he runs against a button.
If you connect the button directly with the speaker the problem is, that the activation sound itself only plays AFTER the button has been activated. So if you want to create a shootable button keep that in mind.

For Q3A: You'll have to do the same with the box and the trigger, but the button will be connected differently in the door part of this tutorial series.