kamilo 7 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
Defiled 424 Posted April 3, 2020 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..
kamilo 7 Author 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
Defiled 424 Posted April 4, 2020 4 hours ago, kamilo said: tysm No Problem, Good luck with your script!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.