Music and buttons.


(Pegazus) #1

Hi i want to add a button that when its pressed then sound comes from the speakers. Ok heres what ive done already. I created a button but i didint find the button func so i used func_invisible_user. then i made the speaker which should play the sound and i added that Target_speaker so everything is good so far but i cant add the wav files, i just cant find the place to import or add them, please tell me how to add them :? I am using GTKRadiant 1.5 if it should help :expressionless:


(-SSF-Sage) #2

Put sounds under sound/… You can use sounds that came with pak0.pk3 of course. Then give the speaker a key noise and the value is the path to the your sound in example:

noise

sound/world/war.wav


(Pegazus) #3

Thanks for the replay, but i didint understand much :S Can u PM me ur msn address or something so i can contact you for further help :slight_smile:


(Wezelkrozum) #4
  • keys of the speaker for a sound:
    noise
    a directory like: sound/mapname/1.wav

  • make a pk3file and put there your sound.

! the sound must be a 16bits-mono-sound !


(Flippy) #5

A target_speaker is an entity.

You need to give entities the correct properties so they know what they should be doing.

A property is made up out of a key and a value.
Basically, the key is a property and it’s value tells it what do to with the property.

To give entities properties, select an entity and press “N”. You will see a list with the current properties of the selected entity, and two textboxes (key, and value).

To play a sound, you should give your target_speaker entity the following property:
key: noise
value: sound/some_folder/some_file.wav
(preferably “sound/<mapname>/<soundname>.wav”, but it doesn’t really matter.)

A little note, the value of noise should always start at the “sound” path. Don’t enter the full path (which would probably be “C:\Program Files…”), it will not work!

Also, you don’t state that you connected the func_invis_user with your target_speaker. You should connect them (or alert the speaker via the script, but that’s not necesary here) for it to work.
Deselect everything (ESC), then select the func_invisible_user, then hold Shift and also select the target_speaker, then press “Ctrl+K”. A thin line with an arrow pointing from the func_invis_user to the speaker should appear.

Lastly, if you need the actual button entity, search this forum for “new entities” or similar. Make sure you get the entities for version 1.5, which are in a new format afaik!


(Pegazus) #6

Thanks flippy :slight_smile: I think i got it working :wink: