Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Get other players equipment


    Dorkinator

    Recommended Posts

    Returns the target players current equipment sans rings.

     

    	public static int[] getEquipped(Player p){
    		int[] appearanceData = p.getComposite().getApperance();
    		int[] equipment = new int[appearanceData.length];
    		for(int i = 0; i < equipment.length; i++){
    			equipment[i] = appearanceData[i] > 512 ? appearanceData[i]-512 : -1;
    		}
    		return equipment;
    	}
    Credit goes to Hexagon for this.
    Link to comment
    Share on other sites

    • 2 weeks later...

    Example usage of getting all players who have nothing equipped.

    @Override
        public int onLoop() {
            final List<Player> lp = getPlayers().all(player -> player != null && player.exists() && hasNothingEquipped(player));
            if (lp != null && lp.size() > 0) {
                for (Player p : lp) {
                    if (p != null) {
                        log(p.getName());
                    }
                }
            }
    
            return Calculations.random(600, 800);
        }
    
        public static int[] getEquipped(Player p) {
            //https://dreambot.org/forums/index.php/topic/10595-get-other-players-equipment/
            int[] appearanceData = p.getComposite().getApperance();
            int[] equipment = new int[appearanceData.length];
            for (int i = 0; i < equipment.length; i++) {
                equipment[i] = appearanceData[i] > 512 ? appearanceData[i] - 512 : -1;
            }
            return equipment;
        }
    
        public static boolean hasNothingEquipped(Player p) {
            for (int i : getEquipped(p)) {
                if (i != -1) {
                    return false;
                }
            }
            return true;
        }
    Link to comment
    Share on other sites

    • 3 years later...

    So I know I'm necroposting the hell out of this, but for the life of me I can't figure out how to check the player nearest to me for a specific item

    Link to comment
    Share on other sites

    4 minutes ago, LostVirt said:
    
    Not sure how to check equipment but probably something like this 
    
    Players.closest(p -> p != null && p.getComposite().getAppearance()[1] == 1337);
    

    like this?

    if (Players.closest(p -> p != null && p.getComposite().getAppearance()[1] == 1337) != null) {
    			return State.RANGED;
    		}

     

    Link to comment
    Share on other sites

    4 minutes ago, TTB said:

    like this?

    
    if (Players.closest(p -> p != null && p.getComposite().getAppearance()[1] == 1337) != null) {
    			return State.RANGED;
    		}

     

    Leaning more towards this: 

    Players.closest(p -> p != null && p.getComposite().getAppearance()[1] == 1337).exists()
    Link to comment
    Share on other sites

    1 minute ago, LostVirt said:

    Leaning more towards this: 

    
    Players.closest(p -> p != null && p.getComposite().getAppearance()[1] == 1337).exists()

    THANK YOU SO MUCH it seems to work in code, but i dont have an account to test it on right now, so i'll have to do it later, looks extremely promising though. And while we're talking, do you know a way to see another player's hp? (the same one you're finding the gear of) I've looked through a ton of forum posts but I couldn't really find anything

    Link to comment
    Share on other sites

    Well depends how you want to find the other player..

    Seems like the way you got their exact hitpoints before has been deprecated and could only find health precent.
    I guess you could do something like this:

    Player enemy = Players.closest(p -> p != null && p.getComposite().getAppearance()[1] == 1337);
    int health = enemy.getHealthPercent();
    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.