If anyone is interested, this is how I did it, just remember it was quick and probably very dirty code.
Step 1: Edit the ?unnamedsoldier.cfg? and add the following:
Code: Select all
bind F7 "ik_mp3_on"
bind F8 "ik_mp3_off"
bind KP_INS "ik_mp3_0"
bind KP_END "ik_mp3_1"
bind KP_DOWNARROW "ik_mp3_2"
bind KP_PGDN "ik_mp3_3"
bind KP_LEFTARROW "ik_mp3_4"
bind KP_5 "ik_mp3_5"
bind KP_RIGHTARROW "ik_mp3_6"
bind KP_HOME "ik_mp3_7"
bind KP_UPARROW "ik_mp3_8"
bind KP_PGUP "ik_mp3_9"
alias ik_mp3_on "set ik_mp3on 1"
alias ik_mp3_off "set ik_mp3on 0"
alias ik_mp3_9 "set ik_mp3 9"
alias ik_mp3_8 "set ik_mp3 8"
alias ik_mp3_7 "set ik_mp3 7"
alias ik_mp3_6 "set ik_mp3 6"
alias ik_mp3_5 "set ik_mp3 5"
alias ik_mp3_4 "set ik_mp3 4"
alias ik_mp3_3 "set ik_mp3 3"
alias ik_mp3_2 "set ik_mp3 2"
alias ik_mp3_1 "set ik_mp3 1"
alias ik_mp3_0 "set ik_mp3 0"Step 2: Make a folder in ?\main? called ?mp3s? and add the mp3 files you want to hear. Make sure that they do not have spaces in their names.
Step 3: Create a ?yourmapname.mp3s? file and add the names of the mp3 files. Then put it in the ?\main\mp3s? folder. The following is an example.
Code: Select all
// snow.mp3s
level.mp30 = none
level.mp31 = "Peter_Gabrial_-_Steam.mp3"
level.mp32 = "Glen_Miller_-_In_the_Mood.mp3"
level.mp33 = "Artie_Shaw_-_American_Patrol.mp3"
level.mp34 = "Peter_Gabrial_-_Shock_The_Monkey_(Extended_Version).mp3"
level.mp35 = "Peter_Gabrial_-_Sledgehammer.mp3"
level.mp36 = "Queen_-_Another_One_Bites_The_Dust.mp3"
level.mp37 = none
level.mp38 = none
level.mp39 = noneStep 4: Copy ?jukebox.scr? to the ?main\mp3s? folder. A copy of ?jukebox.scr? is below:
Code: Select all
//
// jukebox.scr
//
// SCRIPTING: Innkeeper w/lots of coffee
main local.mp3s:
if(level.jukebox_run == 1)
{
end
}
println "DEBUG =====> Loading jukebox.scr"
level waittill spawn
if(local.mp3s != NIL)
{
if(level.mp3s == NIL)
{
level.mp3s = local.mp3s
}
}
if(level.mp3s != NIL)
{
local.string = ("mp3s/" + level.mp3s + ".mp3s")
exec local.string
println ("DEBUG =====> using mp3 list file => " + local.string)
forcemusic none none
}
thread jukebox
level.jukebox_run = 1
end
jukebox:
local.music = ("none")
local.lastmp3 = getcvar(ik_mp3)
local.newmp3 = getcvar(ik_mp3)
setcvar ik_mp3on 1
setcvar ik_mp3 1
while(1)
{
if(getcvar(ik_mp3on)&& $player != NULL)
{
local.newmp3 = getcvar(ik_mp3)
if(local.newmp3 != local.lastmp3)
{
switch(local.newmp3)
{
case 1: local.music = level.mp31
break
case 2: local.music = level.mp32
break
case 3: local.music = level.mp33
break
case 4: local.music = level.mp34
break
case 5: local.music = level.mp35
break
case 6: local.music = level.mp36
break
case 7: local.music = level.mp37
break
case 8: local.music = level.mp38
break
case 9: local.music = level.mp39
break
case 0: local.music = level.mp30
break
local.music = ("none")
}
if(local.music != "none")
{
local.string = ("tmstart mp3s/" + local.music)
println ("music is " + local.string)
$player stufftext "tmstop"
wait 0.5
$player stufftext ("tmstart mp3s/" + local.music)
}
else
{
println ("music is none")
}
local.lastmp3 = local.newmp3
}
}
else
{
$player stufftext "tmstop"
}
wait 0.5
}
endThat?s it. Music is on by default playing level.mp31, F8 turns it off and F7 turns it on. Pressing a number 0 through 9 selects the music from the ?yourmapname.mp3s? file, level.mp30 being for the number ?0? level.mp31 for number ?1?, and so on. If the song is ?none?, the music will not change from the currently playing song.
This was just for fun. If anyone finds a really good use for it I would like to hear about it.


