Triggering an mp3?

If you're looking for mapping help or you reckon you're a mapping guru, post your questions / solutions here

Moderator: Moderators

Gally
Lance Corporal
Posts: 20
Joined: Mon Aug 05, 2002 1:54 pm
Contact:

Triggering an mp3?

Post by Gally »

How do you use a trigger_multiple to trigger an mp3 or wav?

Please help me fast, this is the last thing I need before I compile my map!
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

.mus file

Post by tltrude »

You are going to have to make a music file for your map. Those files are in the main/music folder and end with a .mus extention. The mp3's are in main/sound/music.

The way it works is you would make your background sound "normal" and the music would be aux1, aux2, or whatever--in the mus file. Then your trigger would trip a thread in the script that says, "forcemusic aux1 aux1" or whatever aux you made it. You will also have to change the line that tells the ambient script which mus file to use.

exec global/ambient.scr mymapname

Hope that helps.
Tom Trude,

Image
Gally
Lance Corporal
Posts: 20
Joined: Mon Aug 05, 2002 1:54 pm
Contact:

Post by Gally »

I kind of get what you mean, and the outcome, its just I got confused while doing it...



Could you do it step by step for my stupid ass?

Thanks for responding.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

first

Post by tltrude »

The first thing you should do it "unzip" a copy of pak0.pk3--where all the files I talked about are. You will have to turn off "automattic install screensavers" in Winzip options, and rename pak0.pk3 to pak0.zip to do it.

Then study the .mus files in the music folder. I'm sure you'll figure it out from there.
Tom Trude,

Image
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

OR:

make a setthread in ur trigger, let's say "sound". In ur script:

sound:
$triggername playsound alias // use it as a trigger or any object
end

OR

sound:
$triggername playsound "sound/xxx/xxx/xx.mp3"
end

If u wanna loop the sound, replace "loopsound" with "playsound".
Live to map, not map to live.
-mohaa_rox, .map
moderator
Gally
Lance Corporal
Posts: 20
Joined: Mon Aug 05, 2002 1:54 pm
Contact:

Post by Gally »

Im trying the second thing you said rox...I did what you said but it doesnt play the sound...in the console it says the alias needs and ubersound or uberdialog thing...


What do I do now?
Gally
Lance Corporal
Posts: 20
Joined: Mon Aug 05, 2002 1:54 pm
Contact:

Post by Gally »

bump ^^^^^^
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

Use the second method, or read the ubersound workaround. Very useful. I suggest u make a tiki, don't edit ubersound.scr.

Or as i said, use the second method, something like playing the background music.
Live to map, not map to live.
-mohaa_rox, .map
moderator
Gally
Lance Corporal
Posts: 20
Joined: Mon Aug 05, 2002 1:54 pm
Contact:

Post by Gally »

I believe I forgot to let you in on something...this is a wav sound on my computer...meaning a custom sound that doesnt have a cache in the uber/sound/dialog.scr's...

Is it possible to do this with custom sounds on your computer?
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

Step 1:
Put ur mp3 into a folder pk3, let's say, "main\sound\music\mysound".

Step 2:
Make an alias cache WITH A TIKI! Don't use ubersound.scr.

OR:

Do something like:

$thingy playsound "sound\music\mysound\xxx.mp3"
Live to map, not map to live.
-mohaa_rox, .map
moderator
Gally
Lance Corporal
Posts: 20
Joined: Mon Aug 05, 2002 1:54 pm
Contact:

Post by Gally »

Ill try that...im not sure im linking everything right though.
Gally
Lance Corporal
Posts: 20
Joined: Mon Aug 05, 2002 1:54 pm
Contact:

Post by Gally »

Its still not working man...could you do it step by step...this is the last thing I need to do before I compile and release...

:(
panTera
Brigadier General
Posts: 573
Joined: Wed Jan 29, 2003 11:46 pm
Location: The Netherlands
Contact:

Post by panTera »

Okay, step by step, as far as I know it :wink: .

1) Place a "script_model" anywhere in your map where you want to hear the sound from and give it:
key: model
value: fx/dummy.tik
&
key: targetname
value: speaker1 (example)

2) Set up your trigger_multiple or _use:
key: targetname
value: soundtrigger (example)
&
key: setthread
value: sound (example)
(& optional
key/value: wait/ number of seconds between triggerings)

3) In the script put this:
sound:
$soundtrigger waittill trigger
$speaker1 playsound gallywantssound (this would be an alias)

4) If you want to use custom sounds then try to create a tiki file useing notepad or any other text editor save it as mysounds.tik or whatever and put it in 'main/models/sound/yourdir/..'

The tiki should look something like this:
//////////////////////////////////////////////////////////

TIKI

setup
{
path models/fx/dummy
skelmodel dummy3.skd
}
init
{
server
{
classname ScriptModel
rendereffects +dontdraw
notsolid
}
client
{
settiki none
aliascache gallywantssound sound/music/yoursound.wav soundparms 1.5 0.0 1.0 0.0 300 3000 auto loaded maps "t m dm moh obj train yourbspname"
aliascache morealiases? ... put them here
}
}
animations
{
idle dummy3.skc
}

//////////////////////////////////////////////////////////


As an example replace gallywantssound with your alias, the sound/music/.. is the location of the sound in this case the music directory but you can also use your own.

5) In the _precache script for your map add the lines..:
'cache models/fx/dummy.tik'
'cache models/sound/yourdir/mysounds.tik'

.. to load your aliases and don't forget to add your sounds to your .pk3 if you send your map to friends. (note: mp3's cannot be loaded from within a .pk3 and must be included seperately in the .zip)
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Explain better

Post by tltrude »

Gally - You need to explain better what you are trying to do. If you are vague, you're going to get every sound scheme in the book--as you can see from all the examples above.
Tom Trude,

Image
Gally
Lance Corporal
Posts: 20
Joined: Mon Aug 05, 2002 1:54 pm
Contact:

Post by Gally »

Halleujah!

*bows down to pantera*

Thanks all for helping. Panteras tut works great.
Image
Image
Post Reply