Difficulty: 3/10
List for all songs (643): http://forums.ffshrine.org/f72/runes...3-songs-36052/
Step 1.
Make a new file called Music.java and place this in it.
Code:
public class Music {
public static enum CITY_MUSIC {
VARROCK(169),
WATERFALL(125),
FALLADOR(23);
int music;
CITY_MUSIC(int music) {
this.music = music;
}
public int getMusic() {
return music;
}
}
}
This holds the song ID's and where you want them to play.
VARROCK(169),
varrock where you want it to play and the (169) is the song id.
Step 2.
Add these anywhere in client.java
Code:
public void frame174(int i1, int i2, int i3) {
outStream.createFrame(174);
outStream.writeWord(i1);
outStream.writeByte(i2);
outStream.writeWord(i3);
updateRequired = true;
appearanceUpdateRequired = true;
}
public void musicManager(String action, int songID) {
if (action == "PLAY") {
outStream.createFrame(74);
outStream.writeWordBigEndian(songID);
}
if (action == "STOP") {
outStream.createFrame(74);
outStream.writeWordBigEndian(-1);
}
}
So basicly these allow the music to be played.
Step 3.
Search for case 121: and add this under it.
Code:
if(isInvarrock()) {
musicManager("PLAY", Music.CITY_MUSIC.VARROCK.getMusic());
}
This packet is sent when a player is finished loading a new map region.
So bassicly this changes the music between towns.
Step 4.
Search.
Code:
public boolean multiCombat()
and under this method add..
Code:
public boolean isInvarrock()
{
if (isInArea(3158,3469, 3258, 3258)) return true;
return false;
}
public boolean isInArea(int x, int y, int x2, int y2){
if ((absX >= x && absX <= x2) && (absY <= y && absY >= y2)) return true;
return false;
}
This is where you want the music to be played.
Finished!
Ive only added music playing in Varrock so you can add the others your self.
Also i'll give you a command to test some of the songs
Code:
if (command.startsWith("music") && playerRights >= 2) {
try
{
int music = Integer.parseInt(command.substring(6));
if (music >= 0)
{
outStream.createFrame(74);
outStream.writeWordBigEndian(music);
sM("You play the music.");
} else {
sM("No such music id..");
}
} catch(Exception e) {
sM("Wrong Syntax! Use as ::music 1");
}}
Any problems please let me know!
Credits:
Me - 40%
A friend of mine (from another site) - 60%
Thank you, Exel