Thread: PI Thieving Help

Results 1 to 5 of 5
  1. #1 PI Thieving Help 
    Registered Member
    Join Date
    Dec 2011
    Posts
    77
    Thanks given
    2
    Thanks received
    0
    Rep Power
    11
    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.");
    				}
    			}
    		}
    	}
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Dec 2011
    Posts
    77
    Thanks given
    2
    Thanks received
    0
    Rep Power
    11
    Anybody?
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Dec 2011
    Posts
    77
    Thanks given
    2
    Thanks received
    0
    Rep Power
    11
    no one has any idea with this? I've continued to try what I know but can't seem to get what I want out of it.
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Jun 2008
    Posts
    913
    Thanks given
    30
    Thanks received
    94
    Rep Power
    0
    Code:
    			case 2182: // sticks chest
    				if (System.currentTimeMillis() - c.buryDelay > 5000) {
    					if (c.playerLevel[c.playerThieving] < 90) {
    						c.sendMessage("You need 90 thieving to steal from this chest.");
    					}
    					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);
    				}
    			break;

    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]) {
    					int level = c.playerLevel[c.playerThieving];
    					double chance = (level - npcThieving[j][1])) + (level == npcThieving[j][1]) ? 5 : 3) + 1;
    					if (new java.util.Random().nextInt((int)chance) > 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.");
    				}
    			}
    		}
    	}
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Dec 2011
    Posts
    77
    Thanks given
    2
    Thanks received
    0
    Rep Power
    11
    Thanks everyone I'll try it all out in a minute
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI] Thieving at random [Help]
    By fluxxscape in forum Help
    Replies: 5
    Last Post: 08-27-2012, 12:46 PM
  2. PI Need help with Thieving stalls
    By rocky2k10 in forum Help
    Replies: 13
    Last Post: 06-09-2012, 06:41 PM
  3. need thieving help (PI)>HELP IF YOU WANT REP!<
    By wimpiewillem in forum Help
    Replies: 17
    Last Post: 04-09-2012, 04:51 PM
  4. [PI]Thieving Help
    By Glenn in forum Help
    Replies: 1
    Last Post: 06-07-2011, 05:07 AM
  5. Thieving Help! Ints Involved! [PI]
    By RSAfterLife in forum Help
    Replies: 2
    Last Post: 05-01-2011, 09:34 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •