Triggers playsound: Is this script right?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Triggers playsound: Is this script right?

Post 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.
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post 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?
Admin .MAP Forums
Image
Head above heels.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Post 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).
Tom Trude,

Image
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post 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
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post 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.
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Make a script_model with model fx/dummy.tik play the sound instead :wink:
Image
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post by Master-Of-Fungus-Foo-D »

ok if i do that should i make the trigger trigger the script model?
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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'.
Image
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post 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.
Last edited by Master-Of-Fungus-Foo-D on Thu Jun 10, 2004 6:34 pm, edited 1 time in total.
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
User avatar
diego
Captain
Posts: 245
Joined: Sun Dec 21, 2003 10:47 pm

Post 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.
Diego
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post 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"
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

yes

Post 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.
Tom Trude,

Image
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post 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
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post 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.
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
Post Reply