Results 1 to 6 of 6

Thread: Any suggestions/tweaks for this function?

  1. #1
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default Any suggestions/tweaks for this function?

    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.
    Simba Code:
    // 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?

    Script source code available here: Github

  2. #2
    Join Date
    Jun 2012
    Location
    Toronto, CA
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I didn't really like how inaccurate SPS can sometimes be so I decided to try out walking by objectDTM's, and they work pretty great. It walks faster and more accurately than SPS in my own opinion.

  3. #3
    Join Date
    Sep 2010
    Location
    Azeroth
    Posts
    395
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    ive read that another good way to find your position on the mm is to use walls for angles and stuff but read on...

  4. #4
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    I don't think this part is quite right:
    Simba Code:
    WriteLn('Array length is '+IntToStr(Length(PointsToAltar))+'');
        i := RandomRange(3, 6);
        MyPoint := PointsToAltar[i];
        SPS_BlindWalk(MyPoint);

    If you are not very close to the alter at all it won't click very close to the alter, infact it probably won't click at all, I'll show you why:
    Say our current position was (60, 60) and we wanted to walk to (10, 10), a path that it could generate is:
    Simba Code:
    [(60, 60), (54, 56), (52, 52), (48, 49), (45, 44), (43, 43), (37, 39), (36, 36), (30, 30), (28, 26), (23, 24), (20, 19), (16, 18), (12, 12), (12, 11), (10, 10)]
    It would then say:
    Code:
    Array length is 16
    So it would do the else part of that if statement...
    Say "i" was assigned the value of 4, it would then put MyPoint as (45, 44) which is no where near the (10, 10) that we wanted to walk to. I think you want to do something like:
    Simba Code:
    WriteLn('Array length is '+IntToStr(Length(PointsToAltar))+'');
        i := RandomRange(high(PointsToAltar) - 3, high(PointsToAltar));
        MyPoint := PointsToAltar[i];
        SPS_BlindWalk(MyPoint);
    That way the furthest away point it could generate is (16, 18) which is 10 pixels away (2 RS Squares)

  5. #5
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default

    Thanks Jonny, but this got gravedigged yesterday (originally posted at 05-08-2012 which is 1,5 months ago). Your post explained some helpful things though but I believe I took a different approach.

    Question has been answered.

    Script source code available here: Github

  6. #6
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Closed on request

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •