kamilo 7 Share Posted April 3, 2020 Lets say for example i was in rev caves, is there a way to detect which player is attacking which revenant? seems complex but i feel like anythings dooable if anyone has experience with this please lmk Link to comment Share on other sites More sharing options...
Defiled 415 Share Posted April 3, 2020 (edited) Player player = getPlayers().closest(p->p!=null && p.getName().equalsIgnoreCase("playerName")); if(player != null) { if(player.isInCombat()) { Character npcInteractingWithPlayer = player.getInteractingCharacter(); //then you can do whatever you want with the character.. like.. getName.. etc.. } } ^ that's how you can get the characters interacting with the player you can also call .all(); and loop through them getting all the npcs all the players in the room are interacting with like so: List<Player> players = getPlayers().all(); for(Player player : players) { if(player.isInCombat()) { Character character = player.getInteractingCharacter(); //..etc } } you can also compare the InteractingCharacter that you get from the code above with your character.. etc.. Edited April 3, 2020 by Defiled BillBurry 1 Link to comment Share on other sites More sharing options...
kamilo 7 Author Share Posted April 4, 2020 12 hours ago, Defiled said: Player player = getPlayers().closest(p->p!=null && p.getName().equalsIgnoreCase("playerName")); if(player != null) { if(player.isInCombat()) { Character npcInteractingWithPlayer = player.getInteractingCharacter(); //then you can do whatever you want with the character.. like.. getName.. etc.. } } ^ that's how you can get the characters interacting with the player you can also call .all(); and loop through them getting all the npcs all the players in the room are interacting with like so: List<Player> players = getPlayers().all(); for(Player player : players) { if(player.isInCombat()) { Character character = player.getInteractingCharacter(); //..etc } } you can also compare the InteractingCharacter that you get from the code above with your character.. etc.. tysm Link to comment Share on other sites More sharing options...
Defiled 415 Share Posted April 4, 2020 4 hours ago, kamilo said: tysm No Problem, Good luck with your script! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now