Hello ?
|
Okay so i have caskets in my server.
public static int Casket[] = {995,315,361,1333
The casket contains alot of items, eg coin, shark etc.
Is it possible (if yes, then how) to make it drop eg 15 gp instead of just one, or like 5 noted sharks?
i have had this problem before and i gave up on it never could figure it out but good luck ( bump )
2d array.
int casket[] = {{itemId, amount}, {995, 15}};
yeah, you can do a 2d array like the guy up there suggested
Code:int CASKET_ITEMS[][] = { {995, 15}, {555, 100} };Code:getItems().addItem(CASKET_ITEMS[i][0], CASKET_ITEMS[i][1]);
As mentioned a 2d array can easily do this for you. Regarding how it's fairly simple, ill give you an example usage of how it can be done.
Code:public class Casket { public static final int[][] CONTENTS = { {892, 25}, {995, 15000}, {4151, 1}, {11694, 1} }; public static void drop(Player player) { int index = Misc.random(CONTENTS.length - 1); int itemId = CONTENTS[index][0]; int amount = CONTENTS[index][1]; //drop item } }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |