Jump to content

Mr Asshole

Members
  • Posts

    1383
  • Joined

  • Last visited

  • Feedback

    95.2%

Posts posted by Mr Asshole

  1. This won't return any NPCs that are offscreen because of NPC#isVisible(), it's probably best to remove that entirely and have the script itself run to the off-screen enemy if necessary.

     

    Also, like mentioned earlier, NPC#isUnderAttack() isn't the most reliable thing to use. Rather, I'd recommend using NPC#getFacing() to see who the NPC is interacting with. If it's you, always return that one. If it's someone else, they're in combat already, so skip it. If it's null, they're likely not in combat (idle), so chose that one.

    Updated according to your comments.

  2. Decided to share this as the get closestAttackableNPC wasn't working that great for me. Enjoy guys

    private NPC getTarget(int [] ids){
    	List<NPC> NPCs = closestNPCList(ids);
    	for (NPC i:NPCs){
    		if (i.getFacing() == null && !i.isAnimating()){
    			return i;
    		}
    		}
    		
    	
    	return null;
    	}
    
×
×
  • Create New...