Jump to content
Sign in to follow this  
A-SUICIDAL

Adding a "Song Playlist PA System" Radio to your Base

Recommended Posts

Sample Mission:

suicidals_radio.zip

This video demonstrates how it tested on a dedicated server(my crappy pc, lol).

Full Description:

Basically what happens is... when the mission starts and there is at least 1 player present a repeated trigger is activated by "player==player", then the music starts playing track 1 and will eventually cycle through all 10 tracks if left alone. A player can run over to the radio at any time and either turn the radio off, or they can turn the radio off and back on again, which will cause it to cycle to the next song - and they can continue to keep turning it off-and-on until they find a song they like. Now if somebody joins in progress, that new player will automatically activate the "player==player" trigger and the radio will simply cycle to the next song and all players (in range) will immediately hear the new song start to play.

Yeah, it's a bit different from how I initially wanted it to work, but I actually like how this worked out. So if you are standing around at base and 5 players join the server during the course of 1 minute, you would hear the radio cycle through 5 tracks, kind of like your friend playing with the radio station dial in you car. This could seem annoying if you are just standing around at base picking you nose, but it's really no different than if somebody were to walk over to the radio and turn the radio off-and-on 5 times trying to find a song they like. I haven't decided on what songs I want to use in my own final version, but the mission I am eventually going to use this in only has 14 coop players, which is fine, but I wouldn't want to use the radio in a mission that has like 50 players unless I were to change the "player==player" activation to some other activation method, otherwise the radio would constantly be cycling to a new song as many players come and go on the server. So this radio playlist script is probably better suited for small missions that do not have a lot of players. I never create missions with more than 14 players.

Normally, most players would be out in the field killing bad guys, so the radio is only entertaining for the moment when you respawn at base and need to goof around in the ammo crate, or run over and hop in a vehicle or whatever you need to do at base before heading back to the battle. And it's entertaining for the player that joined in progress. It definitely adds a little life to an otherwise very boring and dreadfully quite base. Again, the radio in this sample mission is only triggered by "player==player" or if somebody actually walks over to the radio and plays around with the on/off actions, otherwise the radio just plays on it's own and does it's own thing and requires no interaction at all. Also, if somebody turns the radio off and leaves it off, the radio will turn back on and start playing the next song when a new player joins the server. I never wanted the radio to play songs randomly, but instead I wanted it to use a set playlist so each song has a fair chance to be heard, plus it's nice to remember what order the songs are in if you create your own long list of songs. During testing, when I left the server and rejoined, the radio started to play right away, but the on/off actions were not available for a few seconds, which is not a problem since they do eventually appear.

Install Instructions:

It's very simple to implement into your own mission.

Simply open the sample mission and select everything except the players and the respawn_west marker and hit (Ctrl-C) to copy.

Open your own existing mission and hit (Ctrl-V) to paste, or (Ctrl-Shift-V) to paste in "same" place.

Copy the "radio" and "sound" folders from the sample mission and paste them into your own existing mission folder.

If you already have a "sound" folder, you can copy the contents and paste them into your "sound" folder.

Add the following lines to your init.sqf:

mission_started=true;
publicVariable "mission_started";

Add the following line to your description.ext:

#include "sound\sound.cpp"

Or open the sound.cpp file with a text editor and copy the script and paste it in the bottom of your description.ext file.

If you have experience with .ogg sound files, you can easily replace the songs in the playlist with your own songs by simply using the same file names track1.ogg, track2.ogg.. etc,

but... VERY IMPORTANT, you then need to open the "radio_playing.sqf" file and change all of the "sleep times" for each song and make sure that they match the length of your replacement songs.

So if you replace track1.ogg with a song that is 3 minutes long, then the sleep time for track1 should be "sleep 183;" giving it an additional 3 seconds of slack time since Arma 2 does not maintain "real time" accurately. I use Goldwave sound editor since it is very easy to use and it loves .ogg files. Goldwave is free, just google it.

Another thing to keep in mind if you plan to replace sound files, and this is very important too, in the "sounds.cpp" cfgSounds list of ogg sound files that you replace, it is extremely important that you do not use a volume of 1, otherwise the sound will cast too far and when players hear the sound from very far away, it will sound crappy and the pitch will be badly distorted at a far distance. It's most noticeable when you are flying fast in a chopper to-or-from base. When you fly away from base, the pitch drops deep, when you fly towards base the pitch increases and sounds like mickey mouse, to avoid this from happening you should keep your volume setting below "0.5". The volume setting actually behaves more like a sound radius setting than a volume control, so try to keep your sound volume no higher than 0.5 and no lower than 0.3 or it will sound like crap.

sound[]={"sound\track1.ogg",[color=red][b]0.5[/b][/color],1};

I am in no way an expert at scripting, quite the opposite, so I more than welcome any outside help with fine tuning the scripts or fixing whatever might be buggy.

I did not copy anybody's script, nor do I know if anything like this exists that plays cfgSounds (not cfgMusic). I'm still amazed I got it to work at all.

Share this post


Link to post
Share on other sites

Good choice of songs, Simple, and I love it! I've tried various other "music scripts", but this one cuts the cake perfectly!

Only con I can see is the size, 13mb mission file, not including more scripts the mission maker may be using. Did you compress these songs as much as you could while keeping quality?

Besides that, it's prefect! Good job!

-cheers!

Share this post


Link to post
Share on other sites

They were oroginally: Vorbis, 22050Hz, 45kbps, (0.4q), mono.

I just changed the quality to: Vorbis, 16000Hz, 56kbps, (0.4q), mono and re-uploaded the file. I included 2 MP sample missions so people can see the file size for themselves and test it easier without having to open and save it in the editor.

I could actually go lower on the quality if needed. I don't really know what is considered a large file size when it comes to missions. I also don't understand why it takes so long to connect to a server and download a mission that is only a few KB is size when I have a 60 down and 10 up connection.

I removed 2 tracks, "Prisoner" by Iron Maiden and "She's not there" by The Zombies and I changed the track order and made sure all the sleep times were correct. So now after track 8 it will cycle back to track 1. The files size is now 9mb. I tested it and it still sounded decent, much like a PA system you would hear on an old episode of MASH, lol. I like all the songs in the playlist, but honestly, being that I am an ex- death metal rhythm guitarist and spent 8 years in a magnet band banging my head against marshall stacks, my playlist would normally be full of a lot more ear bleeding titles, but I tried to pick what I thought would work for everybody. It would have been nice to throw in some "Back in Black" and "War Pigs". Maybe next time.

Edited by A-SUICIDAL

Share this post


Link to post
Share on other sites

hey A Suicidal very nice a few questions for you.

I am working on a mission that BLUFOR has an UN controlled airport but the main HQ base that the players get spawn at as well as respawn gets semi randomly (1-6 different starting locations) seclected on the map at the start of the game. The main HQ can be relocated anywhere on the map. The two SL of blufor can also call in to be build two FOB's anywhere on the map.

I know I can get your script to work at the airport but can it work for multiple location? and if yes , what about random locations? can this be added to the FOB's and the main HQ or only fix locations on the map. Thanks and great work love it!

Share this post


Link to post
Share on other sites

Well, that sounds pretty tricky, but not completely undo-able. I wasn't sure so I messed around a bit and managed to make a radio1 and a radio2 and they both mirror each other, so if you turn one radio off, they both turn off, and they both play the same track at the same time. I actually had fun with this. I guess you could make as many radios as you want with my script, but at a certain point I would imagine that it might start getting a little weird. I made another sample mission that has 2 radios in it. You start out near "radio1" and then you can hit 0-0-1 to attach it to the front of your ATV, then you drive a about 100 meters and hop out near a chopper and then hit 0-0-2 to attach the radio to the right side door of the chopper, then you fly to the end of the airstrip, land and get out and you will see "radio2" sitting on another crate. when the 2 radios are close to each other, it starts sounding like a bad trip because the radios are never perfectly in sync with one another, but if you turn one radio off, they both turn off, and then when you turn it back on, both radios start playing in sync. They radios always stay close to being in sync, they only fall out of sync a little bit whenever you move around fast and cause the pitch to drop or increase.

Sample Mission with 2 Radios

suicidals_radio_x2.zip

I would suggest maybe using at most 3 radios, but keep them very far apart. You could either have all 3 radios accessible, or you could hide one in a wall if for some reason you might not want anybody using it. You can see in my new sample mission how I have it set up to work with 2 radios and from there you should be able to figure out how to make a 3rd or a 4th radio. You can also see how I have 0-0-1, 0-0-2, 0-0-3 radio triggers that repeat, so you can attach the radio to a car, then attach it to a chopper, then attach it back to the car again, then attach it back on top of the crate. the 3 numbers that you adjust to attach the object are fun to play around with.

For the ATV, I attach the radio using...

radio1 attachTo [atv1, [0,+0.84,-0.48]];

if you are sitting on the ATV...

0 = left and right adjust.

+0.84 = forward and back adjust.

-0.48 = the height adjust.

You could even go as far as to attach the radio your body and have it detach if you die, lol.

If you add a radio to a chopper, when the track changes it might suddenly sound very low volume, I think the chopper engine takes priority, so just make sure to start a new track first, then start your chopper engine.

I had a blast testing it with the ATV.

Share this post


Link to post
Share on other sites

This looks cool gonna check it out.

They were oroginally: Vorbis, 22050Hz, 45kbps, (0.4q), mono.

I just changed the quality to: Vorbis, 16000Hz, 56kbps, (0.4q), mono and re-uploaded the file. I included 2 MP sample missions so people can see the file size for themselves and test it easier without having to open and save it in the editor.

I could actually go lower on the quality if needed. I don't really know what is considered a large file size when it comes to missions. I also don't understand why it takes so long to connect to a server and download a mission that is only a few KB is size when I have a 60 down and 10 up connection.

There seem to be different schools of thought when it comes to mission file size.. obviously smaller is better but why other than download time? Not really sure...

The delay when you connect to the server and start to download the file (gets to like 24 or 32kb I think then stops) is while the server is reading the mission (it doesn't do this until you hit Continue)... once the mission is read you will start to d/l the file from the server. I don't think the KB meter is that accurate.. mine seems to chug along pretty slow until it gets over 5MB then it speeds up considerably. I'm sure the server is set to only allow X amount of bandwidth for sending mission files to clients, which is why it takes the same amount of time on LAN or high-speed connection.

Share this post


Link to post
Share on other sites

Hi, Thanks for this great feature! I got this up and running in Arma 2. Now I am trying to get this up and running in an Arma 3 mission. However no radio under small objects. Getting everything radio-related replaced by another small object doesn't produce satisfying results. (Not that I am skilled in scripting for that matter.) Anyone able to get this feature working in Arma 3 at the moment?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×