L2JMobius

High Five Targets do not match

kinghanker · 3 · 2484

Offline kinghanker

  • Knight
  • ***
    • Posts: 64
High Five Free

How to make:

- Take the target and send it to attack using a skill, rush for example
- Before the character gets close, switch to a very distant target

in the video below explains it better:



It works for characters and monsters. How can I solve this?


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16148
Try this.
Code: [Select]
Index: java/org/l2jmobius/gameserver/ai/PlayerAI.java
===================================================================
--- java/org/l2jmobius/gameserver/ai/PlayerAI.java (revision 9405)
+++ java/org/l2jmobius/gameserver/ai/PlayerAI.java (working copy)
@@ -298,6 +298,16 @@
  clientStopMoving(null);
  }
 
+ // Check if target has changed.
+ final WorldObject currentTarget = _actor.getTarget();
+ if ((currentTarget != target) && (currentTarget != null) && (target != null))
+ {
+ _actor.setTarget(target);
+ _actor.doCast(_skill);
+ _actor.setTarget(currentTarget);
+ return;
+ }
+
  _actor.doCast(_skill);
  }