How to add looping music with mapadd?

Need Help? The Day isnt going so well on the Mapping front?
Post Reply
SgtPotato
Vertex
Vertex
Posts: 5
Joined: Thu Aug 04, 2011 12:26 pm

How to add looping music with mapadd?

Post 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 :) )
User avatar
TESLA-X4
Former Developer
Former Developer
Posts: 570
Joined: Wed Jul 01, 2009 3:26 pm
Location: $Recycle.Bin

Re: How to add looping music with mapadd?

Post 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"
		}
	}
Apparently, Valve can't make games beyond the number 2.
I think the only time we'll get a Source SDK code update is when it starts having purchasable hats integrated, i.e. hatconomy.

Please do not make assumptions you are not knowledgeable enough to make - that just backfires on yourself.
Tick me off, and I'll be sure to give you the golden treatment. Haven't you heard? Silence is golden.
SgtPotato
Vertex
Vertex
Posts: 5
Joined: Thu Aug 04, 2011 12:26 pm

Re: How to add looping music with mapadd?

Post by SgtPotato »

Alright, thanks for help :)
fug4life
Beta Tester
Beta Tester
Posts: 4093
Joined: Mon Dec 11, 2006 10:35 am

Re: How to add looping music with mapadd?

Post 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.
'I would probably smarten up before you meet Violet'.
'She has zero tolerance for idiots'.

fug's Obsidian files
fug's Obsidian clips
Obsidian wiki
Obsidian Map Database
User avatar
TESLA-X4
Former Developer
Former Developer
Posts: 570
Joined: Wed Jul 01, 2009 3:26 pm
Location: $Recycle.Bin

Re: How to add looping music with mapadd?

Post 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.
Apparently, Valve can't make games beyond the number 2.
I think the only time we'll get a Source SDK code update is when it starts having purchasable hats integrated, i.e. hatconomy.

Please do not make assumptions you are not knowledgeable enough to make - that just backfires on yourself.
Tick me off, and I'll be sure to give you the golden treatment. Haven't you heard? Silence is golden.
fug4life
Beta Tester
Beta Tester
Posts: 4093
Joined: Mon Dec 11, 2006 10:35 am

Re: How to add looping music with mapadd?

Post by fug4life »

Sorry didn't get back here, you could be right. I'm not sure.
'I would probably smarten up before you meet Violet'.
'She has zero tolerance for idiots'.

fug's Obsidian files
fug's Obsidian clips
Obsidian wiki
Obsidian Map Database
Post Reply