Likeyou343 0 Posted August 17, 2017 I have this kind of code here and for some reason the npc interaction doesn't work. NPC npc = getNpcs().closest(new String[]{"Name1", "Name2"}); if (npc != null) { // npc.toString() outputs Name1: [id] // code reaches up till here npc.interact("Trade"); // code does not reach here } I tried making getNpcs().closest("Name1") only but it still does not work. Code doesn't go further if I try to do npc.isOnScreen() as well Edit: randomly started working. Did not change anything
distraction 61 Posted August 17, 2017 I have this kind of code here and for some reason the npc interaction doesn't work. NPC npc = getNpcs().closest(new String[]{"Name1", "Name2"}); if (npc != null) { // npc.toString() outputs Name1: [id] // code reaches up till here npc.interact("Trade"); // code does not reach here } I tried making getNpcs().closest("Name1") only but it still does not work. Code doesn't go further if I try to do npc.isOnScreen() as well Do any npcs actually have a "trade" option? It sounds like you may be trying to trade with a player. If that is the case, you should use `getPlayers()` and not `getNpcs()`.
Likeyou343 0 Author Posted August 17, 2017 Do any npcs actually have a "trade" option? It sounds like you may be trying to trade with a player. If that is the case, you should use `getPlayers()` and not `getNpcs()`. It is npcs with trade option
DefCon 121 Posted August 17, 2017 Do any npcs actually have a "trade" option? It sounds like you may be trying to trade with a player. If that is the case, you should use `getPlayers()` and not `getNpcs()`. According to his code commentation, he has successfully found the Entity that he's looking for. So the getNpcs() method looks all good. @OP: Did you get an error message in the client? If not, run the client in debug mode so we can see any errors through the cmd prompt.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.