Dorkinator 64 Share Posted June 21, 2017 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 More sharing options...
Hashtag 8670 Share Posted June 21, 2017 Great snippet =). Link to comment Share on other sites More sharing options...
Manly 879 Share Posted July 2, 2017 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 More sharing options...
TTB 0 Share Posted October 2, 2020 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 More sharing options...
LostVirt 106 Share Posted October 2, 2020 Not sure how to check equipment but probably something like this Players.closest(p -> p != null && p.getComposite().getAppearance()[1] == 1337); Link to comment Share on other sites More sharing options...
TTB 0 Share Posted October 2, 2020 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 More sharing options...
LostVirt 106 Share Posted October 2, 2020 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 More sharing options...
LostVirt 106 Share Posted October 2, 2020 i mean there's multiple ways to do it depending on how you want to use it Link to comment Share on other sites More sharing options...
TTB 0 Share Posted October 2, 2020 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 More sharing options...
LostVirt 106 Share Posted October 2, 2020 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.