Hammer & Half-Life 2: Shuffle Songs Using Logic?

Hammer & Half-Life 2: Shuffle Songs Using Logic?

Re: Hammer & Half-Life 2: Shuffle Songs Using Logic? Posted by Sehnsucht on Fri Dec 26th 2008 at 6:59pm
Sehnsucht
12 posts
Posted 2008-12-26 6:59pm
12 posts 1 snarkmarks Registered: Dec 26th 2008
Hello, I would appreciate some assistance with rigging up a logic system in Valve's Hammer Editor for Half-Life 2 that upon map entry by a player, one of 16 songs plays. (Chosen at random)

I figure it involves:
logic_auto(OnMapSpawn) -> logic_case(PickRandomShuffle) -> ambient_generic(w/ timed trigger of logic_case)

Have I missed anything? Is there a simpler way? I don't want to have to change the game library. (Binary/dll)

How do I assign music to the music channel, so those who wish not to hear the music can pot it down in their settings?
Re: Hammer & Half-Life 2: Shuffle Songs Using Logic? Posted by Riven on Sat Dec 27th 2008 at 7:14am
Riven
1640 posts
Posted 2008-12-27 7:14am
Riven
Wuch ya look'n at?
super admin
1640 posts 1266 snarkmarks Registered: May 2nd 2005 Occupation: Architect Location: Austin, Texas, USA
As far as the logic system goes, you're using the right logic entities AFAIK. Simply list them under that logic_case, and let it pick random shuffle, and you'll be good to go.

-Now, for your next dilemma. You want to make sure your songs can be controlled through just the music volume in the options window? Well, I wasn't sure how to do this myself, and I'll start off by saying, I still don't know what the difference is, but I did do a bit of experimentation; here's what I found out...

So, I built a small test map that contained an env_soundscape and two ambient_generics. These are the only two direct entities that can play sound in the game (besides VDC files when playing scenes). The env_soundscape used the soundscape titled: "cabin" (without quotes). It has one direction channel, so I was able to test that. I was testing this in the Half-Life 2 original engine. (Labeled under the EP1 engine now since they've updated it...). For the first ambient_generic, I gave it a looping game sound; some tv sound and tied it to a trigger volume, so it was only activated when the player was standing in the right place, and let it play with a focal center. The second ambient_generic, I gave it one of the known music files and triggered it to play from the launch of the map and play everywhere.

Upon testing the map, I turned both the game sounds volume, and music volume channels up and lowered the music channel volume to 0. Nothing muted even the triggered sound still played. I brought it back up all the way, and muted the game sounds volume, and sure enough everything muted, including sound of your feet and the song from the second ambient_generic. I did a couple more tests to make sure this wasn't a fluke, but it was the same result every time.

So, since I didn't know the difference between music channel sounds, and game sounds, I decided to test this in the actual game, so I started a new game in HL2 to see what would be affected by the music muting. I played up until the part (constantly checking) to when you first walk out into the big city center (the first time you're outside in public). And there was music starting. So sure enough, I muted the music channel, and the music stopped. I didn't have enough time to check out the .vmf of that map, but I would find out what makes that music sound different from other sounds and duplicate that for your songs in your map. The rest of the logic system should fall into place nicely :)

-Good luck!
Blog: www.playingarchitecture.net
LinkedIn: Eric Lancon
Twitter:@Riven202
Re: Hammer & Half-Life 2: Shuffle Songs Using Logic? Posted by Sehnsucht on Sun Dec 28th 2008 at 1:49pm
Sehnsucht
12 posts
Posted 2008-12-28 1:49pm
12 posts 1 snarkmarks Registered: Dec 26th 2008
Thanks for the response! If I find out exactly how they use the music channel, I will post back here about it.
Re: Hammer & Half-Life 2: Shuffle Songs Using Logic? Posted by Sehnsucht on Sun Dec 28th 2008 at 3:03pm
Sehnsucht
12 posts
Posted 2008-12-28 3:03pm
12 posts 1 snarkmarks Registered: Dec 26th 2008
UPDATE:

It's not working which is fustrating. Symptom: When I enter the map, no music plays and when I manually command "musicpicker" to "PickRandomShuffle" (ent_fire musicpicker PickRandomShuffle) the engine lags to a halt with one of the songs skipping. Its always the same song every time so it can't be picking a random song. Maybe it's something simple I missed, would you mind checking out my VMF?

[code]versioninfo
{
"editorversion" "400"
"editorbuild" "4037"
"mapversion" "3"
"formatversion" "100"
"prefab" "0"
}
visgroups
{
}
viewsettings
{
"bSnapToGrid" "1"
"bShowGrid" "1"
"bShowLogicalGrid" "0"
"nGridSpacing" "16"
"bShow3DGrid" "0"
}
world
{
"id" "1"
"mapversion" "3"
"classname" "worldspawn"
"skyname" "sky_day01_01"
"maxpropscreenwidth" "-1"
"detailvbsp" "detail.vbsp"
"detailmaterial" "detail/detailsprites"
solid
{
"id" "733"
side
{
"id" "168"
"plane" "(-128 -128 256) (-128 128 256) (128 128 256)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 -1 0 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "167"
"plane" "(-128 128 224) (-128 128 256) (-128 -128 256)"
"material" "/REGION"
"uaxis" "[0 1 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "166"
"plane" "(128 -128 224) (128 -128 256) (128 128 256)"
"material" "/REGION"
"uaxis" "[0 1 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "165"
"plane" "(128 128 224) (128 128 256) (-128 128 256)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "164"
"plane" "(-128 -128 224) (-128 -128 256) (128 -128 256)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "163"
"plane" "(-128 128 224) (-128 -128 224) (128 -128 224)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 -1 0 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
editor
{
"color" "220 220 220"
"groupid" "745"
"visgroupshown" "1"
"visgroupautoshown" "1"
}
}
solid
{
"id" "735"
side
{
"id" "174"
"plane" "(-128 128 0) (-128 -128 0) (128 -128 0)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 -1 0 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "173"
"plane" "(-128 -128 32) (-128 -128 0) (-128 128 0)"
"material" "/REGION"
"uaxis" "[0 1 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "172"
"plane" "(128 128 32) (128 128 0) (128 -128 0)"
"material" "/REGION"
"uaxis" "[0 1 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "171"
"plane" "(-128 128 32) (-128 128 0) (128 128 0)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "170"
"plane" "(128 -128 32) (128 -128 0) (-128 -128 0)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "169"
"plane" "(-128 -128 32) (-128 128 32) (128 128 32)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 -1 0 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
editor
{
"color" "220 220 220"
"groupid" "745"
"visgroupshown" "1"
"visgroupautoshown" "1"
}
}
solid
{
"id" "737"
side
{
"id" "180"
"plane" "(-128 -128 224) (-128 -128 32) (-128 128 32)"
"material" "/REGION"
"uaxis" "[0 1 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "179"
"plane" "(-128 128 224) (-128 128 32) (-96 128 32)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "178"
"plane" "(-96 -128 32) (-128 -128 32) (-128 -128 224)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "177"
"plane" "(-128 -128 224) (-128 128 224) (-96 128 224)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 -1 0 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "176"
"plane" "(-128 128 32) (-128 -128 32) (-96 -128 32)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 -1 0 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "175"
"plane" "(-96 128 224) (-96 128 32) (-96 -128 32)"
"material" "/REGION"
"uaxis" "[0 1 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
editor
{
"color" "220 220 220"
"groupid" "745"
"visgroupshown" "1"
"visgroupautoshown" "1"
}
}
solid
{
"id" "739"
side
{
"id" "186"
"plane" "(128 128 224) (128 128 32) (128 -128 32)"
"material" "/REGION"
"uaxis" "[0 1 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "185"
"plane" "(96 128 32) (128 128 32) (128 128 224)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "184"
"plane" "(128 -128 224) (128 -128 32) (96 -128 32)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "183"
"plane" "(96 128 224) (128 128 224) (128 -128 224)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 -1 0 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "182"
"plane" "(96 -128 32) (128 -128 32) (128 128 32)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 -1 0 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "181"
"plane" "(96 -128 224) (96 -128 32) (96 128 32)"
"material" "/REGION"
"uaxis" "[0 1 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
editor
{
"color" "220 220 220"
"groupid" "745"
"visgroupshown" "1"
"visgroupautoshown" "1"
}
}
solid
{
"id" "741"
side
{
"id" "192"
"plane" "(-96 128 32) (96 128 32) (96 128 224)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "191"
"plane" "(-96 96 224) (-96 128 224) (96 128 224)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 -1 0 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "190"
"plane" "(96 128 32) (-96 128 32) (-96 96 32)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 -1 0 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "189"
"plane" "(-96 96 32) (-96 128 32) (-96 128 224)"
"material" "/REGION"
"uaxis" "[0 1 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "188"
"plane" "(96 128 224) (96 128 32) (96 96 32)"
"material" "/REGION"
"uaxis" "[0 1 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "187"
"plane" "(96 96 32) (-96 96 32) (-96 96 224)"
"material" "/REGION"

"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
editor
{
"color" "220 220 220"
"groupid" "745"
"visgroupshown" "1"
"visgroupautoshown" "1"
}
}
solid
{
"id" "743"
side
{
"id" "198"
"plane" "(96 -128 32) (-96 -128 32) (-96 -128 224)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "197"
"plane" "(96 -128 224) (-96 -128 224) (-96 -96 224)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 -1 0 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "196"
"plane" "(-96 -96 32) (-96 -128 32) (96 -128 32)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 -1 0 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "195"
"plane" "(-96 -128 224) (-96 -128 32) (-96 -96 32)"
"material" "/REGION"
"uaxis" "[0 1 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "194"
"plane" "(96 -96 32) (96 -128 32) (96 -128 224)"
"material" "/REGION"
"uaxis" "[0 1 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
side
{
"id" "193"
"plane" "(-96 -96 32) (96 -96 32) (96 -96 224)"
"material" "/REGION"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}
editor
{
"color" "220 220 220"
"groupid" "745"
"visgroupshown" "1"
"v
Re: Hammer & Half-Life 2: Shuffle Songs Using Logic? Posted by Sehnsucht on Sun Dec 28th 2008 at 4:16pm
Sehnsucht
12 posts
Posted 2008-12-28 4:16pm
12 posts 1 snarkmarks Registered: Dec 26th 2008
I solved the problem!

What you need is an ambient_generic for each song, a logic_auto and a logic_case. First of all, you need to get the logic_auto to work, because for whatever reason people have been having problems getting it to launch a sound at map spawn. In the logic_auto, stop all your sounds with a delay of .2 and use a delay of .5 to launch your logic_case. This works like a charm, but it's annoying how you need to use a trick to get something like this to work.

In the logic_case you can trigger up to 16 songs, and you need to trigger a the logic_case in the same case (case1 for example) using a delay the length of the song. A 2:54 minute song (60 * 2 + 54 + 1) should be 175 seconds.

What a pain! Again, if there is a better/easier/faster way to do it, please let me know. This is what my VMF looks like now:

[code]versioninfo
{
"editorversion" "400"
"editorbuild" "4037"
"mapversion" "10"
"formatversion" "100"
"prefab" "0"
}
visgroups
{
}
viewsettings
{
"bSnapToGrid" "1"
"bShowGrid" "1"
"bShowLogicalGrid" "0"
"nGridSpacing" "16"
"bShow3DGrid" "0"
}
world
{
"id" "1"
"mapversion" "10"
"classname" "worldspawn"
"skyname" "sky_day01_01"
"maxpropscreenwidth" "-1"
"detailvbsp" "detail.vbsp"
"detailmaterial" "detail/detailsprites"
}
entity
{
"id" "2"
"classname" "logic_case"
"targetname" "musicpicker"
connections
{
"OnCase01" "music-adrenalinejunkie,PlaySound,,0,-1"
"OnCase02" "music-complex13,PlaySound,,0,-1"
"OnCase03" "music-counterattack,PlaySound,,0,-1"
"OnCase04" "music-etf,PlaySound,,0,-1"
"OnCase05" "music-gravitywell,PlaySound,,0,-1"
"OnCase06" "music-onebloodbath,PlaySound,,0,-1"
"OnCase07" "music-pressurepoint,PlaySound,,0,-1"
"OnCase08" "music-stealthfrag,PlaySound,,0,-1"
"OnCase09" "music-biggun,PlaySound,,0,-1"
"OnCase10" "music-descentintocerberon,PlaySound,,0,-1"
"OnCase11" "music-killratio,PlaySound,,0,-1"
"OnCase12" "music-marchofthestroggs,PlaySound,,0,-1"
"OnCase13" "music-operationoverlord,PlaySound,,0,-1"
"OnCase14" "music-quadmachine,PlaySound,,0,-1"
"OnCase15" "music-rage,PlaySound,,0,-1"
"OnCase16" "music-theunderworld,PlaySound,,0,-1"
"OnCase01" "musicpicker,PickRandomShuffle,,172,-1"
"OnCase02" "musicpicker,PickRandomShuffle,,178,-1"
"OnCase03" "musicpicker,PickRandomShuffle,,192,-1"
"OnCase04" "musicpicker,PickRandomShuffle,,174,-1"
"OnCase05" "musicpicker,PickRandomShuffle,,154,-1"
"OnCase06" "musicpicker,PickRandomShuffle,,175,-1"
"OnCase07" "musicpicker,PickRandomShuffle,,183,-1"
"OnCase08" "musicpicker,PickRandomShuffle,,178,-1"
"OnCase09" "musicpicker,PickRandomShuffle,,185,-1"
"OnCase10" "musicpicker,PickRandomShuffle,,156,-1"
"OnCase11" "musicpicker,PickRandomShuffle,,153,-1"
"OnCase12" "musicpicker,PickRandomShuffle,,172,-1"
"OnCase13" "musicpicker,PickRandomShuffle,,209,-1"
"OnCase14" "musicpicker,PickRandomShuffle,,216,-1"
"OnCase15" "musicpicker,PickRandomShuffle,,138,-1"
"OnCase16" "musicpicker,PickRandomShuffle,,155,-1"
}
"origin" "-56 24 48"
editor
{
"color" "220 30 220"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 1500]"
}
}
entity
{
"id" "4"
"classname" "logic_auto"
"spawnflags" "1"
connections
{
"OnMapSpawn" "musicpicker,PickRandomShuffle,,0.5,-1"
"OnMapSpawn" "music-theunderworld,StopSound,,0.2,-1"
"OnMapSpawn" "music-rage,StopSound,,0.2,-1"
"OnMapSpawn" "music-quadmachine,StopSound,,0.2,-1"
"OnMapSpawn" "music-operationoverlord,StopSound,,0.2,-1"
"OnMapSpawn" "music-marchofthestroggs,StopSound,,0.2,-1"
"OnMapSpawn" "music-killratio,StopSound,,0.2,-1"
"OnMapSpawn" "music-descentintocerberon,StopSound,,0.2,-1"
"OnMapSpawn" "music-biggun,StopSound,,0.2,-1"
"OnMapSpawn" "music-stealthfrag,StopSound,,0.2,-1"
"OnMapSpawn" "music-pressurepoint,StopSound,,0.2,-1"
"OnMapSpawn" "music-onebloodbath,StopSound,,0.2,-1"
"OnMapSpawn" "music-gravitywell,StopSound,,0.2,-1"
"OnMapSpawn" "music-etf,StopSound,,0.2,-1"
"OnMapSpawn" "music-counterattack,StopSound,,0.2,-1"
"OnMapSpawn" "music-complex13,StopSound,,0.2,-1"
"OnMapSpawn" "music-adrenalinejunkie,StopSound,,0.2,-1"
}
"origin" "-56 8 48"
editor
{
"color" "220 30 220"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 1500]"
}
}
entity
{
"id" "6"
"classname" "ambient_generic"
"targetname" "music-stealthfrag"
"health" "10"
"preset" "0"
"volstart" "0"
"fadeinsecs" "0"
"fadeoutsecs" "0"
"pitch" "100"
"pitchstart" "100"
"spinup" "0"
"spindown" "0"
"lfotype" "0"
"lforate" "0"
"lfomodpitch" "0"
"lfomodvol" "0"
"cspinup" "0"
"radius" "1250"
"spawnflags" "49"
"message" "music/stealthfrag.mp3"
"origin" "-72 24 48"
editor
{
"color" "220 30 220"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 500]"
}
}
entity
{
"id" "9"
"classname" "ambient_generic"
"targetname" "music-theunderworld"
"health" "10"
"preset" "0"
"volstart" "0"
"fadeinsecs" "0"
"fadeoutsecs" "0"
"pitch" "100"
"pitchstart" "100"
"spinup" "0"
"spindown" "0"
"lfotype" "0"
"lforate" "0"
"lfomodpitch" "0"
"lfomodvol" "0"
"cspinup" "0"
"radius" "1250"
"spawnflags" "49"
"message" "music/theunderworld.mp3"
"origin" "-88 24 48"
editor
{
"color" "220 30 220"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 500]"
}
}
entity
{
"id" "12"
"classname" "ambient_generic"
"targetname" "music-rage"
"health" "10"
"preset" "0"
"volstart" "0"
"fadeinsecs" "0"
"fadeoutsecs" "0"
"pitch" "100"
"pitchstart" "100"
"spinup" "0"
"spindown" "0"
"lfotype" "0"
"lforate" "0"
"lfomodpitch" "0"
"lfomodvol" "0"
"cspinup" "0"
"radius" "1250"
"spawnflags" "49"
"message" "music/rage.mp3"
"origin" "-88 8 48"
editor
{
"color" "220 30 220"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 500]"
}
}
entity
{
"id" "15"
"classname" "ambient_generic"
"targetname" "music-pressurepoint"
"health" "10"
"preset" "0"
"volstart" "0"
"fadeinsecs" "0"
"fadeoutsecs" "0"
"pitch" "100"
"pitchstart" "100"
"spinup" "0"
"spindown" "0"
"lfotype" "0"
"lforate" "0"
"lfomodpitch" "0"
"lfomodvol" "0"
"cspinup" "0"
"radius" "1250"
"spawnflags" "49"
"message" "music/pressurepoint.mp3"
"origin" "-72 8 48"
editor
{
"color" "220 30 220"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 500]"
}
}
entity
{
"id" "18"
"classname" "ambient_generic"
"targetname" "music-onebloodbath"
"health" "10"
"preset" "0"
"volstart" "0"
"fadeinsecs" "0"
"fadeoutsecs" "0"
"pitch" "100"
"pitchstart" "100"
"spinup" "0"
"spindown" "0"
"lfotype" "0"
"lforate" "0"
"lfomodpitch" "0"
"lfomodvol" "0"
"cspinup" "0"
"radius" "1250"
"spawnflags" "49"
"message" "music/onebloodbath.mp3"
"origin" "-72 -8 48"
editor
{
"color" "220 30 220"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 500]"
}
}
entity
{
"id" "21"
"classname" "ambient_generic"
"targetname" "music-quadmachine"
"health" "10"
"preset" "0"
"volstart" "0"
"fadeinsecs" "0"
"fadeoutsecs" "0"
"pitch" "100"
"pitchstart" "100"
"spinup" "0"
"spindown" "0"
"lfotype" "0"
"lforate" "0"
"lfomodpitch" "0"
"lfomodvol" "0"
"cspinup" "0"
"radius" "1250"
"spawnflags" "49"
"message" "music/quadmachine.mp3"
"origin" "-88 -8 48"
editor
{
"color" "220 30 220"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 500]"
}
}
entity
{
"id" "24"
"classname" "ambient_generic"
"targetname" "music-operationoverlord"
"health" "10"
"preset" "0"
"volstart" "0"
"fadeinsecs" "0"
"fadeoutsecs" "0"
"pitch" "100"
"pitchstart" "100"
"spinup" "0"
"spindown" "0"
"lfotype" "0"
"lforate" "0"
"lfomodpitch" "0"
"lfomodvol" "0"
"cspinup" "0"
"radius" "1250"
"spawnflags" "49"
"message" "music/operationoverlord.mp3"
"origin" "-88 -24 48"
editor
{
"color" "220 30 220"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 500]"
}
}
entity
{
"id" "27"
"classname" "ambient_generic"
"targetname" "music-gravitywell"
"health" "10"
"preset" "0"
"volstart" "0"
"fadeinsecs" "0"
"fadeoutsecs" "0"
"pitch" "100"
"pitchstart" "100"
"spinup" "0"
"spindown" "0"
"lfotype" "0"
"lforate" "0"
"lfomodpitch" "0"
"lfomodvol" "0"
"cspinup" "0"
"radius" "1250"
"spawnflags" "49"
"message" "music/gravitywell.mp3"
"origin" "-72 -24 48"
editor
{
"color" "220 30 220"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 500]"
}
}
entity
{
"id" "30"
"classname" "ambient_generic"
"targetname" "music-etf"
"health" "10"
"preset" "0"
"volstart" "0"
"fadeinsecs" "0"
"fadeoutsecs" "0"
"pitch" "100"
"pitchstart" "100"
"spinup" "0"
"spindown" "0"
"lfotype" "0"
"lforate" "0"
"lfomodpitch" "0"
"lfomodvol" "0"
"cspinup" "0"
"radius" "1250"
"spawnflags" "49"
"message" "music/etf.mp3"
"origin" "-72 -40 48"
editor
{
"color" "220 30 220"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 500]"
}
}
entity
{
"id" "33"
"classname" "ambient_generic"
"targetname" "music-marchofthestroggs"
"health" "10"
"preset" "0"
"volstart" "0"
"fadeinsecs" "0"
"fadeoutsecs" "0"
"pitch" "100"
"pitchstart" "100"
"spinup" "0"
"spindown" "0"
"lfotype" "0"
"lforate" "0"
"lfomodpitch" "0"
"lfomodvol" "0"
"cspinup" "0"
"radius" "1250"
"spawnflags" "49"
"message" "music/marchofthestroggs.mp3"
"origin" "-88 -40 48"
editor
{
"color" "220 30 220"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 500]"
}
}
entity
{
"id" "36"
"classname" "ambient_generic"
"targetname" "music-killratio"
"health" "10"
"preset" "0"
"volstart" "0"
"fadeinsecs" "0"
"fadeoutsecs" "0"
"pitch" "100"
"pitchstart" "100"
"spinup" "0"
"spindown" "0"
"lfotype" "0"
"lforate" "0"
"lfomodpitch" "0"
"lfomodvol" "0"
"cspinup" "0"
"radius" "1250"
"spawnflags" "49"
"message" "music/killratio.mp3"
"origin" "-88 -56 48"
editor
{
"color" "220 30 220"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 500]"
}
}
entity
{
"id" "39"
"classname" "
Re: Hammer & Half-Life 2: Shuffle Songs Using Logic? Posted by Riven on Sun Dec 28th 2008 at 5:24pm
Riven
1640 posts
Posted 2008-12-28 5:24pm
Riven
Wuch ya look'n at?
super admin
1640 posts 1266 snarkmarks Registered: May 2nd 2005 Occupation: Architect Location: Austin, Texas, USA
Sehnsucht said:
I solved the problem!

What you need is an _auto to work, because for whatever reason people have been having problems getting it ambient_generic for each song, a logic_auto and a logic_case. First of all, you need to get the logic to launch a sound at map spawn. In the logic_auto, stop all your sounds with a delay of .2 and use a delay of .5 to launch your logic_case. This works like a charm, but its annoying how you need to use a trick to get something like this to work.

In the logic_case you can trigger up to 16 songs, and you need to trigger the logic_case in the same case (case1 for example) using a delay the length of the song. A 2:54 minute song (60 * 2 + 54 + 1) should be 175 seconds.

What a pain! Again, if there is a better/easier/faster way to do it, please let me know. This is what my VMF looks like now:
Ok, yea, that's probably the simplest way to go about doing it, but not the most organized. Because there are no "OnEndSound" outputs for ambient_generics, you do have to estimate the length of the sounds you want to play and delay new triggers accordingly.

-The reason why you have to delay and stop all your sounds is because your sound processor (or lack of) may not be beefy enough to handle all these commands at once. Giving it a delay helps it to prioritize which one first...

The more systematic way of doing it would be to use Valve's FacePoser tool found in the SDK to create a separate choreography file (.vdc) for each sound. In those choreography files you can place triggers so that they time up exactly where you want them to. Return to Hammer and instead of using ambient_generics, you place logic_choreographed_scenes for each song in the map. Simply select the .vdc file of choice for each logic_CS (much like selecting the sound for each ambient_generic) and then reference them in the logic_case's outputs. Instead of using a delay here, go into the outputs of each of the logic_CS entities and add:

-OnTrigger1; logic_case; PickRandomShuffle; 0.00

^ Just copy and paste that output for every logic_CS and it would work exactly the same way, but more systematic and dynamic enough to make changes easily. But if I were you, I would go ahead and stick with what you have here instead of learning a new program :P -Just consider this for future reference I suppose.
Blog: www.playingarchitecture.net
LinkedIn: Eric Lancon
Twitter:@Riven202
Re: Hammer & Half-Life 2: Shuffle Songs Using Logic? Posted by Sehnsucht on Mon Dec 29th 2008 at 7:14pm
Sehnsucht
12 posts
Posted 2008-12-29 7:14pm
12 posts 1 snarkmarks Registered: Dec 26th 2008
Haha, I have integrated audio which explains the need for the work-around.

What do you mean by "they time up"? Do you mean, you have a choice between clientside spawn and server spawn? Will I be able to specify a music flag so that users who dislike the background music can mute it?

I did check out a map from Half-Life 2, and Valve seems to do something similar to what you have suggested.

In regards to:
Instead of using a delay here, go into the outputs of each of the logic_CS entities and add:

-OnTrigger1; logic_case; PickRandomShuffle; 0.00
I would like to learn the new program if it provides more flexibility. I don't understand how not using a
delay is better than using the delay work-around.

It's too bad that Valve did not include a func_musicplayer entity, but I bet I could code one into the game library/binary.
Re: Hammer & Half-Life 2: Shuffle Songs Using Logic? Posted by Riven on Tue Dec 30th 2008 at 7:06am
Riven
1640 posts
Posted 2008-12-30 7:06am
Riven
Wuch ya look'n at?
super admin
1640 posts 1266 snarkmarks Registered: May 2nd 2005 Occupation: Architect Location: Austin, Texas, USA
By "time up" I mean using FacePoser to create .vcd files (not .vdc like I have posted in my last comment :roll: ) to create trigger markers that "time up" with the end of each song. So instead of finding out how long a song is and delaying the next start of a new song the same length as the first, you simply place a trigger marker along a timeline in a GUI in FacePoser:

[IMG]http://i158.photobucket.com/albums/t103/Riven_bucket/faceposer1.jpg[/IMG]

The only advantage to using Faceposer and creating .vcd files for your songs is that it would allow you to use them over and over again without having to add delay outputs. So, it makes it easier to work with if you will be using them over and over again. -It's better to do in the bigger picture. AND the most important reason is, you can pause sounds being played over a .vcd file. soundscapes and ambient_generics do not pause when a player hits the pause key or Esc. -This is for single player only of course...

The way you have it now, creating a .vcd file will give you the same effect as using delay outputs. -That's why I wouldn't bother with it now.
Blog: www.playingarchitecture.net
LinkedIn: Eric Lancon
Twitter:@Riven202