Ok, this is going to be a fun project for you guys I think.
Heres the deal, I need a way to make a Jukebox that will play different tracks depending on what number i press on the keyboard (or by triggers, whichever is easier). The scripting for these music files (2 or 3) im assuming will be quite annoying. But i'm going to ask for help on this one since i'm no good with scripting.
Huge undertaking: Putting a Jukebox in my map
Moderator: Moderators
- StarGeneral
- Sergeant
- Posts: 67
- Joined: Wed Oct 17, 2007 5:21 am
Huge undertaking: Putting a Jukebox in my map
"Si vis pacem, para bellum."
"If you want peace, prepare for war."
"If you want peace, prepare for war."
Make a custom item with firetype clickitem then use trigger_clickitem's for the buttons . An example of such an item is the binoculars . Then use script to play different song depending on what trigger was triggered .
init
{
server
{
setsize "-4 -4 0" "4 4 4"
classname InventoryItem
name "Binoculars"
rank 1 1
// mainattachtotag "eyes bone"
firetype clickitem
semiauto
ammorequired 0 // unlimited usage
usenoammo 1
firedelay 0.75 // delay between uses
bulletrange 8000
crosshair 0
zoom 20 1
}
client
{
}
}
- StarGeneral
- Sergeant
- Posts: 67
- Joined: Wed Oct 17, 2007 5:21 am
you'll have to be very specific about the script I need and the steps because I know absolutely NOTHING about scripting at this point, i'm naturally horrible with it. So far I understand how to set up the trigger and object, but the scripting part makes no sense to me.
"Si vis pacem, para bellum."
"If you want peace, prepare for war."
"If you want peace, prepare for war."
Scripting for this is no different from using a trigger use or multiple each trigger is for a differnent sound . For the trigger give it a setthread key and the name of the thread you create to play the sounds . Perhaps create a .mus file such as in Pak0.pk3 >music>m1l3c.mus
to change a music sound do like in global/ambient.scrpath sound/amb_stereo
normal Amb_M1_Bunker_01.mp3 // Interior 1 - Player Start
aux1 Amb_M1_Cliff_01.mp3 // Exterior 1 - Cliff area between Bunker and Lighthouse
aux2 Amb_M1_Bunker_01.mp3 // Interior 1 - Top and Second Floor Bunker
aux4 Amb_M1_Bunker_02.mp3 // Interior 2 - Bottom Floor Bunker
aux6 Amb_M1_Bunker_03.mp3 // Interior 3 - Lighthouse Bunker
!normal volume 0.8
!normal loop
!aux1 volume 1.5
!aux1 loop
!aux2 volume 0.7
!aux2 loop
!aux4 volume 0.7
!aux4 loop
!aux6 volume 0.7
!aux6 loop
Each trigger you can give a set number and use the same settread value to start the music thread . Self.set will be the set number you give to a trigger click_item and the setthread value will be the thread name . Create a music directory in your pk3 and put the mus file in it , create a directory for the mp3's ( not sure but they may have to be outside of a pk3 if they are mp3's ) . Make the triggers , set those keys , create the thread to play them and set the soundtrack to your mus file probably at the top of your script somewhere just after level waittill spawn .
main local.music:
exec global/savenames.scr // you won't need this
level waittill spawn
if (local.music != NIL)
{
local.string = ("music/" + local.music + ".mus")
soundtrack local.string
println ("playing " + local.string)
forcemusic normal normal
}
....
....
....
if (self.set == 1)
forcemusic aux2 aux2
else
if (self.set == 2)
forcemusic aux4 aux4
else
if (self.set == 3)
forcemusic aux6 aux6
- StarGeneral
- Sergeant
- Posts: 67
- Joined: Wed Oct 17, 2007 5:21 am
Im so terribly confused. Ok, this is what I think i know so far:
I am supposed to create a trigger_use for each sound i intend to play, each sound I intend to play must have its own thread in the .mus file.
Am I right so far?
The next step for me is to find out how I am going to make a .mus file.
I realize the directions you gave me are concise, but i still do not understand them because i am an idiot. So you'll have to treat me like a baby.
I am mixing up the difference between a .mus file and an ambient sound file.
*********
UPDATE:
*********
Ok, tell me if this is right, since im doing juke box, I want all my custom sounds to be interior sounds (except for the one in-game sound i will use for exterior). So I have to make the interior ones "aux" with an even number. Right??
I am supposed to create a trigger_use for each sound i intend to play, each sound I intend to play must have its own thread in the .mus file.
Am I right so far?
The next step for me is to find out how I am going to make a .mus file.
I realize the directions you gave me are concise, but i still do not understand them because i am an idiot. So you'll have to treat me like a baby.
I am mixing up the difference between a .mus file and an ambient sound file.
*********
UPDATE:
*********
Ok, tell me if this is right, since im doing juke box, I want all my custom sounds to be interior sounds (except for the one in-game sound i will use for exterior). So I have to make the interior ones "aux" with an even number. Right??
"Si vis pacem, para bellum."
"If you want peace, prepare for war."
"If you want peace, prepare for war."
If you are making a multiplayer map then forget about the interior or exterior stuff . In single player maps there is a system where you can create triggers that can be put in doorways that will change the ambient sound that script is the global/ambient.scr you don't need to use that script . That won't work for a multiplayer map since the sound changes for all the players . Let me go over some points for you .StarGeneral wrote:Im so terribly confused. Ok, this is what I think i know so far:
I am supposed to create a trigger_use for each sound i intend to play
No you are suppose to create a trigger_clickitem but any trigger type will work
, each sound I intend to play must have its own thread in the .mus file.
No a mus file lists alias to music
normal Amb_M1_Bunker_01.mp3
aux1 Amb_M1_Cliff_01.mp3
aux2 Amb_M1_Bunker_01.mp3
aux4 Amb_M1_Bunker_02.mp3
aux6 Amb_M1_Bunker_03.mp3
Am I right so far?
The next step for me is to find out how I am going to make a .mus file.
I realize the directions you gave me are concise, but i still do not understand them because i am an idiot. So you'll have to treat me like a baby.
I am mixing up the difference between a .mus file and an ambient sound file.
*********
UPDATE:
*********
Ok, tell me if this is right, since im doing juke box, I want all my custom sounds to be interior sounds (except for the one in-game sound i will use for exterior). So I have to make the interior ones "aux" with an even number. Right??
1. soundtrack command
The soundtrack command sets what .mus file to use example
2. forcemusic commandmain:
soundtrack "music/MYmusic.mus"
forcemusic normal normal
end
changes the music being played , uses a alias from the .mus file normal , aux1 or aux2 for example
3. path
first line of a .mus that sets the path to look for the music example for the path sound/amb_stereo you will find the sound Amb_M1_Bunker_01.mp3
sound/amb_stereo /Amb_M1_Bunker_01.mp3 would be the full path in main directory .
You script might look like this if you created triggers of some kind and set the setthread key of the trigger to my_music_thread and gave each trigger a different set key .
main:
soundtrack "music/MYmusic.mus"
forcemusic normal normal
end
my_music_thread:
switch (self.set)
{
case 1:
forcemusic normal normal
break
case 2:
forcemusic aux1 aux1
break
case 3:
forcemusic aux2 aux2
break
case 4:
forcemusic aux3 aux3
break
}
end

The thing about trigger_use is that you can't put a bunch of them close together and be able to control what one fires . That is why I recommend that you use a trigger clickitem and mod the binoculars.tik to make a custom item to trigger them . Binoculars don't show so you could use them only they have the black area that shows and they zoom too much .


