Page 1 of 1
How to add looping music with mapadd?
Posted: Thu Aug 04, 2011 12:31 pm
by SgtPotato
Hello, i would like to know how to add looping music with mapadd.
I thought yesterday that music would add some good ambience into my map.
Thanks in advance.
(Pardon me for my not-so-good thread making

)
Re: How to add looping music with mapadd?
Posted: Thu Aug 04, 2011 3:33 pm
by TESLA-X4
Code: Select all
Add
{
// This plays the sound. DO NOT TRIGGER THIS ENTITY.
"ambient_generic"
{
"health" "10"
"message" "path/to/sound.file"
"pitch" "100"
"pitchstart" "100"
"radius" "1250"
"spawnflags" "49"
"targetname" "snd_1"
"origin" "-872 -1376 530"
}
// This is the trigger for the sequence. ONLY TRIGGER THIS ENTITY TO START, DO NOT TRIGGER THE OTHERS INDIVIDUALLY!
"logic_relay"
{
"spawnflags" "0"
"targetname" "rly_snd1"
"origin" "-848 -1376 530"
"OnTrigger" "snd_1,PlaySound,,0,-1"
"OnTrigger" "tim_snd1_looper,Enable,,0,-1"
"OnTrigger" "rly_snd1_fadetrigger,Enable,,0,-1"
}
// This is the timer to loop the sound. DO NOT TRIGGER THIS ENTITY.
"logic_timer"
{
// Change this vvv to match the time the sound ends (time is in seconds)
"RefireTime" "240"
"spawnflags" "0"
"StartDisabled" "1"
"targetname" "tim_snd1_looper"
"origin" "-824 -1376 530"
"OnTimer" "snd_1,PlaySound,,0,-1"
}
// This is the trigger to stop the sound (with a 1.5 second fade). ONLY TRIGGER THIS ENTITY TO STOP, DO NOT TRIGGER THE OTHERS INDIVIDUALLY!
"logic_relay"
{
"spawnflags" "0"
"StartDisabled" "1"
"targetname" "rly_snd1_fadetrigger"
"origin" "-800 -1376 530"
"OnTrigger" "snd_1,FadeOut,1.5,0,-1"
"OnTrigger" "tim_snd1_looper,Disable,,0,-1"
"OnTrigger" "!self,Disable,,0,-1"
}
}
Re: How to add looping music with mapadd?
Posted: Thu Aug 04, 2011 8:35 pm
by SgtPotato
Alright, thanks for help

Re: How to add looping music with mapadd?
Posted: Thu Aug 04, 2011 10:05 pm
by fug4life
You'll have to change the origin's to a location in the map you're mapadding for otherwise you could throw ents out of the map.
Re: How to add looping music with mapadd?
Posted: Fri Aug 05, 2011 1:07 am
by TESLA-X4
Well, afaik placing logical entities outside the map after the map (e.g. with a MapAdd) is compiled is perfectly fine, because it's impossible for a map to leak post-compile. Just don't place props or other visible entities outside the map.
Re: How to add looping music with mapadd?
Posted: Sat Aug 06, 2011 3:32 pm
by fug4life
Sorry didn't get back here, you could be right. I'm not sure.