Thread: [PI] Item in wilderness help?

Results 1 to 8 of 8
  1. #1 [PI] Item in wilderness help? 
    Registered Member
    Join Date
    Apr 2011
    Posts
    147
    Thanks given
    5
    Thanks received
    10
    Rep Power
    0
    Could someone possibly help me block an item from the wilderness? For EX. it won't let you enter the wilderness if you have an item in your inventory or equipped? or It won't let you attack if you have that item in your inventory or equipped?

    Base: PI.
    Reply With Quote  
     

  2. #2  
    RevolutionX PK
    All3n's Avatar
    Join Date
    Jul 2010
    Posts
    1,172
    Thanks given
    1,380
    Thanks received
    527
    Rep Power
    982
    Here you go, this makes them not able to attack if they are wielding or have the item:

    if (c.playerEquipment[c.playerWeapon] == #####) {
    c.sendMessage("You can't attack with this item!");
    return;
    }
    if (c.getItems().playerHasItem(#####, 1)) {
    c.sendMessage("You have an item with you that you can not attack with.");
    return;
    }
    Add it to attackPlayer() in combatassistant.java
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member
    Nando's Avatar
    Join Date
    Feb 2009
    Age
    29
    Posts
    3,517
    Thanks given
    2,439
    Thanks received
    1,108
    Rep Power
    5000
    or you can apply ^ that to walking packet and check the y coord if the player is entering wilderness


    Reply With Quote  
     

  5. #4  
    Registered Member
    Whired's Avatar
    Join Date
    Aug 2007
    Posts
    2,126
    Thanks given
    238
    Thanks received
    500
    Rep Power
    822
    Code:
    if (c.playerEquipment[c.playerWeapon] == #####) {
    c.sendMessage("You can't attack with this item!");
    return;
    } else if (c.getItems().playerHasItem(#####, 1)) {
    c.sendMessage("You have an item with you that you can not attack with.");
    return;
    }
    Unreachable statement
    Reply With Quote  
     

  6. #5  
    Rune-Server Affiliate
    Genesis's Avatar
    Join Date
    Sep 2010
    Posts
    4,149
    Thanks given
    1,508
    Thanks received
    1,980
    Rep Power
    4944
    Quote Originally Posted by Whired View Post
    Code:
    if (c.playerEquipment[c.playerWeapon] == #####) {
    c.sendMessage("You can't attack with this item!");
    return;
    } else if (c.getItems().playerHasItem(#####, 1)) {
    c.sendMessage("You have an item with you that you can not attack with.");
    return;
    }
    Unreachable statement
    Try removing the else if.
    Reply With Quote  
     

  7. #6  
    RevolutionX PK
    All3n's Avatar
    Join Date
    Jul 2010
    Posts
    1,172
    Thanks given
    1,380
    Thanks received
    527
    Rep Power
    982
    Ah yes, sorry didnt mean to have else in there now that i looked over it
    Reply With Quote  
     

  8. #7  
    Registered Member
    Whired's Avatar
    Join Date
    Aug 2007
    Posts
    2,126
    Thanks given
    238
    Thanks received
    500
    Rep Power
    822
    Quote Originally Posted by generationx View Post
    Ah yes, sorry didnt mean to have else in there now that i looked over it
    The else-if is fine, you just can't have unconditional return statements preceding other statements in the immediate block:
    Code:
    return; // Unconditional return, always ends the method here, makes anything below unreachable
    System.out.println("You will never see this."); // Compiler error, unreachable
    Reply With Quote  
     

  9. #8  
    RevolutionX PK
    All3n's Avatar
    Join Date
    Jul 2010
    Posts
    1,172
    Thanks given
    1,380
    Thanks received
    527
    Rep Power
    982
    Oh crap i just saw that i put return; above c.sendMessage i see what you mean now, I'm blind today i swear.. lol
    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. Replies: 18
    Last Post: 09-16-2010, 01:53 AM
  2. Wilderness Item Dropping
    By Markian in forum Help
    Replies: 3
    Last Post: 03-08-2010, 09:18 AM
  3. Replies: 17
    Last Post: 01-26-2010, 11:04 PM
  4. Replies: 23
    Last Post: 09-10-2009, 03:29 AM
  5. Replies: 4
    Last Post: 04-16-2009, 07:11 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •