Page 1 of 1

Sound works for Allied Assault, but not for Spearhead

Posted: Wed Dec 17, 2008 12:53 pm
by Captain Den
Hi together!
A little time ago i created a few sound speakers for a river in one of my maps. Like the topic says, in Allied Assault it works perfectly, but not in Spearhead. I still realized that there is a difference between AA and SH in playing ambient sounds (I remember the little radio in "algiers" or the sound of the river in "the bridge", which sounds i don't hear in Spearhead)
So is there a way to get sound speakers working in Spearhead?

Would be nice if one of the professionals could help me ;)
Best regardz, Captain Den

At last my configurations for this sounds:

in mohradiant

Code: Select all

classname: script model
model: fx/dummy.tik
origin: 204.15 36.16 52.23
targetname: river1
testanim: idle
in global/dmprecache.scr

Code: Select all

cache models/sound/mysounds.tik
in global/mysounds.scr

Code: Select all

main: 

while(1)
	{
		$soundtrigger triggerable
		$soundtrigger waittill trigger
		
		$river1 loopsound riversound
		
		$soundtrigger nottriggerable
		wait 1 
	}
End
in models/sound/mysounds.tik

Code: Select all

		aliascache riversound sound/mymap/Amb_BasementWater.wav soundparms 0.1 0.0 1.00 0.00 500 1500 item loaded maps "m moh dm obj train"
and in maps/dm/mysounds.scr

Code: Select all

main: 
level waittill spawn
	exec global/DMprecache.scr
	exec global/mysounds.scr

level.script="maps/dm/mysounds.scr"	
	exec global/ambient.scr riversound
[/code]

Posted: Wed Dec 17, 2008 2:25 pm
by $oldier Of Ra
Something simple is spread over quite a few files :? I would keep it simple :wink: . Use scriptmaster in SH, it works when you do it like this (believe it or not):

Code: Select all

// Your mapscript
main:

// ... blah

level waittill prespawn

// ... blah

level waittill spawn

// ... blah

// scriptmaster works in spearhead if threaded after waittill spawn in another thread
// god knows why
waitthread cache_sounds

// You can continue to use the mysound thread for as many sounds as you like!
// It spawns a hidden notsolid dummy at the place you  want your sound and then loops it!
// Use (where X Y Z is your origin coords): 
// thread mysound ( X Y Z ) my_sound_alias
thread mysound (204.15 36.16 52.23) riversound
end 

cache_sounds:

local.master = spawn ScriptMaster
local.master aliascache riversound sound/mymap/Amb_BasementWater.wav soundparms 0.1 0.0 1.00 0.00 500 1500 item loaded maps "m moh dm obj train"

end

mysound local.origin local.sound:

local.sound = spawn script_model model "fx/dummy.tik"
local.sound.origin = local.origin
local.sound loopsound local.sound
local.sound notsolid

end
Good luck! :)

Posted: Wed Dec 17, 2008 4:46 pm
by Herr Klugscheisser
Did the devs forget to add them to the global/ambience file like they did for BT? If so add the AA map lines to your SH file and make sure the sounds are cached. I had forgotten there were waves crashing on Omaha or the radio in Algiers.

Posted: Wed Dec 17, 2008 5:11 pm
by $oldier Of Ra
No the ambience sounds only work server-side for some reason, I still haven't figured out how they did it. If you cache the ambience sounds with scriptmaster clientside with another alias (sounds unlogical but it's true) then they work in LAN.

Mission accomplished

Posted: Thu Dec 18, 2008 9:30 am
by Captain Den
Ok, fellows, i got it working now! At first, thank you for your help!
Yesterday I looked around in Spearhead-Maps searching some sounds, finding heaven on earth in mp_druckkamern_dm. There's a generator sound in the middle of the u-boat. I changed it so, that Spearhead is able to play my own sounds. ;)

mainta/maps/dm/testmap.scr:

Code: Select all

main:
    level.script="maps/dm/testmap.scr"
    level.music="testmap"


    setcvar "g_scoreboardpic" "testmap" 

    exec global/ambient.scr
	

// set scoreboard messages
    setcvar "g_obj_alliedtext1" "testmap"
    setcvar "g_obj_alliedtext2" ""
    setcvar "g_obj_alliedtext3" ""
    setcvar "g_obj_axistext1" ""
    setcvar "g_obj_axistext2" ""
    setcvar "g_obj_axistext3" ""   
   
    //////////////////////////
    level waittill prespawn
    //////////////////////////


    local.master=spawn ScriptMaster

    //////////////////////////
    level waittill spawn
    //////////////////////////

local.master aliascache my_sound sound/whatever/test.mp3 soundparms 25.0 0.0 1.0 0.0 200 600 item loaded maps "dm obj "
    //////////////////////////
    level waittill roundstart
    //////////////////////////	


    thread start_my_sound

    end

//----------------------------------------------------------
//Play the sound
//----------------------------------------------------------
start_my_sound:	
  $my_speaker loopsound my_sound
 
end
However, I don't know, why the scriptmaster has to be between "waittill prespawn" and "waittill spawn" and the aliascache entry between "waittill spawn" and "waittill roundstart" I just figured it out while testing it a couple of times.


mainta/music/testmap.mus:

Code: Select all

path sound/amb_stereo

normal Amb_M1_TownExt.mp3 // Player Start
aux1 Amb_M1_TownExt.mp3 // Ext 1

!normal volume 1.0
!normal loop
!normal fadetime 1.0

!aux1 volume 1.0
!aux1 loop
The speakers attributes:

Code: Select all

$targetname: my_speaker
classname: sound_speaker
! Don't forget to put the zipped .pk3 into mainta, not main !

The second question is now the distance for the sound to play. I got a house with 3 floors. Is there any way to prevent the sound who is actually in 3rd floor from hearing it in the other 2 floors?

And finally, is there an opportunity to get the original sounds - the algiers-radio for example - working in Spearhead? @Herr Klugscheisser: Which lines of AA do you mean exactly?

Best regardz and happy mapping, Captain Den

Posted: Thu Dec 18, 2008 10:31 am
by $oldier Of Ra
I know why :) but I told you, you have to cache in SH after level waittill spawn.

As an answer for your second question, mess around with these till you get it just like you want it ;)
soundparms parameters are: <BaseVolume> <RandVolume> <BasePitch> <randPitch> <minDist> <maxDist> <Channel> <Loaded/Streamed>

Posted: Thu Dec 18, 2008 4:33 pm
by Herr Klugscheisser
In global/ambience.scr add these lines:

Code: Select all

if(level.script == "maps/dm/mohdm1.scr")
{
thread sound ( -56 -840 16 ) cricket
thread sound ( 582 2551 420 ) cricket
}
if(level.script == "maps/dm/mohdm2.scr")
{
thread sound ( -3452 -2640 64 ) wind_trees3
}
if(level.script == "maps/dm/mohdm3.scr")
{
thread sound ( 2839 -618 -87 ) wind_trees4
}
if(level.script == "maps/dm/mohdm4.scr")
{
thread sound ( 103 1 328 ) river
thread sound ( 11 2681 16 ) basement_water
}
if(level.script == "maps/dm/mohdm5.scr")
{

}
if(level.script == "maps/dm/mohdm6.scr")
{

}
if(level.script == "maps/dm/mohdm7.scr")
{
thread sound ( -1498 -582 -153 ) cricket
thread sound ( -3150 -360 -91 ) fireplace
thread sound ( -3214 1218 264 ) radio_loop
}
if(level.script == "maps/obj/obj_team1.scr") 
{

}
if(level.script == "maps/obj/obj_team2.scr")
{

}
if(level.script == "maps/obj/obj_team4.scr")
{
thread sound ( 103 1 328 ) river
thread sound ( 11 2681 16 ) basement_water
}
if(level.script == "maps/obj/obj_team3.scr")
{
thread sound ( 1148 -5012 -505 ) waves1
thread sound ( 504 -5128 -447 ) waves2
}
Devs forgot them in SH/BT (amongst other things). You might also have to cache the sounds if they didn't do it in SH (I can't check because the computer I'm on doesn't have SH installed).

Posted: Wed Feb 04, 2009 2:27 pm
by Captain Den
Hi guys!
I slowly get into working with sounds ;)
Now i managed to build a bar with a jukebox which can change the played music and a toilet with triggerable toilet flush sounds etc.

I presumed already that the developers forgot something, but yours is the right answer, thank you!

By the way, sorry for the late reply, I'm mostly messing around with my map inserting some features in order to finally finish it.

Greetings, Den