SRL Archive - Help

Need a private walking function made.


laakerules

2012-04-29 22:54:03

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

2012-04-29 23:15:32

Put your check inbetwen the "If is moving then Repeat… Your check here… Until…"

laakerules

2012-05-04 19:28:19

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.