Author Topic: How would I put usable music files in a Gamemode?  (Read 679 times)

I want to upload a Gamemode to RTB, but RTB does not support music files anymore.

How would I put the music files in the actual gamemode itself, while still usable by the music bricks?

You could have the music file in the game mode folder and on start up you could check if the file exists in the music folder, and if it does not you could use fileCopy to copy the music file into the music folder.

What I was thinking you could do if there is no better method is this

First of all make a folder and name it Music, put all your music inside it and then put that in Gamemode_Whatever

Next if you haven't got one already, make a server.cs file and in it put this code

Code: [Select]
for(%i = findFirstFile("Add-Ons/Gamemode_GamemodeNameHere/Music/*.ogg");%i!$="";%i=findNextFile("Add-Ons/Gamemode_GamemodeNameHere/Music/*.ogg"))
{
%filename = filename(%i);
filecopy(%i,"Add-Ons/Music/"@%filename@"");
}
Replace Gamemode_GamemodeNameHere with whatever you gamemode file is called.

That will copy all the music files from the Music folder inside your gamemode file and put them in Add-Ons/Music, then you could probably just add the music into Gamemode.txt. Remember to put ADDON GameMode_Whatever into your gamemode.txt as well so that the server.cs is executed.