category
Miscellaneous
description
Learn to bring your own music in-game.
keywords
custom, music, sounds, sound.
First you need to make a folder named "sound", that folder should be placed in the mod folder
Example:
Wherever you have installed steam.
...\Valve\Steam\SteamApps\SourceMods\"modname"\sound
My folder in my mod
modname
--cfg
--DownloadLists
--maps
--resource
--SAVE
--scripts
--sound (thats your sound folder)
Copy some sounds into that folder *.wav or *.mp3 works.
Then in your map, construct whatever you want to or maybe you have an already finished map\testmap
place a Entity named "ambient_generic" where you want your sound\music
go on properties, fix a name for your "ambient_generic" and stuff like that
Well, to the music\sound, go to the Keyvalue named "Sound Name" (Here you have to be specific)
Type the name of the sound\music you want to be played.
Example:
sound
--music1.mp3
--effect1.wav
Let's take the music first
Put music1.mp3 as the value in "Sound Name" (note you cannot play it in the editor)
Use some Outputs to activate the "ambient_generic" (with your desired name)
Remember to set the Keyvalue "Start Volume" to a number between 1-10 (1 lowest - 10 highest)
I used a func_button to trigger the sound
and on Outputs on the func_button:
My output named - OnPressed
Targets enteties named - "ambient_generic"(ur sound\music)
Via this input - PlaySound
Then it should work