J J
2012-05-08 11:41:07
Hi
I've finally worked out an idea that will provide the most accurate walking for the script I'm working on (GOP). I need to walk to orbs, and once orbs are found the script must walk back to the altar, while attracting the altar.
The first thing I did was making loads of Tboxes to store Tpoints in and check where the player would be roughly located. After that I made loads of BlindWalk Random Tpoints to walk back to the altar.. However I just thought of making my own SPS function to achieve the same thing.
Quite a lot of time wasted by the original idea, but yeah, that's how you learn how to script :P
So I made this function.
I could pretty much loop that until the result = true, which means that the player is near the box around the altar. After each time it should attract an orb again.
I'm looking for some suggestions though, is there any way I can make this even more accurate or better?
I've finally worked out an idea that will provide the most accurate walking for the script I'm working on (GOP). I need to walk to orbs, and once orbs are found the script must walk back to the altar, while attracting the altar.
The first thing I did was making loads of Tboxes to store Tpoints in and check where the player would be roughly located. After that I made loads of BlindWalk Random Tpoints to walk back to the altar.. However I just thought of making my own SPS function to achieve the same thing.
Quite a lot of time wasted by the original idea, but yeah, that's how you learn how to script :P
So I made this function.
// Walks from the current position to the altar taking steps of roughly 5 tiles each time \\
function SPS_RcWalk(P: TPoint): Boolean;
var
i: Integer;
M, MyPoint: TPoint;
PointsToAltar: TPointArray;
begin
M := SPS_GetMyPos;
PointsToAltar := TPABetweenPoints(Point(M.X, M.Y), Point(P.X, P.Y), 5, 2);
if Length(PointsToAltar) < 6 then
begin
WriteLn('Array length is '+IntToStr(Length(PointsToAltar))+'');
WriteLn('We are very close to our desired point, result is true');
Result:=True;
end else
begin
WriteLn('Array length is '+IntToStr(Length(PointsToAltar))+'');
i := RandomRange(3, 6);
MyPoint := PointsToAltar[i];
SPS_BlindWalk(MyPoint);
end;
end;Calculates the distance between the current location and the desired location. The desired location is a Box around the Mind Altar. I've also made a custom map for this to get the best results. I've been testing it and it works pretty well, it does what I wanted.I could pretty much loop that until the result = true, which means that the player is near the box around the altar. After each time it should attract an orb again.
I'm looking for some suggestions though, is there any way I can make this even more accurate or better?