Log in

View Full Version : Need a private walking function made.



laakerules
04-30-2012, 02:54 AM
Dont have time to do it and everything i have tried has failed.


function WalkPath(Path: TPointArray): boolean;
var
I, H, T, D: integer;
P, MM, A, B: TPoint;
begin
H := High(Path);
T := GetSystemTime + 20000 + Random(5000);

while (not Result) and (GetSystemTime < T) do
begin
RunEnergy(20);

P := SPS_GetMyPos;
for I := H downto 0 do
begin
A := Sps_GetMyPos;
MM.X := MMCX + Path[I].X - P.X;
MM.Y := MMCY + Path[I].Y - P.Y;

D := Distance(MM.X, MM.Y, MMCX, MMCY);

if (D < 10) then
break
else
if (D < 70) then
begin
if (SPS_MultiMouse) then
MultiMouse(MM.X, MM.Y, 25, 3, false)
else
Mouse(MM.X, MM.Y, 5, 5, mouse_Left);

FFlag(Integer(I <> H) * 15);
if IsMoving then
begin
repeat
Wait(50);
until Not isMoving;
end;

B := Sps_GetMyPos;
if (Distance(A.X, A.Y, B.X, B.Y) < 6) then Exit;
If UInFight or BlueDead then Exit;


T := getSystemTime + 20000 + Random(1000);
Break;
end;
end;

Result := (I = H);
end;
end;

Ripped straight off of the sps to add what i needed, this is what i needed added to a function that will run through points and walk it but check
if (Distance(A.X, A.Y, B.X, B.Y) < 6) then Exit;
If UInFight or BlueDead then Exit;

inbeetween each point, and points a and b are described in the upper code.

Brandon
04-30-2012, 03:15 AM
Put your check inbetwen the "If is moving then Repeat... Your check here... Until..."

laakerules
05-04-2012, 11:28 PM
Ya, but as of rite now it doesnt walk, even just someone making a function that loops through a sps path and does points or something idk.