Thread: Disabling items in wild

Results 1 to 9 of 9
  1. #1 Disabling items in wild 
    Registered Member
    Join Date
    Dec 2015
    Posts
    42
    Thanks given
    1
    Thanks received
    1
    Rep Power
    11
    So i have been trying to disable certain items in wild so if your wearing them you cannot attack other players but still can get attacked and attack npcs. The code is from older server and now im using Anguish. Any help welcome =)
    Current code im using
    Code:
    	private final int[] invalids = { 773,};
    Code:
    		
    if(c.inArea(2941, 3525, 3392, 3968)) {
    		for (int invalid_weapons : invalids) {
    			
    			if (c.playerEquipment[3] == invalid_weapons
    			|| c.playerEquipment[2] == invalid_weapons
    			|| c.playerEquipment[1] == invalid_weapons
    			|| c.playerEquipment[0] == invalid_weapons
    			|| c.playerEquipment[4] == invalid_weapons
    			|| c.playerEquipment[5] == invalid_weapons
    			|| c.playerEquipment[6] == invalid_weapons
    			|| c.playerEquipment[7] == invalid_weapons
    			|| c.playerEquipment[8] == invalid_weapons
    			|| c.playerEquipment[10] == invalid_weapons
    			|| c.playerEquipment[11] == invalid_weapons
    			|| c.playerEquipment[12] == invalid_weapons
    			|| c.playerEquipment[13] == invalid_weapons
    			|| c.playerEquipment[9] == invalid_weapons) {
    				resetPlayerAttack();
    				c.sendMessage("You are wearing a custom item that is not allowed during PvP!");
    				return;
    			}
    		}
    		}
    Reply With Quote  
     

  2. #2  
    Registered Member
    Grant_'s Avatar
    Join Date
    Aug 2014
    Posts
    493
    Thanks given
    93
    Thanks received
    109
    Rep Power
    136
    Quote Originally Posted by takanas View Post
    So i have been trying to disable certain items in wild so if your wearing them you cannot attack other players but still can get attacked and attack npcs. The code is from older server and now im using Anguish. Any help welcome =)
    Current code im using
    Code:
    	private final int[] invalids = { 773,};
    Code:
    		
    if(c.inArea(2941, 3525, 3392, 3968)) {
    		for (int invalid_weapons : invalids) {
    			
    			if (c.playerEquipment[3] == invalid_weapons
    			|| c.playerEquipment[2] == invalid_weapons
    			|| c.playerEquipment[1] == invalid_weapons
    			|| c.playerEquipment[0] == invalid_weapons
    			|| c.playerEquipment[4] == invalid_weapons
    			|| c.playerEquipment[5] == invalid_weapons
    			|| c.playerEquipment[6] == invalid_weapons
    			|| c.playerEquipment[7] == invalid_weapons
    			|| c.playerEquipment[8] == invalid_weapons
    			|| c.playerEquipment[10] == invalid_weapons
    			|| c.playerEquipment[11] == invalid_weapons
    			|| c.playerEquipment[12] == invalid_weapons
    			|| c.playerEquipment[13] == invalid_weapons
    			|| c.playerEquipment[9] == invalid_weapons) {
    				resetPlayerAttack();
    				c.sendMessage("You are wearing a custom item that is not allowed during PvP!");
    				return;
    			}
    		}
    		}
    Some more context as to where you placed these would be valuable to help you further. Did you place this code in a combat related class? or just randomly I can't tell lol. Also most frameworks have a inWild() method that already has a Boundary created. You shouldn't have to make a new one. There might even be a isWearing(int itemId) -> boolean method so you can eliminate all of those lines.

    Regardless, were are going to need to know where you are placing this code.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Dec 2015
    Posts
    42
    Thanks given
    1
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by Grant_ View Post
    Some more context as to where you placed these would be valuable to help you further. Did you place this code in a combat related class? or just randomly I can't tell lol. Also most frameworks have a inWild() method that already has a Boundary created. You shouldn't have to make a new one. There might even be a isWearing(int itemId) -> boolean method so you can eliminate all of those lines.

    Regardless, were are going to need to know where you are placing this code.
    I have tryed the code in combatassistant.java (same as it was in old server) and in attackPlayer.java and i have tryed inwild just was trying other stuff to find the problem.
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Dec 2015
    Posts
    42
    Thanks given
    1
    Thanks received
    1
    Rep Power
    11
    Well i managed to get it working but im running in 1 problem and thats it that if autoretaliate is on it still attacks when wearing the items.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Dec 2015
    Posts
    42
    Thanks given
    1
    Thanks received
    1
    Rep Power
    11
    Bump =)
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Dec 2015
    Posts
    42
    Thanks given
    1
    Thanks received
    1
    Rep Power
    11
    Bump
    Reply With Quote  
     

  7. #7  
    ¦¦¦ RuneTimes ¦¦¦

    RainDropzZ's Avatar
    Join Date
    Oct 2010
    Posts
    348
    Thanks given
    28
    Thanks received
    93
    Discord
    View profile
    Rep Power
    471
    Quote Originally Posted by takanas View Post
    Well i managed to get it working but im running in 1 problem and thats it that if autoretaliate is on it still attacks when wearing the items.
    Then you should look where autoretaliate is handled and add a check for the specific items there too. Same as you did with normal attacking.
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Dec 2015
    Posts
    42
    Thanks given
    1
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by RainDropzZ View Post
    Then you should look where autoretaliate is handled and add a check for the specific items there too. Same as you did with normal attacking.
    I found the issue being that theres 2 attackplayer.java files and the other one handles the autoretaliate thanks for the help =)
    Reply With Quote  
     

  9. #9  
    ¦¦¦ RuneTimes ¦¦¦

    RainDropzZ's Avatar
    Join Date
    Oct 2010
    Posts
    348
    Thanks given
    28
    Thanks received
    93
    Discord
    View profile
    Rep Power
    471
    Nice to hear that you were able to fix it
    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) Players Don't Lose Items In Wild (PI)
    By ElysianXrsps in forum Help
    Replies: 12
    Last Post: 04-11-2013, 08:12 AM
  2. [PI] dropping items in wild
    By EricFtw in forum Help
    Replies: 1
    Last Post: 11-11-2012, 08:37 PM
  3. [PI] Disable item in PvP/Wilderness?
    By Purexthedark in forum Help
    Replies: 4
    Last Post: 05-28-2011, 05:03 PM
  4. z508 staff spawn items in wild
    By sparc mac1 in forum Help
    Replies: 3
    Last Post: 07-09-2010, 02:28 AM
  5. [req] a way to loose items in wild[req]
    By Rowan112 in forum Requests
    Replies: 2
    Last Post: 05-24-2009, 03:48 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
  •