Quote:
Originally Posted by denominator
I have no idea exactly how to add/use this code
Code:
public static bool VerificaDistancia(Client C, ushort toX, ushort toY)
{
int distan = Calculations.Distance(C.X, C.Y, toX, toY);
if (distan > 10)
{
Chat(C, "Distancia > 10", 2008);
ushort novoX = C.X;
ushort novoY = C.Y; ////novoY = newY
if (C.X < toX)
novoX = (ushort)(novoX + 3);
else
novoX = (ushort)(novoX - 3);
if (C.Y < toY)
novoY = (ushort)(novoY + 3);
else
novoY = (ushort)(novoY - 3);
if (C.LastJump.AddMilliseconds(C.JumpSpeed) < DateTime.Now)
{
if (Calculations.ValidDmap(C.StaticMap, novoX, novoY))
{
Packets.CliJump(novoX, novoY, 156, C);
Packets.Jump(C, novoX, novoY, 137);
C.X = novoX;
C.Y = novoY;
C.UpdatedX = C.X;
C.UpdatedY = C.Y;
Calculations.UpdateLocal(C);
C.LastJump = DateTime.Now;
}
else
{
Chat(C, "Posicao do mapa inválida! Fazendo Random Jump!", 2008);
RandomJump(C);
}
}
return true;
}
else
return false;
}
I have it saved with no errors but how do I use /record because when I type /record and jump to a spot then another spot etc then hit /record to stop recording then hit /hunt my char just stands there and does not move in the path that I tried to set???
|
No, sorry. This code is for you come more near, look... the code..
Quote:
if (distan > 10)
ushort novoX = C.X; //novoX = newX
ushort novoY = C.Y;
if (C.X < toX)
novoX = (ushort)(novoX + 3);
else
novoX = (ushort)(novoX - 3);
if (C.Y < toY)
novoY = (ushort)(novoY + 3);
else
novoY = (ushort)(novoY - 3);
|
this will make u come to your position... if you are far from then and come jumping 3by3 to the position... its like a code to see if your jump will be so long, then he comes just jumping 3by3 until come more near to can jump without dc...
Path Record Idea:
Will show you how i made the path record, im actually dont using the random jump fuction coz i dont like cant control where my char is going...
Let's see the idea first:
1. You hit "/record"
2. then you jump in this coords
Quote:
1. 10, 10
2. 20, 20
3. 30, 30
4. 40, 40
5. 50, 50
|
3. you hit "/record" now, then the alchemy save it for you on the array of path...
What to do now? we are in the 5. coords(the 50, 50)
we need to start jumping back from the end to the begin...(5.;4.;3.;2.;1.).
let's get the last coord of the path that we recorded...
Quote:
|
C.ActivePath.Points.Count // this show us how many points we have on the activepath
|
we need to get the last point in the record first, but it's an array then we need an Index to get the point of activepath...
Quote:
int pathIndex;
pathIndex = C.ActivePath.Points.Count - 1;
|
" - 1" coz we have 5 counts but the index start from "0" the index of the coords will be (1. 10,10) = 0 ; (2. 20,20) = 1 ........ (5. 50,50) = 4 in my case pathIndex will be 4;
Now i get this last coord that i recorded the (50,50) using the index to find in the array of pathpoints..
Quote:
ushort pathX;
ushort pathY;
pathX = C.ActivePath.Points[pathIndex].Coord.X;
pathY = C.ActivePath.Points[pathIndex].Coord.Y;
|
now i jump in this pathX, pathY see if has some closestMonster, if no, then i dec the pathIndex
Quote:
until i be in the pathIndex = 0, then i back jumping until the pathIndex be = ActivePath.Points.Count - 1;
try to work now... try to do you logic...
keep in mind that you need to jump in the path...see if there is a monster near you, if has, you need to jump to him, attack him, then back to the last path that you was...
if you dont get it working... or get so many difficults i can post my code... but it's not good right now... it's more complicated that need to be... but worked for 3H in my warrior without get DC or stop...