Hello, I'm back again for a little more help! I'm stuck on two things. Any help is appreciated
First:
I added a chest you thieve from at 90 thieving. But when you spam click it, or even if you click it once during the delay between thieveing it sends the message saying you cannot steal from the chest unless 90 thieving. What can I do to fix this so it ONLY sends that message if you are not 90 thieving, and so if you click it during the delay is doesn't send any message at all?
Here what I have so far
Code:
case 2182: // sticks chest
if (c.playerLevel[c.playerThieving] >= 90)
if (System.currentTimeMillis() - c.buryDelay > 5000) {
c.getItems().addItem(6306, Misc.random(2) + 1);
c.startAnimation(832);
c.sendMessage("You steal a some Trading sticks.");
c.buryDelay = System.currentTimeMillis();
c.getPA().addSkillXP(320 * Config.THIEVING_EXPERIENCE,
c.playerThieving);
} else {
c.sendMessage("You need 90 thieving to steal from this chest.");
}
break;
Second:
I'm using a clean PI source and it came with a basic NPC thieving system. I've looked over the code numerous times, but not sure where to start with what I want to do, so I haven't really tried anything. I want to make it so there is a higher chance to fail thieving the NPC. Right now it seems you fail to thieve the NPC every 50 thieves, and I'd like it more like every 5-10 thieves. What can I do?
This is what the source came with:
Code:
public void stealFromNPC(int id) {
if (System.currentTimeMillis() - c.lastThieve < 2500)
return;
for (int j = 0; j < npcThieving.length; j++) {
if (npcThieving[j][0] == id) {
if (c.playerLevel[c.playerThieving] >= npcThieving[j][1]) {
if (Misc.random(c.playerLevel[c.playerThieving] + 2
- npcThieving[j][1]) != 1) {
c.getPA().addSkillXP(
npcThieving[j][2] * Config.THIEVING_EXPERIENCE,
c.playerThieving);
c.getItems().addItem(995, npcThieving[j][3]);
c.startAnimation(881);
c.lastThieve = System.currentTimeMillis();
c.sendMessage("You thieve some money...");
break;
} else {
c.setHitDiff(npcThieving[j][4]);
c.setHitUpdateRequired(true);
c.playerLevel[3] -= npcThieving[j][4];
c.getPA().refreshSkill(3);
c.lastThieve = System.currentTimeMillis() + 3000;
c.sendMessage("You fail to thieve the NPC.");
break;
}
} else {
c.sendMessage("You need a thieving level of "
+ npcThieving[j][1] + " to thieve from this NPC.");
}
}
}
}