UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

[User Tutorial] Adding a Random Music Player

broken avatar :(
Created 11 years ago
by SajeOne
0 Members and 1 Guest are viewing this topic.
8,704 views
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
Signature

(Click to enter portfolio)
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Hello guys, today I am going to show you how to add a random music player that I have created to your map. This music player is nice because it will always play a variety of songs and you dont have people spamming the same song over and over. Also this music player allows you to add as many songs as you want, There is no limit.

Video Demo: Random Music Player

Step 1) First off you will need to download the files for the music player which can be found at the end of the post.

Step 2) Once you have downloaded the .zip Extract the soundalias file to your "CODRoot\raw\soundaliases". Then extract the GSC file to "CODRoot\mods\*YOURMAPNAME*\maps"

Step 3) Open your "*YOURMAPNAME*.gsc" (ex. nazi_zombie_house.gsc) and find the line:
Code Snippet
Plaintext
maps\_zombiemode::main();
above that line place:
Code Snippet
Plaintext
thread maps\random_song::random_song_think();
Once you have done that it should look like this:
Code Snippet
Plaintext
maps\_zombiemode::main();
thread maps\random_song::random_song_think();
Step 4) Open your maps Zone Source file in "CODRoot\zone_source". it will be called "*YOURMAPNAME*.csv". Now somewhere in that file place:
Code Snippet
Plaintext
sound,random_song_alias,,all_sp
Step 5) Open your Map in CoDWaW Radiant, right click on the 2D grid and go to "Trigger>Use". Open the entity window and give the trigger the KVP of:
Code Snippet
Plaintext
Key:"targetname" Value:"random_song"

This is the trigger that you will be buying the songs from so place it how you want in your map. After you have finished that save and close your radiant.
Step 6) Go into your launcher and make sure that "random_song.gsc" is checked in your IWD list, then check "Build mod.ff Fastfile" and "Build Sounds". Once you have done that hit "Build Mod"


Once the process is done, un-check "Build Sounds" and check "Build IWD File". Then hit build mod again.

Once you have Completed that you can compile your level like normal and when you get in game you should be able to use the music player with its stock songs.

Adding Custom Songs

Adding custom songs is a lot like adding sounds for anything else, with the way i have set this music player up it should be very easy to understand.

Step 1) Find the sound file you want to use, Almost any type will work.

Step 2)Once you find the file, open it with Audacity( If you do not have audacity it can be downloaded for free Here )

Step 3) Once open hit "CTRL + A" and go to "Tracks>Stereo Track to Mono"


Step 4) Go to "File>Export..." and pick a name to save your file as(Just remember it cannot contain spaces). Once you have named your file, save the file type as "Other uncompressed files" and hit the "Options..." button. a window will pop up containing two drop downs, set header to "WAV(Microsoft)" and encoding to "Unsigned 8 bit PCM"


Step 5) Once that is done hit save and a window should prompt you with different tags and values needing your OK to continue, before you do make sure there are no entries in the values section. If there are entries there you can hit "Clear" to delete them. After you do that you can hit ok.


Step 6) Once saved move this file to your "COD5Root\Sound_Assets\Raw\sound"

Step 7) Go to "COD5Root\raw\soundaliases" and open "random_song_alias.csv" with notepad++. There you will already see two lines that look like this:
Code Snippet
Plaintext
mx_lullaby,Stream\Music\Mission\zombie\mx_lullaby.wav,,,0.42,0.42,,,,,,,music,,,0,,,,,,,2d,streamed,,,,,,,,,,music_all,,,,,,0,,,,,,100,100,0.25,1,,
mx_beauty,Stream\Music\Mission\zombie\mx_beauty.wav,,,0.8,0.8,,,,,,,music,,,0,,,,,,,2d,streamed,,,,,,,,,,music_all,,,,,,0,,,,,,100,100,0.25,1,,
mx_the_one,Stream\Music\Mission\zombie\mx_the_one.wav,,,1,1,,,,,,,music,,,0,,,,,,,2d,streamed,,,master,,,,,,,music_all,,,,,,,,,,,,90,90,0.25,1,,
below these lines place this:
Code Snippet
Plaintext
*NAME*,*SOUND_FILE*.wav,,,1,1,,,,,,,music,,,0,,,,,,,2d,streamed,,,master,,,,,,,music_all,,,,,,,,,,,,90,90,0.25,1,,
Now replace "*NAME*" with whatever name you want for your sound, and replace "*SOUND_FILE* with your sound files name. Once you have done that it should look something like this:
Code Snippet
Plaintext
beauty_song,der_riese.wav,,,1,1,,,,,,,music,,,0,,,,,,,2d,streamed,,,master,,,,,,,music_all,,,,,,,,,,,,90,90,0.25,1,,
You can now save and close the file now.

Step 8 ) Now we must add this sound we have created into the music box, Open "random_song.gsc" in "COD5Root\mods\*YOURMAPNAME*\maps"
look for where i have placed:
Code Snippet
Plaintext
////////////////////////////////Sound Files Section////////////////////////////////
In that section you will see:
Code Snippet
Plaintext
song = [];
song[0] = "mx_lullaby"; //Song 1
song[1] = "mx_beauty"; //Song 2
song[2] = "mx_the_one"; //Song 3
all you must do to add another song is copy the latest line and change the number to 1 higher then it is, first will be 0, then 1, then 2, then 3 and on. So for this instance im going to copy:
Code Snippet
Plaintext
song[2] = "mx_the_one";
and change it to this:
Code Snippet
Plaintext
song[3] = "*NAME*";
for my instance i will be changing "*NAME*" to "beauty_song", so yours should look something like this:
Code Snippet
Plaintext
song[3] = "beauty_song";
Next we will be changing the display name, AKA the name that will appear for a player that bought the player. Ex. "Playing: Monty - Horizon"
to do this look for where i placed:
Code Snippet
Plaintext
////////////////////////////////Song Name Section////////////////////////////////
In this section you should see:
Code Snippet
Plaintext
song_string = [];
song_string[0] = "Lullaby For A Dead Man"; //Song 1
song_string[1] = "Beauty Of Annihilation"; //Song 2
song_string[2] = "The One"; //Song 3
for this we will be doing the same thing as the last time, but instead of the value being the sound name, it is now the display name. First im going to copy and paste:
Code Snippet
Plaintext
song_string[2] = "The One"; //Song 3
and change it to:
Code Snippet
Plaintext
song_string[3] = "*DisplayName*"; //Song 4
change "*DisplayName*" to the name of your song, for my example i will be using "Beauty Of Annihilation"
Code Snippet
Plaintext
song_string[3] = "Beauty Of Annihilation"; //Song 4
Two out of three now, Next we need to add in how long the song is in seconds. Find where i placed:
Code Snippet
Plaintext
////////////////////////////////Song Time Section////////////////////////////////
In this section you should see:
Code Snippet
Plaintext
song_time = [];
song_time[0] = 260; //Song 1
song_time[1] = 290; //Song 2
song_time[2] = 300; //Song 3
Same as we did twice before i will copy and paste the latest entry:
Code Snippet
Plaintext
song_time[2] = 300; //Song 3
and change it to:
Code Snippet
Plaintext
song_time[3] = *SONG_TIME*; //Song 4
replace song time with how much time in SECONDS that your song takes up. for my instance my song is 290 seconds long
Code Snippet
Plaintext
song_time[3] = 290; //Song 4
Once you have done that go to your launcher and check "Build mod.ff Fastfile" and "Build Sounds" then hit "Build Mod"

once its done go to "Cod5Root\raw\sounds" and you should see your converted sound file. Copy it and paste it into "COD5Root\mods\*YOURMAPNAME*\sounds" if this directory doesn't exist, create it. Make sure the sound file is checked in your IWD list then Build your mod and Compile Normally. Now when you are in game you will be able to play your song from the music player. Have Fun  :nyan:
Last Edit: March 22, 2014, 03:04:05 pm by SajeOne
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
that's a lot of  opening and closing scripts for a music player. oh well, ill try it out  :)
Last Edit: November 21, 2012, 03:01:34 am by daedra descent
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
that's a lot of  opening and cloding scripts for a music player. oh well, ill try it out  :)
not as long as it looks, I just tried to make it un fuckupable xD
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 8 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
Signature
If Java had true garbage collection, most programs would delete themselves upon execution.
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
Link is broken.
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 8 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
Added file as attachment, moved to script downloads.

 
Loading ...