scriptersteve Posted February 4, 2018 Share Posted February 4, 2018 I was wondering if there is a way to find out how i am being attacked. For example, when being attacked by say a dragon, i want to be ranging it and praying mage. How can i see whether my player is fighting it in melee range or ranging range, i looked at the API on Combat and couldn't see anything. Currently, my only thought was to make a big array of 'safe' tiles and just force the bot to move to one of them. However, if the player didn't need to move and it moved anyway, i feel that would look bot-like. Anyway your feedback is appreciated. Quote Link to comment Share on other sites More sharing options...
FrostBug Posted February 4, 2018 Share Posted February 4, 2018 Players distance from the dragon? Quote Link to comment Share on other sites More sharing options...
Deceiver Posted February 4, 2018 Share Posted February 4, 2018 configs? 1 Quote Link to comment Share on other sites More sharing options...
scriptersteve Posted February 4, 2018 Author Share Posted February 4, 2018 (edited) 6 minutes ago, FrostBug said: Players distance from the dragon? I thought of that, was thinking about brutal blues/reds script and you can be 'safespotting' one whilst standing next to another. https://gyazo.com/0f6f6c62c23552d51b6a97c90fe0d089 4 minutes ago, Deceiver said: configs? not sure what you mean? Edited February 4, 2018 by scriptersteve Quote Link to comment Share on other sites More sharing options...
FrostBug Posted February 4, 2018 Share Posted February 4, 2018 2 minutes ago, scriptersteve said: I thought of that, was thinking about brutal blues/reds script and you can be 'safespotting' one whilst standing next to another. https://gyazo.com/0f6f6c62c23552d51b6a97c90fe0d089 not sure what you mean? But the one next to you is not attacking you? Then it's fine innit Quote Link to comment Share on other sites More sharing options...
vperez0728 Posted February 4, 2018 Share Posted February 4, 2018 as long as one is hitting you back the other dragon near you cant attack you. just make sure youre out of its melee range. once you kill it move away from the other dragon and attack it Quote Link to comment Share on other sites More sharing options...
scriptersteve Posted February 4, 2018 Author Share Posted February 4, 2018 12 minutes ago, FrostBug said: But the one next to you is not attacking you? Then it's fine innit ah makes sense cheers Quote Link to comment Share on other sites More sharing options...
Deceiver Posted February 4, 2018 Share Posted February 4, 2018 34 minutes ago, scriptersteve said: How can i see whether my player is fighting it in melee range or ranging range u can get combat styles by configs, or just get the current weapon == blowpipe/crossbow, attackstyle = ranged Quote Link to comment Share on other sites More sharing options...
FrostBug Posted February 4, 2018 Share Posted February 4, 2018 (edited) 2 minutes ago, Deceiver said: u can get combat styles by configs, or just get the current weapon == blowpipe/crossbow, attackstyle = ranged He's always using a ranged weapon though. What he asked is what the dragon is using Edited February 4, 2018 by FrostBug 2 Quote Link to comment Share on other sites More sharing options...
Deceiver Posted February 4, 2018 Share Posted February 4, 2018 19 minutes ago, FrostBug said: He's always using a ranged weapon though. What he asked is what the dragon is using o 1 Quote Link to comment Share on other sites More sharing options...
liverare Posted February 4, 2018 Share Posted February 4, 2018 final Player me = myPlayer(); // Get all green dragons that are 'locked' on me List<NPC> greenDragonsFocusingOnMe = npcs.getAll().stream() .filter(npc -> me.equals(npc.getInteracting())) .filter(npc -> npc.getName().equals("Green dragon")) .collect(Collectors.toList()); // Get the green dragon I'm locked on NPC greenDragonsImFocusedOn = greenDragonsFocusingOnMe.stream() .filter(npc -> npc.equals(me.getInteracting())) .findFirst() .orElse(null); if (greenDragonsFocusingOnMe != null && !greenDragonsFocusingOnMe.isEmpty()) { if (greenDragonsImFocusedOn != null) { // wait for dragon to die // heal if low on health } else { // pick one of those dragons that are focused on you greenDragonsImFocusedOn = greenDragonsFocusingOnMe.get(0); if (greenDragonsImFocusedOn.interact("Attack")) { // ... do stuff } } } One thing I haven't included is the sorting of the green dragons by distance to you. I won't spoon feed you everything. 1 Quote Link to comment Share on other sites More sharing options...
Stimpack Posted February 4, 2018 Share Posted February 4, 2018 6 minutes ago, liverare said: One thing I haven't included is the sorting of the green dragons by distance to you. I won't spoon feed you everything. List<NPC> greenDragonsFocusingOnMe = npcs.getAll().stream() .filter(npc -> myPlayer().equals(npc.getInteracting())) .filter(npc -> npc.getName().equals("Green dragon")) .sorted(Comparator.comparingInt(npc -> getMap().realDistance(npc))) .collect(Collectors.toList()); 1 Quote Link to comment Share on other sites More sharing options...
scriptersteve Posted February 4, 2018 Author Share Posted February 4, 2018 lol thanks guys :D, this is going to be next weekends project after my uni deadline on Friday I do like how you always use the fancy methods, mine are about 5x longer but atleast they do also work :') Quote Link to comment Share on other sites More sharing options...