gorgas8 Posted December 18, 2015 Share Posted December 18, 2015 How to check if npc is within 1 tile away from me? Quote Link to comment Share on other sites More sharing options...
KEVzilla Posted December 18, 2015 Share Posted December 18, 2015 Position#distance Quote Link to comment Share on other sites More sharing options...
Explv Posted December 18, 2015 Share Posted December 18, 2015 How to check if npc is within 1 tile away from me? NPC cow = getNpcs().closest("Cow"); if(cow.getPosition().distance(myPosition()) <= 1) // do something 1 Quote Link to comment Share on other sites More sharing options...
Chris Posted December 18, 2015 Share Posted December 18, 2015 NPC cow = getNpcs().closest("Cow"); if(cow.getPosition().distance(myPosition()) <= 1) // do something Wouldn't you need to have the get position function on your player? Quote Link to comment Share on other sites More sharing options...
Explv Posted December 18, 2015 Share Posted December 18, 2015 (edited) Wouldn't you need to have the get position function on your player? myPosition() Just does: myPlayer().getPosition() Decompiled myPosition() declaration: Edited December 18, 2015 by Explv Quote Link to comment Share on other sites More sharing options...
Chicken Wing Posted December 18, 2015 Share Posted December 18, 2015 myPosition() Just does: myPlayer().getPosition() Decompiled myPosition() declaration: What ide skin is that? Quote Link to comment Share on other sites More sharing options...
Explv Posted December 18, 2015 Share Posted December 18, 2015 What ide skin is that? Intellij IDEA Darcula Theme Quote Link to comment Share on other sites More sharing options...
Chicken Wing Posted December 18, 2015 Share Posted December 18, 2015 Intellij IDEA Darcula Theme Ah, I thought it was that but it looked different Quote Link to comment Share on other sites More sharing options...
Joseph Posted December 18, 2015 Share Posted December 18, 2015 getMap().realDistance(cow.getPosition()); getMap().distance(cow.getPosition()); 1 Quote Link to comment Share on other sites More sharing options...
gorgas8 Posted December 20, 2015 Author Share Posted December 20, 2015 NPC cow = getNpcs().closest("Cow"); if(cow.getPosition().distance(myPosition()) <= 1) // do something This is perfect. Big thanks! Quote Link to comment Share on other sites More sharing options...