L2JMobius

The Kamael Auto farm auto attacking from too long range

AnsS · 6 · 4863

Offline AnsS

  • Heir
  • **
    • Posts: 37
I noticed during auto farm my character is attacking from a really long range (but only sometimes, not always). The monsters was running to me, but my character is managed to auto attacking, but I should not be able to attack from that range. It happened with any type of weapon (except bow :) ).

I think I managed to fix it, but I am not sure this is the proper fix because I am new.

The change:

Code: [Select]
---
 java/org/l2jmobius/gameserver/taskmanager/AutoPlayTaskManager.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/java/org/l2jmobius/gameserver/taskmanager/AutoPlayTaskManager.java b/java/org/l2jmobius/gameserver/taskmanager/AutoPlayTaskManager.java
index dffb562..570f525 100644
--- a/java/org/l2jmobius/gameserver/taskmanager/AutoPlayTaskManager.java
+++ b/java/org/l2jmobius/gameserver/taskmanager/AutoPlayTaskManager.java
@@ -32,6 +32,8 @@ import org.l2jmobius.gameserver.model.holders.AutoFarmRangeHolder;
 import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
 import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlayDoMacro;
 
+import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_ATTACK;
+
 /**
  * @author Mobius
  */
@@ -75,7 +77,7 @@ public class AutoPlayTaskManager
  // Check if actually attacking.
  if (player.hasAI() && player.getAI().isAutoAttacking() && !player.isAttackingNow() && !player.isCastingNow())
  {
- player.doAutoAttack(monster);
+ player.getAI().setIntention(AI_INTENTION_ATTACK);
  }
  continue PLAY;
  }
--


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16010
Code: [Select]
player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, monster);


Offline AnsS

  • Heir
  • **
    • Posts: 37
Code: [Select]
player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, monster);

Its actually worked without it, what is suprising, but of course, its missed the target param, thank you!


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16010
It is a precaution in case the player selects another target.


Offline Tre

  • Vassal
  • *
    • Posts: 5
On Prelude of War, the same problem is observed and this solution works perfectly.