DzStunk Posted March 6, 2023 Posted March 6, 2023 (edited) I would like to know which method I use for a player not to catch the target of a monster that is being attacked, if I use isInCombat the player does not hit the target when he is in combat use l2jfrozen 1132 Edited March 6, 2023 by DzStunk
0 DzStunk Posted March 6, 2023 Author Posted March 6, 2023 1 hour ago, Zake said: You can probably use the aggrolist of the monster I created a debug on the list and had no success
0 Zake Posted March 6, 2023 Posted March 6, 2023 2 minutes ago, DzStunk said: I created a debug on the list and had no success If someone has already attacked the monster, he should be on it's aggrolist. If he's not (well right click -> delete project) but you can also check if there is an attackedBy list.
0 DzStunk Posted March 6, 2023 Author Posted March 6, 2023 34 minutes ago, Zake said: If someone has already attacked the monster, he should be on it's aggrolist. If he's not (well right click -> delete project) but you can also check if there is an attackedBy list. Is there an example of how to do it somewhere?
0 Katara512 Posted March 6, 2023 Posted March 6, 2023 (edited) 24 minutes ago, DzStunk said: Is there an example of how to do it somewhere? based on Zake's reply, assume that the target is an instance of MonsterInstance so you can simply make a check like if (!target.getAggroList().isEmpty()) continue; Edited March 6, 2023 by Amn3sia
0 DzStunk Posted March 6, 2023 Author Posted March 6, 2023 6 minutes ago, Amn3sia said: based on Zake's reply, assume that the target is an instance of MonsterInstance so you can simply make a check like if (!target.getAggroList().isEmpty()) continue; this verification will not work because the player himself will be on the list and will not attack.
0 An4rchy Posted March 7, 2023 Posted March 7, 2023 (edited) From what I understand you're referring to this 'auto-target' thing that exists in l2, when you don't have a target and a monster attacks you, you automatically target this monster. Unfortunately for you, this is client-side I'm pretty sure and it sends Action packet, which is the same packet the client sends when the player actually requests to target something, so there's no way to work around that server-side. You could try to predict if the player made this target call or it was automatic, but it can't be 100% accurate and it might feel buggy. Maybe I misunderstood what you meant though about the auto-target. Edited March 7, 2023 by An4rchy
0 Katara512 Posted March 8, 2023 Posted March 8, 2023 (edited) On 3/6/2023 at 11:26 PM, DzStunk said: this verification will not work because the player himself will be on the list and will not attack. if (!target.getAggroList().isEmpty() && !target.getAggroList().containsKey(player)) continue; Edited March 8, 2023 by Amn3sia
0 Tryskell Posted March 12, 2023 Posted March 12, 2023 As said Anarchy, it's client-sided and can't be controlled (from what I know about it and from what I understood of your request). In a custom use, getAggroList()#containsKey would be your solution if you want the check to be CURRENT, and attackedBy to be both PAST and CURRENT (even with complete loss of aggro).
Question
DzStunk
I would like to know which method I use for a player not to catch the target of a monster that is being attacked, if I use isInCombat the player does not hit the target when he is in combat
use l2jfrozen 1132
Edited by DzStunk10 answers to this question
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