So how do you calculate the ingame distance to mob's in delphi ?
Distance between two points Tutorial: [Only registered and activated users can see links. Click Here To Register...]
{$REGION 'Distance stuff'}
function TGrindThread.Distance(P1, P2, Q1, Q2: single): single;
begin
result := sqrt(Power(P1 - Q1, 2) + Power(P2 - Q2, 2))
end;
function TGrindThread.distanceline(l1, l2: Single): Single;
begin
result := Abs(l1 - l2);
end;
{$ENDREGION}
First without power, then see Error on - Numbers.Quote:
Distance:=Round(Sqrt( power((CHAR_X-MOB_X),2)+ power((CHAR_Y-MOB_Y),2 ) ));