mitch6024 4 Share Posted March 15, 2017 Hello all! I've been trying to find the correct method to use to find the NPC that is attacking the getLocalPlayer(). The whole reason I'm trying to locate it is to get the NPC that is attacking me and get it's Center Tile. I'm ultimately trying to then get that distance away from my character's tile. I can figure out the rest, all I need is the correct method to find the NPC that is in combat with me. I'm still a nooby scripter and have been trying different things for about 3 hours. With no luck of course, I'm posting here for help. Thanks in advance for any help! Link to comment Share on other sites More sharing options...
Eclipseop 194 Share Posted March 15, 2017 https://dreambot.org/javadocs/org/dreambot/api/wrappers/interactive/Character.html#getCharacterInteractingWithMe-- Link to comment Share on other sites More sharing options...
Kvothe 6 Share Posted March 15, 2017 if you wanna make a list List<NPC> bastards = getNpcs().all(NPC->NPC!=null && NPC.isInteracting(getLocalPlayer()) && NPC.isInCombat()) or if you want a single npc replace all with closest..etc i read the "NPC->" as "Such that" -> "get all NPCs such that" + your conditions but its called a lambda if you wanna google Link to comment Share on other sites More sharing options...
mitch6024 4 Author Share Posted March 15, 2017 https://dreambot.org/javadocs/org/dreambot/api/wrappers/interactive/Character.html#getCharacterInteractingWithMe-- That's what I thought originally but I wasn't sure because it was returning a Character instead of a NPC. Thank you for the help! if you wanna make a list List<NPC> bastards = getNpcs().all(NPC->NPC!=null && NPC.isInteracting(getLocalPlayer()) && NPC.isInCombat()) or if you want a single npc replace all with closest..etc i read the "NPC->" as "Such that" -> "get all NPCs such that" + your conditions but its called a lambda if you wanna google Yeah I just need a Single NPC. ill try both and see which one works best. Thank you! Link to comment Share on other sites More sharing options...
MrRobot 43 Share Posted March 25, 2017 //npcToFight is any npc name NPC npcX; if(getLocalPlayer().getCharacterInteractingWithMe().getName().equals(npcToFight)){ log("Attacking aggressive NPC"); npcX = (NPC)getLocalPlayer().getCharacterInteractingWithMe(); fight(npcX); //this is my custom method to fight npcs } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.