Results 1 to 14 of 14

Thread: ~Reflection Yak Killer Help

  1. #1
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Question ~Reflection Yak Killer Help

    SCAR Code:
    function Fight : Boolean;
    var
      x, y, i, t1 : Integer;
      NPC : array of TNPC;
     
    begin
      NPC := SortNPCs(GetNPCs);
      for i := 0 to High(NPC) do
      begin
        if (NPC[i].Name = 'Yak') and (not NPC[i].InFight) then
        begin
          x := TileToMS(NPC[i].Tile, 20).x;
          y := TileToMS(NPC[i].Tile, 20).y;
          if FindColorTolerance(x, y, 4673114, x - 40, y - 40, x + 40, y + 40, 7) then
          begin
            if MouseCross(x, y, 0, 0, True) then
            begin
              Result := True;
              t1 := GetSystemTime;
              while (not FightAt(TileToMS(NPC[i].Tile, 20).x, TileToMS(NPC[i].Tile, 20).y)) or ((GetSystemTime - t1) < 6000) do Wait(1000); // [Runtime Error] : Out of Global Vars range in line 117 in script C:\Users\Lance\Desktop\My Scripting Projects\Reflection\First Reflection Script.scar

              repeat
                ClearDebug;
                Writeln('Fighting ' + NPC[i].Name + ' - HP: ' + IntToStr(NPC[i].HPRatio) + '%'); // is writing that the yak is always at 0% HP.. can anyone fix?
              //  Antiban;
                wait(1000);
              until(not FightAt(TileToMS(NPC[i].Tile, 20).x, TileToMS(NPC[i].Tile, 20).y));
            end;
            FFlag(2);
            Wait(500);
            Exit;
          end;
        end;
      end;
    end;

    Hey having some problems with the above function, ima nub with reflection =/
    (you will have to scroll to the right to see the //Error)
    Lance. Da. Pants.

  2. #2
    Join Date
    Oct 2007
    Location
    http://ushort.us/oqmd65
    Posts
    2,605
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I do visit every 2-6 months

  3. #3
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Zasz View Post
    ive already looked over your tutorial :P but i still dont understand what im doing wrong..
    Lance. Da. Pants.

  4. #4
    Join Date
    Oct 2007
    Location
    http://ushort.us/oqmd65
    Posts
    2,605
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Use getme for a tme, and do while (yourvariable).infight do wait

    Guess thats players section lol
    I do visit every 2-6 months

  5. #5
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    NPC[i].InFight for the enemy and GetMe.InFight only works if you are being attacked, ive already tried them. offten something gets in the way between you and the yaks, stoping them from attacking you back, so .InFight wont work.
    SCAR Code:
    FightAt(TileToMS(NPC[i].Tile, 20).x, TileToMS(NPC[i].Tile, 20).y)
    This checks if there is a HP bar at the coordinates of NPC[i], and ive already tested it, it works 100%.

    lower in the script on this line:
    SCAR Code:
    until(not FightAt(TileToMS(NPC[i].Tile, 20).x, TileToMS(NPC[i].Tile, 20).y));
    it works purfectly.. but in the
    SCAR Code:
    while not FightAt(TileToMS(NPC[i].Tile, 20).x, TileToMS(NPC[i].Tile, 20).y) do
    it dosnt.

    so yeah.. im still lost :P
    Lance. Da. Pants.

  6. #6
    Join Date
    Oct 2007
    Location
    http://ushort.us/oqmd65
    Posts
    2,605
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    SCAR Code:
    If(FindFreeNPC('Yak',NPCC))then
        writeln('Found a free Yak! woot');

    ??? Me confused on what u want.
    I do visit every 2-6 months

  7. #7
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    function AreWeInteracting(var NPC: TNPC): Boolean;

    Don't know if it returns true if you're not getting attacked.

    Otherwise use the animation and if you haven't been doing an animation in some time you're not fighting.

  8. #8
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    zasz, i want a way of checking if you are fighting a yak even if they arnt attacking you back :P which InFight wont do. And i was just saying the method i came up with works, with repeat wait until (____); format but not that while ___ do wait; format. Im sorry i guess im explaining it confusingly.

    And Frt, would I be able to get the animation number of when im drawing my bow or of when the yak is makeing the getting hit animation? Ill look at the Using Animations part in zasz's tutorial.. that will probably do it
    Lance. Da. Pants.

  9. #9
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by lancerawks View Post
    zasz, i want a way of checking if you are fighting a yak even if they arnt attacking you back :P which InFight wont do. And i was just saying the method i came up with works, with repeat wait until (____); format but not that while ___ do wait; format. Im sorry i guess im explaining it confusingly.

    And Frt, would I be able to get the animation number of when im drawing my bow or of when the yak is makeing the getting hit animation? Ill look at the Using Animations part in zasz's tutorial.. that will probably do it
    Just use, isanimating? very simple boolean function. Just returns if your character is animating.

  10. #10
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by mormonman View Post
    Just use, isanimating? very simple boolean function. Just returns if your character is animating.
    Guess you meant CharacterAnimating?

  11. #11
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    CharacterAnimating works, thanks
    Lance. Da. Pants.

  12. #12
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Yes fh that is wat I meant... In my script I made my own called isanim. Test out charanimbool its handy for timeouts(waituntil)

  13. #13
    Join Date
    Dec 2008
    Location
    Québec
    Posts
    419
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    you can do this for check if any animation occur, if your getting hitted of you hit, anyway you dont do any other animation there i think so that would work great.
    SCAR Code:
    if  Function InFight: Boolean;  
    Var
    T: Integer;
    Me: TMe;
    Begin
      MarkTime(t)
      Repeat
      If Not LoggedIn Then Exit;
      Me := GetMe;
      Result := Me.Animation > 0;
      Wait(50+random(30));
    Until (Result) or (TimeFromMark(t) > 2456);
    End;
    Last edited by Phran6; 06-17-2009 at 08:06 AM.
    Formerly known as FrancisHelie

  14. #14
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    The reason your original function wasn't working was because you didn't refresh the NPC variable for the yak. You need to do that every loop iteration to achieve consistent results.
    :-)

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
  •