Page 1 of 2

Help with adding custombackground music

Posted: Sat Mar 19, 2005 1:42 pm
by SniperWolf
I was wondering if someone could help me with adding custom background to my custom map. It is a Ceremonial type map for my clans Award Cermonies. I have read jv_maps tuts and still it does not work. I can post my .mus & script files if need be. It is the only thing stopping me from unveiling my map. Any help would be greatly appreciated. Thanks in advance for the help :D


[9th??]1stLt.?niperWolf

Posted: Sat Mar 19, 2005 2:07 pm
by Master-Of-Fungus-Foo-D
music or just wind and trees?

for wind and trees try this in yuor script after level waittill spawn

Code: Select all

exec global/ambient.scr mohdm2

Posted: Sat Mar 19, 2005 4:35 pm
by SniperWolf
Not wind & tree noise, actual music. I have the .mp3 already named what I want etc as per jv_maps Tut, but just cant get it to work.

I also have scripted in take weapons & when I added the script for music , the take weapons stopped working. Like I said, if need be I will post my scripts to be looked at.


?niperWolf

Posted: Sat Mar 19, 2005 4:41 pm
by Master-Of-Fungus-Foo-D
look at the SP maps scripts to see how they started music :wink:

Posted: Sat Mar 19, 2005 5:30 pm
by Green Beret
ok,make a folder named music in main....main/maps/music
then open notepad and add the following

path sound/amb_stereo

normal your_music.mp3//<--change this to your .mp3 name

!normal volume 1
!normal loop

//Music Recommendation
//mus_09a_action.mp3

//Just in case we can get multiple ambiences working...
//normal Amb_M5_BridgeInt.mp3 // Player Start
//!normal volume 1
//!normal loop

and save it as music.mus
(make sure it says all files in the notepad drop down options)
add that file to the music folder you made.
then add a folder named sound and inside the main folder.
make a folder named amb_stero inside of the sound folder.
place your .mp3 in the amb_stereo folder.
now in your .scr for your map add this line
exec global/ambient.scr music//name of music.mus file
after level waittill prespawn
hope this helps :wink:

Re: Help with adding custombackground music

Posted: Sat Mar 19, 2005 10:47 pm
by Grassy
[9th??]?niperWolf wrote: I can post my .mus & script files if need be. [9th??]1stLt.?niperWolf
Hehe, sorry for laughing. I had the same problem with a map I was converting from BT to SH, I firstly added all the normal things for ambient music and it wouldn't work. Double checked everything, mus , sound file, paths etc etc, still no joy.

To get an ambient sound in this map I ended up spawning a script_model in the centre of the map up off the ground a fair bit, gave it a targetname $amb_speaker and used this to play the required sound from the scr.

To do it this way you will have to make an alias for it with big soundparms, here is the alias I made for my problem.
aliascache fake_amb sound/amb_stereo/Amb_M1L3_1_ByWater.mp3 soundparms 2.5 0.0 1.0 0.0 10000 10000 auto loaded maps "dm obj "
And in your scr just have;
$amb_speaker loopsound fake_amb
Actually doing it this way means you can have specific ambient sounds at specific points around your map, like crickets, wind in the trees, music etc etc, just be carefull if you are doing this for SH, dont have too many large looping sounds in the one map or you will find it will crash a lot. SH dosn't have a lot of room for extra aliases and custom sounds.

Grassy

Posted: Mon Mar 21, 2005 11:49 am
by SniperWolf
Grassy,

where would I put my .mp3 for your script? I tried Green Beret's idea & that didnt work :( I'm not sure where this line goes in my scr

aliascache fake_amb sound/amb_stereo/Amb_M1L3_1_ByWater.mp3 soundparms 2.5 0.0 1.0 0.0 10000 10000 auto loaded maps "dm obj "

or this 1 either

$amb_speaker loopsound fake_amb

Thanks for the help, just wish I could get it to work, its the last thing I need to do to finish my map.

?niperWolf

Posted: Mon Mar 21, 2005 12:45 pm
by Green Beret
$amb_speaker is a targetname of a script_model.
give it a model of fx/dummy.tik
then place it on the map were u want the sound to be heard from(middle?)
NOTE:the .scr must be in the maps/dm or obj folder(for MP maps)
now after main: place the aliascache fake_amb sound/amb_stereo/Amb_M1L3_1_ByWater.mp3 soundparms 2.5 0.0 1.0 0.0 10000 10000 auto loaded maps "dm obj "

then this line level waittill prespawn

$amb_speaker loopsound fake_amb

//rest of code

that should of worked what i posted,but when i first started it took me a couple wacks at things before i got them to work :wink:
dont worry youll get the hang of it.

Posted: Mon Mar 21, 2005 7:41 pm
by Grassy
Erm the aliascache line goes in your custom ubersound file. (NOT the maps scr script) And call it mapname_ubersound.scr.

The .mp3 goes in music directory

To spawn your speaker:
Add this routine below after the end of your main thread.

Code: Select all

speaker local.loc:
  local.ent = spawn script_model model "fx/dummy.tik" 
  local.ent.origin =  local.loc
  local.ent notsolid
  local.ent rendereffects "+dontdraw"
  local.ent targetname ambspeaker
end
and add this below level waittill spawn

Code: Select all

thread speaker (0.00 0.00 0.00) 
//change the zeros to match the origin you want it at
//now we tell the new entity to loop your sound
$ambspeaker loopsound fakeamb

Posted: Tue Mar 22, 2005 6:27 pm
by SniperWolf
Grassy,

Tried what you said...didnt work :( Do I still need to got into my .map & add the script_model? The game started to load the map then crashed to my desktop. On the console it stop right when it started to load my map.scr. Does it matter where in the ubersound.scr I put that line? Here is the part of mymap.scr to see if it is right, like I said I have take weapons scripted in there to.:

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "CONGRATULATIONS"
setcvar "g_obj_alliedtext2" " SOLDIER!!!"
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "KEEP UP THE"
setcvar "g_obj_axistext2" "GREAT WORK!"
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "none"

speaker local.loc:
local.ent = spawn script_model model "fx/dummy.tik"
local.ent.origin = local.loc
local.ent notsolid
local.ent rendereffects "+dontdraw"
local.ent targetname ambspeaker
end

level waitTill prespawn

//*** Precache Dm Stuff
exec global/DMprecache.scr

level.script = maps/dm/cermonymap.scr
exec global/ambient.scr music

level waittill spawn
thread speaker ( -5492 -6010 2400)
//change the zeros to match the origin you want it at
//now we tell the new entity to loop your sound
$ambspeaker loopsound fakeamb

weapons:
while (1)
{
$player take models/weapons/kar98sniper.tik // axis sniper rifle

$player take models/weapons/kar98.tik // axis rifle

$player take models/weapons/p38.tik // axis pistol

$player take models/weapons/mp40.tik // axis sub-machine gun

$player take models/weapons/mp44.tik // axis machine gun

$player take models/weapons/steilhandgranate.tik // axis nade

$player take models/weapons/panzerschreck.tik // axis rocket launcher

$player take models/weapons/springfield.tik // allied sniper rifle

$player take models/weapons/bar.tik // allied rifle

$player take models/weapons/colt45.tik // allied pistol

$player take models/weapons/thompsonsmg.tik // allied sub-machine gun

$player take models/weapons/m1_garand.tik // allied machine gun

$player take models/weapons/m2frag_grenade.tik // allied nade

$player take models/weapons/bazooka.tik // allied rocket launcher

$player take models/weapons/shotgun.tik // shotgun

$player take models/weapons/enfield.tik // british rifle

$player take models/weapons/Webley_Revolver.tik // british pistol

$player take models/weapons/sten.tik // british sub machine gun

$player take models/weapons/Mills_grenade.tik // british nade

$player take models/weapons/svt_rifle.tik // russian sniper rifle

$player take models/weapons/Mosin_Nagant_Rifle.tik // russian rifle

$player take models/weapons/Nagant_revolver.tik // russian pistol

$player take models/weapons/ppsh_smg.tik // russian sub machine gun

$player take models/weapons/Russian_F1_grenade.tik // russian nade

wait 2

}

end


Is this right, I'm not that great @ scripting. Also does the my.mp3 go into the sound dir on my hard drive or in my map.pk3? And what should I name my.mp3?

Thanks Again for the help......Just wish I could get it to work.

Posted: Tue Mar 22, 2005 9:02 pm
by Green Beret
found a couple of things

Code: Select all

main:
local.master = spawn ScriptMaster
local.master aliascache fake_amb sound/amb_stereo/Amb_M1L3_1_ByWater.mp3 soundparms 2.5 0.0 1.0 0.0 10000 10000 auto loaded maps "dm obj " 

// set scoreboard messages
setcvar "g_obj_alliedtext1" "CONGRATULATIONS"
setcvar "g_obj_alliedtext2" " SOLDIER!!!"
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "KEEP UP THE"
setcvar "g_obj_axistext2" "GREAT WORK!"
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "none"

speaker local.loc:
local.ent = spawn script_model model "fx/dummy.tik"
local.ent.origin = local.loc
local.ent notsolid
local.ent rendereffects "+dontdraw"
local.ent targetname ambspeaker
//end<--take this out,maybe put this code after level waittill spawn

level waitTill prespawn

//*** Precache Dm Stuff
exec global/DMprecache.scr

level.script = maps/dm/cermonymap.scr
exec global/ambient.scr music

level waittill spawn
thread speaker ( -5492 -6010 2400)
//change the zeros to match the origin you want it at
//now we tell the new entity to loop your sound
$ambspeaker loopsound fakeamb
end//<----add this end
weapons:
while (1)
{
$player take models/weapons/kar98sniper.tik // axis sniper rifle

$player take models/weapons/kar98.tik // axis rifle

$player take models/weapons/p38.tik // axis pistol

$player take models/weapons/mp40.tik // axis sub-machine gun

$player take models/weapons/mp44.tik // axis machine gun

$player take models/weapons/steilhandgranate.tik // axis nade

$player take models/weapons/panzerschreck.tik // axis rocket launcher

$player take models/weapons/springfield.tik // allied sniper rifle

$player take models/weapons/bar.tik // allied rifle

$player take models/weapons/colt45.tik // allied pistol

$player take models/weapons/thompsonsmg.tik // allied sub-machine gun

$player take models/weapons/m1_garand.tik // allied machine gun

$player take models/weapons/m2frag_grenade.tik // allied nade

$player take models/weapons/bazooka.tik // allied rocket launcher

$player take models/weapons/shotgun.tik // shotgun

$player take models/weapons/enfield.tik // british rifle

$player take models/weapons/Webley_Revolver.tik // british pistol

$player take models/weapons/sten.tik // british sub machine gun

$player take models/weapons/Mills_grenade.tik // british nade

$player take models/weapons/svt_rifle.tik // russian sniper rifle

$player take models/weapons/Mosin_Nagant_Rifle.tik // russian rifle

$player take models/weapons/Nagant_revolver.tik // russian pistol

$player take models/weapons/ppsh_smg.tik // russian sub machine gun

$player take models/weapons/Russian_F1_grenade.tik // russian nade

wait 2

}

end 
see what that does :wink:

Posted: Wed Mar 23, 2005 5:32 am
by SniperWolf
Green,

Still no luck. Made the changes like you suggested & now it crashes @ the loading ubersound/uberdialoge.scr. Could it be my .mus file? Here is my .mus file:

Code: Select all

path sound/amb_stereo

normal Amb_awards_music.mp3//<--change this to your .mp3 name

!normal volume 1
!normal loop

//Music Recommendation
//mus_09a_action.mp3

//Just in case we can get multiple ambiences working...
//normal Amb_M5_BridgeInt.mp3 // Player Start
//!normal volume 1
//!normal loop 

And where in the ubersound.scr am I supposed to but the alais line

Code: Select all

        aliascache fake_amb sound/amb_stereo/Amb_M1L3_1_ByWater.mp3 soundparms 2.5 0.0 1.0 0.0 10000 10000 auto loaded maps "dm obj " 
    
Is it possible I have that line in the wrong spot?


?niperWolf

Posted: Wed Mar 23, 2005 9:58 am
by Grassy
Oww sorry I havn't got back to you, it looks like your up the creek right about now..

Ok in your pk3 make a dir called "ubersound" and in that dir make a file with just the entry for your sound alias you want to use.
The example I gave above will work ok, just change the filename to match the name of your sound file. Using your .mus entry for eg;

In the directory ubersound you made make a new file called mysounds_ubersound.scr (give it a distintive name, not just ubersound) and in this file place the line below.
aliascache fake_amb sound/amb_stereo/Amb_awards_music.mp3 soundparms 2.5 0.0 1.0 0.0 10000 10000 auto loaded maps "dm obj "

What you are doing is creating a custom alias entry in a standalone ubersound, no need to touch the original ubersound or uberdialog files.
When the server or local server is started SH parses all the pk3's starting with pk3's that use high priority characters, for eg; Z is the highest, then Y, then X etc etc.... This is why in the original SH pk3's there are actually 3 ubersounds but only the latest one in the higher priority pk3 is used becasue they are all named the same, if they were named differently then they would all combine.
This is the reason why we name our pk3's containing cutom mods, maps, scripts etc something like "zz-user_servermods.pk3" for an example. If there are any modified stock map scripts, or your custom map has special aliases in your ubersound they will take effect, the scripts will overide the stock ones so they can be server side mods that clients don't need, and the aliases will be added to the list of aliases that SH has cached.

Also get rid of the line at the top of Green Beret's code example, this will only make SH complain or even crash on you. (Sorry Beret, but SH don't like that method at all)

Here it is re done;

Code: Select all

main: 

// set scoreboard messages 
setcvar "g_obj_alliedtext1" "CONGRATULATIONS" 
setcvar "g_obj_alliedtext2" " SOLDIER!!!" 
setcvar "g_obj_alliedtext3" "" 
setcvar "g_obj_axistext1" "KEEP UP THE" 
setcvar "g_obj_axistext2" "GREAT WORK!" 
setcvar "g_obj_axistext3" "" 

setcvar "g_scoreboardpic" "none" 

level waitTill prespawn 
//*** Precache Dm Stuff 
exec global/DMprecache.scr 
level.script = maps/dm/cermonymap.scr 

//exec global/ambient.scr music  <--this should match the name of your mus file.

level waittill spawn 
thread speaker ( -5492 -6010 2400) 
//change the zeros to match the origin you want it at 
//now we tell the new entity to loop your sound 
$ambspeaker loopsound fakeamb 

end

speaker local.loc: 
local.ent = spawn script_model model "fx/dummy.tik" 
local.ent.origin = local.loc 
local.ent notsolid 
local.ent rendereffects "+dontdraw" 
local.ent targetname ambspeaker 
end 

weapons: 
while (1) 
{ 
$player take models/weapons/kar98sniper.tik // axis sniper rifle 
$player take models/weapons/kar98.tik // axis rifle 
$player take models/weapons/p38.tik // axis pistol 
$player take models/weapons/mp40.tik // axis sub-machine gun 
$player take models/weapons/mp44.tik // axis machine gun 
$player take models/weapons/steilhandgranate.tik // axis nade 
$player take models/weapons/panzerschreck.tik // axis rocket launcher 
$player take models/weapons/springfield.tik // allied sniper rifle 
$player take models/weapons/bar.tik // allied rifle 
$player take models/weapons/colt45.tik // allied pistol 
$player take models/weapons/thompsonsmg.tik // allied sub-machine gun 
$player take models/weapons/m1_garand.tik // allied machine gun 
$player take models/weapons/m2frag_grenade.tik // allied nade 
$player take models/weapons/bazooka.tik // allied rocket launcher 
$player take models/weapons/shotgun.tik // shotgun 
$player take models/weapons/enfield.tik // british rifle 
$player take models/weapons/Webley_Revolver.tik // british pistol 
$player take models/weapons/sten.tik // british sub machine gun 
$player take models/weapons/Mills_grenade.tik // british nade 
$player take models/weapons/svt_rifle.tik // russian sniper rifle 
$player take models/weapons/Mosin_Nagant_Rifle.tik // russian rifle 
$player take models/weapons/Nagant_revolver.tik // russian pistol 
$player take models/weapons/ppsh_smg.tik // russian sub machine gun 
$player take models/weapons/Russian_F1_grenade.tik // russian nade 
wait 2 
} 
end 

Posted: Wed Mar 23, 2005 1:42 pm
by SniperWolf
Grassy I tried your suggestions too, still no music & the take weapons doesnt work, I spawn with no music & weapons? Here is my script again, maybe I keep overlooking something.

Code: Select all

     main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "CONGRATULATIONS" 
setcvar "g_obj_alliedtext2" "       SOLDIER!!!"
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "KEEP UP THE"
setcvar "g_obj_axistext2" "GREAT WORK!"
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "none"

level waitTill prespawn

//*** Precache Dm Stuff
exec global/DMprecache.scr
level.script = maps/dm/cermonymap.scr 

//exec global/ambient.scr ceremonymap  <-- the name of my mus file. 

level waittill spawn
thread speaker ( -5492 -6010 2400)
//change the zeros to match the origin you want it at
//now we tell the new entity to loop your sound
$ambspeaker loopsound fakeamb

end

speaker local.loc:
local.ent = spawn script_model model "fx/dummy.tik"
local.ent.origin = local.loc
local.ent notsolid
local.ent rendereffects "+dontdraw"
local.ent targetname ambspeaker
end 

weapons:
while (1)
{
$player take models/weapons/kar98sniper.tik // axis sniper rifle
$player take models/weapons/kar98.tik // axis rifle
$player take models/weapons/p38.tik // axis pistol
$player take models/weapons/mp40.tik // axis sub-machine gun
$player take models/weapons/mp44.tik // axis machine gun
$player take models/weapons/steilhandgranate.tik // axis nade
$player take models/weapons/panzerschreck.tik // axis rocket launcher
$player take models/weapons/springfield.tik // allied sniper rifle
$player take models/weapons/bar.tik // allied rifle
$player take models/weapons/colt45.tik // allied pistol
$player take models/weapons/thompsonsmg.tik // allied sub-machine gun
$player take models/weapons/m1_garand.tik // allied machine gun
$player take models/weapons/m2frag_grenade.tik // allied nade
$player take models/weapons/bazooka.tik // allied rocket launcher
$player take models/weapons/shotgun.tik // shotgun
$player take models/weapons/enfield.tik // british rifle
$player take models/weapons/Webley_Revolver.tik // british pistol
$player take models/weapons/sten.tik // british sub machine gun
$player take models/weapons/Mills_grenade.tik // british nade
$player take models/weapons/svt_rifle.tik //  russian sniper rifle
$player take models/weapons/Mosin_Nagant_Rifle.tik //  russian rifle
$player take models/weapons/Nagant_revolver.tik //  russian pistol
$player take models/weapons/ppsh_smg.tik //  russian sub machine gun
$player take models/weapons/Russian_F1_grenade.tik //  russian nade
wait 2
}
end
Here is the mus file I'm using:

Code: Select all

path sound/amb_stereo

normal Amb_awards_music.mp3 // Plays over entire level

!normal volume 0.8
!normal loop

//Music Recommendation
//mus_15a_mystery.mp3

//Just in case we can get multiple ambiences working...
//normal Amb_M4_CountryExt_03.mp3 // Player Start
//aux1 Amb_M4_CountryExt_03.mp3 // Exterior - town exterior
//aux2 Amb_M4_CountryInt_04.mp3 // Interior - building interiors
//!normal volume 1
//!normal loop
//!aux1 volume 1
//!aux1 loop
//!aux2 volume .7
//!aux2 loop
And here is the ubersound.scr I made:

Code: Select all

aliascache fake_amb sound/amb_stereo/Amb_awards_music.mp3 soundparms 2.5 0.0 1.0 0.0 10000 10000 auto loaded maps "dm obj " 
I named the .mus file ceremonymap.mus & the ubersound script is named ceremonymap_ubersound.scr. My ubersound file is in a folder named ubersound in my .pk as is my .mus file in a folder named music.

Would it be easier to get the music in my map if I put some speakers in my .map file? If so How would I go about that. I dont know bout you but this is driving me nuking futs :?

Posted: Wed Mar 23, 2005 3:56 pm
by LiquorKraZy
before you go to far...you never changed the coordinates in THREAD SPEAKER part right below waitill level spawn, you just used the coords that Grassy threw in...you should try putting in your own coords where you want the speaker before going to far...i highlighted the section below:
main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "CONGRATULATIONS"
setcvar "g_obj_alliedtext2" " SOLDIER!!!"
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "KEEP UP THE"
setcvar "g_obj_axistext2" "GREAT WORK!"
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "none"

level waitTill prespawn

//*** Precache Dm Stuff
exec global/DMprecache.scr
level.script = maps/dm/cermonymap.scr

//exec global/ambient.scr ceremonymap <-- the name of my mus file.

level waittill spawn
thread speaker ( -5492 -6010 2400)
//change the zeros to match the origin you want it at
//now we tell the new entity to loop your sound
$ambspeaker loopsound fakeamb

end

speaker local.loc:
local.ent = spawn script_model model "fx/dummy.tik"
local.ent.origin = local.loc
local.ent notsolid
local.ent rendereffects "+dontdraw"
local.ent targetname ambspeaker
end

weapons:
while (1)
{
$player take models/weapons/kar98sniper.tik // axis sniper rifle
$player take models/weapons/kar98.tik // axis rifle
$player take models/weapons/p38.tik // axis pistol
$player take models/weapons/mp40.tik // axis sub-machine gun
$player take models/weapons/mp44.tik // axis machine gun
$player take models/weapons/steilhandgranate.tik // axis nade
$player take models/weapons/panzerschreck.tik // axis rocket launcher
$player take models/weapons/springfield.tik // allied sniper rifle
$player take models/weapons/bar.tik // allied rifle
$player take models/weapons/colt45.tik // allied pistol
$player take models/weapons/thompsonsmg.tik // allied sub-machine gun
$player take models/weapons/m1_garand.tik // allied machine gun
$player take models/weapons/m2frag_grenade.tik // allied nade
$player take models/weapons/bazooka.tik // allied rocket launcher
$player take models/weapons/shotgun.tik // shotgun
$player take models/weapons/enfield.tik // british rifle
$player take models/weapons/Webley_Revolver.tik // british pistol
$player take models/weapons/sten.tik // british sub machine gun
$player take models/weapons/Mills_grenade.tik // british nade
$player take models/weapons/svt_rifle.tik // russian sniper rifle
$player take models/weapons/Mosin_Nagant_Rifle.tik // russian rifle
$player take models/weapons/Nagant_revolver.tik // russian pistol
$player take models/weapons/ppsh_smg.tik // russian sub machine gun
$player take models/weapons/Russian_F1_grenade.tik // russian nade
wait 2
}
end