Ok so i was messing around and i thought it would be fun just to add the box sets like on runescape the diff barrows. Im sure you all know what i meen. I know this is easy but i just decided i would release for the lazy people that dont wanna make it. This makes it so if you use any of the barrows item with each other it makes the set. Ima only show you one but im sure you can do the rest of the sets with it. Ill also show you how to make it open and show them.
basically go into your useitem.java and under itemonitem add this
Code:
if ((itemUsed == 4716) || (itemUsed == 4718) || (itemUsed == 4720) || (itemUsed == 4722) && (useWith == 4716) || (useWith == 4718) || (useWith == 4720) || (useWith == 4722)) {
if (c.getItems().playerHasItem(4716, 1) && c.getItems().playerHasItem(4718, 1) && c.getItems().playerHasItem(4720, 1) && c.getItems().playerHasItem(4722, 1)){
c.getItems().addItem(11848, 1);
c.getItems().deleteItem(4716, 1);
c.getItems().deleteItem(4718, 1);
c.getItems().deleteItem(4720, 1);
c.getItems().deleteItem(4722, 1);
c.sendMessage("You put your Dh parts into a set.");
} else {
c.sendMessage("You dont have all parts to make this set.");
}
}
Basically the first line is saying that any of those ids can be used with any of the useWith ids and itll make the box, so basically its saying any of the dh pieces used with the other dh pieces will make the box. The second line obviously checks to make sure you have that. And the rest i think you can figure out. So that will basically if you use any dh piece with the other itll make a box only if you have all them.
Now for the second part, to make it open. Open up Itemdef.java in ur client and with the rest add this
SOme people might need to add .getBytes(); if it doesnt work and u add that to the end of description
Code:
case 11848:
itemDef.itemActions = new String[5];
itemDef.itemActions[1] = "Open";
itemDef.name = "Barrows dharok's set";
itemDef.description = "A box containing full Dharoks";
itemDef.stackable = true;
break;
Basically this will add a "open" option to it. But if you go and try that youll wield it, so you need to go to itemass.java and search this
Code:
} else if(itemType(wearID).equalsIgnoreCase("ring")) {
targetSlot=12;
} else {
targetSlot = 3;
}
Should see a bunch of those but with diff numbers ands stuff. Under the last one add this
Code:
if (wearID == 11848) {
if (c.getItems().playerHasItem(11848, 1)) {
c.getItems().addItem(4716, 1);
c.getItems().addItem(4718, 1);
c.getItems().addItem(4720, 1);
c.getItems().addItem(4722, 1);
c.getItems().deleteItem(11848, 1);
}
Now compile ur server and client and run and you should be able to open your boxes and make them.
PS: I know this is easy but i was helping someone do it and decided to write a tut for it so ya.
}
if you want it so they need inventory spots though that way they dont lose items, (if they have 1 invy spot and they clcik it theyll lost 3 items) you can add this
Code:
if (c.inWild() && c.isBanking) {
c.sendMessage("You cannot do this right now");
} else if(c.getItems().freeSlots() <= 10) {
c.sendMessage("You need atleast 10 free slot's to use this feature.");
}
this also makes them not be able to do it in wild (it would help them, think about it, 4 items into 1 for prot or something). This goes in the item ass like below the wearitem id code