How to add music map based

Lots of cool and useful tips to mod either serverside or clientside
Post Reply
Sunndae
Posts: 13
Joined: Sat Mar 27, 2010 1:49 pm
Contact:

How to add music map based

Post by Sunndae »

This work is not originally mine. I had it saved on my computer, copyd from the old SSM site for personal use. I dont know who the original creator is, however his tutorial has worked for me in the past and I didnt find this here yet:





We can add .wav files to be played in-game, as long as these .wav files have a bitrate around 180kbits. I ve been able to use one with 256kbits, with 6 Mb size but thats a gamble, hence the name of the song:
"The Gambler"
I used EZ MP3 TO WAV Converter to create this wav file by repeatedly converting back and forth until i had a file that would play.
Check the bitrate, most files used by BF1942 use 176Kbits for medium sound settings.

so here it goes, required code to be added is marked red.

1.) unpack desired map to desktop using WinRFA , i will use gazala in this example, u can extract to another loaction, important here is that u know where its at. :)

2.) the unpacked directory is "bf1942". open it, open"levels" till u have opened "Gazala" . Here create a new folder named "Sounds", we will need it later and a folder named "csmradio" in which we will put our 2 example files gambler.wav and america.wav.

3.) now find the "ObjectSpawns.con" file in your prefered gamemode folder, I used "Conquest"

4.) open ObjectSpawns.con and create ur "Radio", like so. on the bottom of the file

ObjectTemplate.create SimpleObject DCR_Radio_tune1
objectTemplate.loadSoundScript ../Sounds/Radio_tune1.ssc

for a second tune add another, like
ObjectTemplate.create SimpleObject DCR_Radio_tune2
objectTemplate.loadSoundScript ../Sounds/Radio_tune2.ssc

and so on. Then save the file. Make sure the path to the soundfile is entered as shown, containing the .. (dots)

we have thereby layed a path to the "sounds" folder we created earlier.

5.) open the "sounds" folder and create, e.g. with editor, a file called

Radio_tune1.ssc, in this file goes this:

#templateLevel HIGH

newPatch
############
### Near ###
############
load @ROOT/bf1942/levels/gazala/csmradio/gambler.wav
loop
minDistance 5
relativePosition 0/1/0
volume 1
dopplerOff
priority -5
*** Distance Volume ***
beginEffect
controlDestination Volume
controlSource Distance
envelope Ramp
param 20
param 50
param 0.75
param -1
endEffect


#templateLevel MEDIUM

newPatch
############
### Near ###
############
load @ROOT/bf1942/levels/gazala/csmradio/gambler.wav
loop
minDistance 5
relativePosition 0/1/0
volume 1
dopplerOff
priority -9
*** Distance Volume ***
beginEffect
controlDestination Volume
controlSource Distance
envelope Ramp
param 20
param 50
param 0.75
param -1
endEffect

save !
repeat this with every "Radio" u have created naming the ssc file accordingly, like for the 2nd tune it looks like this:
create this file Radio_tune2.ssc,
in this file goes this:

#templateLevel HIGH

newPatch
############
### Near ###
############
load @ROOT/bf1942/levels/gazala/csmradio/america.wav
loop
minDistance 5
relativePosition 0/1/0
volume 1
dopplerOff
priority -5
*** Distance Volume ***
beginEffect
controlDestination Volume
controlSource Distance
envelope Ramp
param 20
param 50
param 0.75
param -1
endEffect


#templateLevel MEDIUM

newPatch
############
### Near ###
############
load @ROOT/bf1942/levels/gazala/csmradio/america.wav
loop
minDistance 5
relativePosition 0/1/0
volume 1
dopplerOff
priority -9
*** Distance Volume ***
beginEffect
controlDestination Volume
controlSource Distance
envelope Ramp
param 20
param 50
param 0.75
param -1
endEffect

save the file
this code is original BF1942, we need it to be able to hear our sounds in game, in there i just changed the path to the wav.file to be in our map.

6.) on the bottom of ObjectSpawnTemplates.con we put this:

ObjectTemplate.active Mi24DGGunMount
ObjectTemplate.addTemplate DCR_Radio_tune1

ObjectTemplate.active AH64M230Rotation
ObjectTemplate.addTemplate DCR_Radio_tune2

now the heligunners willl be entertained. save the file.
U can add ur radio to any template

7.) make a copy of ur map, in this case "gazala.rfa" and put it somewhere for backup purposes.

8.) pack the directory "bf1942" and save over Gazala.rfa using WinRfa.

8a.)delete the all but "Sounds", "csmradio", and "conquest" folders and
pack and save as gazala_001.rfa and put into ur mods folder.

thats it. i perfer bionic in my turret :D

*******************************************************


For converting the soundfile to the bitrate you need I suggest using the 4-music program.

Best regards,

Sunn
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: How to add music map based

Post by Swaffy »

I like this. I'll try it out.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: How to add music map based

Post by Apache Thunder »

Specifying the template levels are optional it seems. I discovered this while working on my BFH mod.

You can get away with just having none at all. (have the sound script only have one entry and no extras for medium and low). So unless you plan to make changes unique to lower sound setting modes, then adding the extra template modes is a waste of code. ;)
ImageImageImage
I have cameras in your head!
GoodDayToDie!!
Posts: 221
Joined: Mon Dec 13, 2010 7:59 am
Location: Bat Country, California
Contact:

Re: How to add music map based

Post by GoodDayToDie!! »

I'm trying to add a couple songs to a map I'm working on but I'm a noob and none of that really makes sense to me:/
Image
Post Reply