Purpose: Creating an array that checks if you are wielding or have an item in your inventory.
Difficulty: As hard as you make it.
Assumed knowlege: Reading/Comprehending
Declare:
Code:
public void checkEMItems() {
int[]EMNA = { 4151 };
for (int h = 0; h < EMNA.length; h++) {
if (!playerHasItem(EMNA[h], 1)){
sendMessage("You have an item that you can't bring on board.");
} else {
sendMessage("You can board the ship.");
}}}
public void checkEMWItems() {
int[]EMNA2 = { 4151 };
for (int h = 0; h < EMNA2.length; h++) {
if (playerEquipment[playerWeapon] != EMNA2[h]){
//
} else if (playerEquipment[playerHat] != EMNA2[h])
//
} else if (playerEquipment[playerHands] != EMNA2[h]){
//
} else if (playerEquipment[playerChest] != EMNA2[h]){
//
} else if (playerEquipment[playerLegs] != EMNA2[h]){
//
} else if (playerEquipment[playerFeet] != EMNA2[h]){
//
} else if (playerEquipment[playerShield] != EMNA2[h]){
//
} else {
sendMessage("You are wielding an item that you can't bring on board.");
}}}
The ENMA and the EMNA2 are the arrays. The 4151 inside the array is the ID for a whip. The code above searches through the arrays to see if you are wielding the item in any of the equipment spots, or if you have it in your inventory. You can use the method above for whatever you want.
Example:
I could use the above method to have the Entrana Monk search me
before I can embark on the journey to Entrana.
That's why the methods are called EMItems (standing for Entrana Monk Items -
inventory) and EMWItems (standing for Entrana Monk Wield Items).
To check it, we would just use this method:
Code:
checkEMItems();
checkEMWItems();
This is just a base, you guys can customize it to however you wish. This is just a simple base for whichever intentions you use.
Here is an array if you plan on using the Entrana Monk searching method:
Code:
int[]EMNA = { 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 577, 579,
581, 636, 638, 640, 642, 644, 646, 648, 650, 652, 654, 656, 658, 660, 662,
664, 1033, 1035, 1037, 1038, 1040, 1042, 1044, 1046, 1048, 1050, 1053, 1055,
1057, 1059, 1833, 1835, 1837, 2894, 2896, 2898, 2900, 2902, 2904, 2906, 2908, 2910,
2912, 2914, 2916, 2918, 2920, 2922, 2924, 2926, 2928, 2930, 2932, 2934, 2936, 2938, 2940, 2942, 6570 };
The above array has a LOT of the robe code, including boots, gloves, hats, body's, and bottoms.