I need to stop attacking the character for a while when clicking to walk.
I tried two ways.
At first he does not attack until you finish walking, that's bad for archer, in the second he stops attacking and not attacking more, you can tell me why?
I'm trying to make a server with high status, please help me in this.
What area will the forum for these questions, I am newbie in the forum.
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.
Question
Ironmaiden2012
Hello, can you help me with a problem?
I need to stop attacking the character for a while when clicking to walk.
I tried two ways.
At first he does not attack until you finish walking, that's bad for archer, in the second he stops attacking and not attacking more, you can tell me why?
I'm trying to make a server with high status, please help me in this.
What area will the forum for these questions, I am newbie in the forum.
Sorry my english and thanks for reading.
(Check One)
Index: head-src/com/l2jfrozen/gameserver/model/L2Character.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/L2Character.java (revisão 65)
+++ head-src/com/l2jfrozen/gameserver/model/L2Character.java (cópia de trabalho)
@@ -932,7 +932,13 @@
if(target == null)
return;
-
+
+ if(isMoving())
+ {
+ sendPacket(ActionFailed.STATIC_PACKET);
+ return;
+ }
+
if(isAlikeDead())
{
// If L2PcInstance is dead or the target is dead, the action is stoped
(Check Two)
Index: head-src/com/l2jfrozen/gameserver/model/L2Character.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/L2Character.java (revisão 65)
+++ head-src/com/l2jfrozen/gameserver/model/L2Character.java (cópia de trabalho)
@@ -219,6 +219,10 @@
private boolean _blocked;
private boolean _meditated;
+
+ /**MY Variables*/
+ private boolean moved = false;
+
/**
* Zone system<br>
* x^2 or x*x
@@ -932,7 +936,13 @@
if(target == null)
return;
-
+
+ if(getMoved())
+ {
+ sendPacket(ActionFailed.STATIC_PACKET);
+ return;
+ }
+
if(isAlikeDead())
{
// If L2PcInstance is dead or the target is dead, the action is stoped
@@ -9589,4 +9599,14 @@
{
return _isBuffProtected;
}
+
+ public void setMoved(boolean x)
+ {
+ moved = x;
+ }
+
+ public boolean getMoved()
+ {
+ return moved;
+ }
}
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/MoveBackwardToLocation.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/MoveBackwardToLocation.java (revisão 65)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/MoveBackwardToLocation.java (cópia de trabalho)
@@ -24,6 +24,7 @@
import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
import com.l2jfrozen.gameserver.network.serverpackets.StopMove;
import com.l2jfrozen.gameserver.thread.TaskPriority;
+import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
import com.l2jfrozen.gameserver.util.IllegalPlayerAction;
import com.l2jfrozen.gameserver.util.Util;
@@ -115,22 +116,49 @@
// Can't move if character is confused, or trying to move a huge distance
if (activeChar.isOutOfControl() || dx * dx + dy * dy > 98010000) // 9900*9900
{
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
+
+
+ if (activeChar.isInCombat())
+ {
+ activeChar.setMoved(true);
+ ThreadPoolManager.getInstance().scheduleGeneral(new protection(activeChar), 2000);//2 sec
+ }
+
+
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(_targetX, _targetY, _targetZ, 0));
}
}
@Override
public String getType()
{
return "[C] 01 MoveBackwardToLoc";
}
+
+ class protection implements Runnable
+ {
+ L2PcInstance activeChar;
+ public protection(L2PcInstance player)
+ {
+ activeChar = player;
+ }
+ @Override
+ public void run()
+ {
+ activeChar.setMoved(false);
+ }
+ }
+
}
1 answer to this question
Recommended Posts
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.