Page 1 of 1

Triggers playsound: Is this script right?

Posted: Wed Jun 09, 2004 11:22 pm
by Master-Of-Fungus-Foo-D

Code: Select all

main:

level waitTill prespawn

local.master = spawn ScriptMaster

local.master aliascache Amb_M3_BattleInt_01/amb.wav soundparms 1.0 0.2 1.0 0.2 200 2000 auto loaded maps "obj dm"
local.master aliascache Amb_M3_HedgeImpacts_01/amb.wav soundparms 1.0 0.2 1.0 0.2 200 2000 auto loaded maps "obj dm"
local.master aliascache mus_aircraftfacility/music.wav soundparms 1.0 0.2 1.0 0.2 200 2000 auto loaded maps "obj dm"
local.master aliascache Explo_Hallway1/amb.wav soundparms 1.0 0.2 1.0 0.2 200 2000 auto loaded maps "obj dm"

	level.script = maps/dm/explodingdoor.scr
	exec global/ambient.scr sound/amb/Amb_M3_BattleInt_01.wav
	exec global/exploder.scr
	exec global/door_locked.scr::lock
	exec global/earthquake.scr
   exec global/ubersound.scr
   exec global/uberdialog.scr

level waitTill spawn

$trigger1 playsound Amb_M3_BattleInt_01
$trigger2 playsound Amb_M3_HedgeImpacts_01
$trigger3 playsound mus_aircraftfacility
$trigger4 playsound Explo_Hallway1
end
is it right? because ive benn editting this thing for hours and havent gotten my triiger_use to play my sounds!! i mean i cant figure it out.

Posted: Wed Jun 09, 2004 11:37 pm
by Bjarne BZR
Well, it depends: If you want your trigger to play the sound once exactly when the first player spawns in the map: it looks correct... they will play all at once and one sound each placed at each of the triggers, then they will all stop playing... chances are you will never hear them unless you are very fast, or spawn next to them.

I dont think thats what you are aiming for, so: what ARE you aiming for?

Posted: Thu Jun 10, 2004 12:00 am
by tltrude
You must have the correct path to the sound file and you must supply an alias name.

local.master aliascache my_snd sound/amb/Amb_M3_HedgeImpacts_01.wav soundparms 0.8 0.5 0.8 0.4 160 800 auto streamed maps "m moh dm obj train"

With the above alias, when you ask for "my_snd" to play, it will play "Amb_M3_HedgeImpacts_01.wav".

sound_2:

$trigger2 waittill trigger
$trigger2 playsound my_snd
wait 5
goto sound_2 // resets the trigger

end

BTW, if the sound you want works in multiplayer already, you don't need the local.master workaround to use it--just use the alias name in the ubersound.scr script (pak0).

Posted: Thu Jun 10, 2004 10:37 am
by Master-Of-Fungus-Foo-D
UMmm...it didnt work....
i made these changes to the script.

Code: Select all

main:

level waitTill prespawn

local.master = spawn ScriptMaster

local.master aliascachlocal.master aliascache my_snd1 sound/amb/Amb_M3_HedgeImpacts_01.wav soundparms 0.8 0.5 0.8 0.4 160 800 auto streamed maps "m moh dm obj train"
local.master aliascachlocal.master aliascache my_snd2 sound/amb/Amb_M3_BattleInt_01.wav soundparms 0.8 0.5 0.8 0.4 160 800 auto streamed maps "m moh dm obj train"
local.master aliascachlocal.master aliascache my_snd3 sound/music/aircraftfacility.mus soundparms 0.8 0.5 0.8 0.4 160 800 auto streamed maps "m moh dm obj train"
local.master aliascachlocal.master aliascache my_snd4 sound/amb/Amb_M3_HedgeImpacts_01.wav soundparms 0.8 0.5 0.8 0.4 160 800 auto streamed maps "m moh dm obj train"

	level.script = maps/dm/soundz.scr
	exec global/ambient.scr mohdm/obj/obj3

level waitTill spawn

sound_1:

$trigger1 waittill trigger
$trigger1 playsound my_snd
wait 5
goto sound_1

sound_2: 

$trigger2 waittill trigger 
$trigger2 playsound my_snd1 
wait 5 
goto sound_2 // resets the trigger

sound_3: 

$trigger3 waittill trigger 
$trigger3 playsound my_snd2 
wait 5 
goto sound_3 // resets the trigger

sound_4: 

$trigger4 waittill trigger 
$trigger4 playsound my_snd3 
wait 5 
goto sound_4 // resets the trigger

end
and here is the maps so u can test =
http://bb.1asphost.com/ilikefungus/soundz.bsp
http://bb.1asphost.com/ilikefungus/soundz.map
http://bb.1asphost.com/ilikefungus/soundz.min
http://bb.1asphost.com/ilikefungus/soundz.scr

Posted: Thu Jun 10, 2004 11:11 am
by Master-Of-Fungus-Foo-D
Bjarne BZR wrote:so: what ARE you aiming for?
well im trying to get 4 trigger use(s) to play a sound, 1 each. but so far it doest work.

Posted: Thu Jun 10, 2004 1:20 pm
by jv_map
Make a script_model with model fx/dummy.tik play the sound instead :wink:

Posted: Thu Jun 10, 2004 4:32 pm
by Master-Of-Fungus-Foo-D
ok if i do that should i make the trigger trigger the script model?

Posted: Thu Jun 10, 2004 4:34 pm
by jv_map
Well not exactly.. you could do it like this:

$trigger1 waittill trigger
$soundent1 playsound my_snd

Where the script_model has targetname soundent1.

Also with your current script only sound_1: will be 'called'.

Posted: Thu Jun 10, 2004 6:19 pm
by Master-Of-Fungus-Foo-D
ok ill try that.. i hope it works

oh and i kinda thought that sound 1 was going to be called, i just didn't change it.

Posted: Thu Jun 10, 2004 6:31 pm
by diego
This is how I have been doing it:

I use the fx/dummy.tik as my speaker as suggested above.
I give it a key/value of $targetname / speaker_1 (whatever name u want)

I add a trigger_use brush.
I give it a key/value of setthread / soundthread (whatever name u want)
I give it a key/value of $targetname / soundtrigger (whatever name u want)

In my scripts:
If it is a custom sound, you have to use the correct ubersound alias like suggested above.

Then I set up my script thread:

Code: Select all

soundthread:
$soundtrigger nottriggerable
$speaker_1 playsound mysound
wait 5 //or however long your sound file duration is.
$soundtrigger triggerable
end
This is probably the NooB way of doing it, but it works for me.

Posted: Fri Jun 11, 2004 8:22 am
by bdbodger
was the double local.master aliascachlocal.master aliascache in one of the above posts a typo or is that the way you had it
local.master aliascachlocal.master aliascache my_snd1 sound/amb/Amb_M3_HedgeImpacts_01.wav soundparms 0.8 0.5 0.8 0.4 160 800 auto streamed maps "m moh dm obj train"

yes

Posted: Fri Jun 11, 2004 3:03 pm
by tltrude
Yeah, take out "aliascachlocal.master" from all the lines and it should work. Any entity with a targetname, can play a sound, even the triggers themselves.

Posted: Fri Jun 11, 2004 5:10 pm
by Master-Of-Fungus-Foo-D
I find scripting a little hard to follow... but i am getting closer, thanks for your help so far
:D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D

Posted: Fri Jun 11, 2004 5:19 pm
by Master-Of-Fungus-Foo-D
Heyyyyyy! That worked Bd!! Im so thankful, it works! " Yayyyyy" i scream as i run off mainiaclly into the distance.