|
So I just got back into programming servers again and I'm taking things one step at a time, easing back into things.
The first thing I wanted to accomplish was adding more skin colours and having it so you have to be a donator to choose from the more off-the-wall colours.
I came across this post
https://www.rune-server.ee/runescape...-improved.html
Upon swapping out my method with the one posted I noticed that some colours repeated and to be honest I had no clue what I was replacing so I decided to break it down and analyze it compared to the code originally coded in my server.
So let's break it down.
Okay so each index in this array is for a different piece to colour.Code:public static int[][] appearanceColors = { { 6798, 107, 10283, 16, 4797, 7744, 5799, 4634, -31839, 22433, 2983, -11343, 8, 5281, 10438, 3650, -27322, -21845, 200, 571, 908, 21830, 28946, -15701, -14010 }, //HAIR { 8741, 12, -1506, -22374, 7735, 8404, 1701, -27106, 24094, 10153, -8915, 4783, 1341, 16578, -30533, 25239, 8, 5281, 10438, 3650, -27322, -21845, 200, 571, 908, 21830, 28946, -15701, -14010 }, //TORSO { 25238, 8742, 12, -1506, -22374, 7735, 8404, 1701, -27106, 24094, 10153, -8915, 4783, 1341, 16578, -30533, 8, 5281, 10438, 3650, -27322, -21845, 200, 571, 908, 21830, 28946, -15701, -14010 }, //LEGS { 4626, 11146, 6439, 12, 4758, 10270 }, //FEET { 4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574, 0, 12821, 100 , 20165, 43678, 16895 ,28416 ,12231 ,947 ,60359, 32433} // SKIN };
So basically just add the colours you want into the index of your choice.Code:[0] = HAIR [1] = TORSO [2] = LEGS [3] = FEET [4] = SKIN
Now once you do so, you also have to change the max amount of colours per index or else it will display the colour in the appearance changer but it won't apply it to your character.
To do this visit your server sided code and look for your change Appearance packet. For me it was ChangeAppearance.java
Change the 2nd number in the index to the number of entries you have per index. Remember to start counting at 0 and not 1.Code:private static final int[][] ALLOWED_COLORS = { { 0, 24 }, // hair color { 0, 28 }, // torso color { 0, 28 }, // legs color { 0, 5 }, // feet color { 0, 18 } // skin color };
Now to make it so you need donator or something to choose certain colours in the same ChangeAppearance file search for some like
change this to something similar to thisCode:c.playerAppearance[12] = colors[4]
If you want to do it for a specific colour you can useCode:if (colors[4] >= 8) { if (c.amDonated < 10) { c.sendMessage("You must be a donator to use these skin colors."); return; } else { c.playerAppearance[12] = colors[4]; // skin colour } } else { c.playerAppearance[12] = colors[4]; // skin colour }
or if you're like me all your new colours will be donator only.Code:colors[4] == 8 || colors[4] == 9
You can use other things such as playerRights to make colours specific too.
I'm sorry if the wording for this is weird. Like I said I'm just coming back to this after 5/6 years. So bare with me. I will improve the format of this as I figure out more. I will also be adding how to know what colours you're adding once I figure that out.
« Map Functions Fixes [143+] [The Correct way] | Simple Animated Login Screen Background » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |