May 16, 20187 yr If there is 5 different npcs in an area with different names how can i attack the closest one?
May 16, 20187 yr NPC monsterToAttack = getNPCs().closest("Name 1", "Name 2", "Name 3", "Name 4", "Name 5"); if (monsterToAttack != null && monsterToAttack.interact()) { }
May 16, 20187 yr 17 minutes ago, Tommm39 said: NPC monsterToAttack = getNPCs().closest("Name 1", "Name 2", "Name 3", "Name 4", "Name 5"); if (monsterToAttack != null && monsterToAttack.interact()) { } small note its best to make the NPC monsterToAttack; in your class and when you use it in a method use monsterToAttack = getNPCs().closest("Name 1", "Name 2", "Name 3", "Name 4", "Name 5");
May 16, 20187 yr 8 hours ago, TheMcPker said: small note its best to make the NPC monsterToAttack; in your class and when you use it in a method use monsterToAttack = getNPCs().closest("Name 1", "Name 2", "Name 3", "Name 4", "Name 5"); +1 @Tommm39
May 17, 20187 yr On 5/16/2018 at 2:06 PM, TheMcPker said: small note its best to make the NPC monsterToAttack; in your class and when you use it in a method use monsterToAttack = getNPCs().closest("Name 1", "Name 2", "Name 3", "Name 4", "Name 5"); If you are not using the NPC outside the method, there's no reason to do so. Edited May 17, 20187 yr by Canidae
Create an account or sign in to comment