Jump to content

Question

Posted (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 by DzStunk

10 answers to this question

Recommended Posts

  • 0
Posted
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
Posted
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
Posted (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 by Amn3sia
  • 0
Posted
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
Posted (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 by An4rchy
  • 0
Posted (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 by Amn3sia
  • 0
Posted
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).

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Deadpool Skin for All Races Lineage 2 A custom Deadpool skin is now available for all races and classes in Lineage 2. Fully compatible with any client version: Interlude, High Five, Classic, and others This is perfect for private servers, custom events, or just adding fun to your gameplay. Available now at a very attractive price.    
    • Hello,    I have lost my System from my Lineage 2 server, my server is a bit custom and I have no more system file.   I am searching for somebody who can recreate my full system, I have all the xml files necessary I just do not know how to make it work.   Start price for this is 100 euro but negociable, I need a bit more help with some more questions as well, I need somebody who knows a lot about L2 server custom creation and who can answer a few questions, I will pay for the service ofc.   Please leave ur Discord informations " if is allowed " or send me a pm with ur credentials and I will contact you asap.     Kind Regards. Later Edit :   Maybe I have bad expressed myself, I need the creation of a PATCH for my Freya CT2.5 version.   The starting price for this is 100€ but negociable, extra help will be extra counted and payed acordingly.    I am a very generous guy, do not be shy and contact me if you can make it happend.   Ty, Alex
    • We are certainly not an ambulance, but we will definitely cure you of blacklists and empty pockets. Live freely with SX! Each of you will receive a trial version of SX to familiarize yourself with the product, all you have to do is post in this thread
×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock