Results 1 to 4 of 4

Thread: Monster in combat detection?

  1. #1
    Join Date
    Apr 2013
    Location
    USA
    Posts
    58
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default Monster in combat detection?

    How would it be done? I was thinking of having the script check if there's an hp bar above the monster but not entirely sure on how to get it working.

    This is where I'd want to implement it.
    Code:
        begin
          if not FindObjEx(X, Y, ['ttak', 'iant', 'rypt', 'at'], [8358276, 6975078, 8358271, 6058844, 7244398, 6190685, 7371120, 9278344, 5136973, 4738632], 3, 50, MSX1, MSY1, MSX2, MSY2) then
          begin
            findMonster;
          end
        end;

  2. #2
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    I suggest looking into TPAs and ATPAs, with them it can pretty much find the monster in a little box, and within that box you could look for a HP bar.


    http://villavu.com/forum/showthread.php?t=92301

    http://villavu.com/forum/showthread.php?t=49067

  3. #3
    Join Date
    Apr 2013
    Location
    USA
    Posts
    58
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default

    Quote Originally Posted by Officer Barbrady View Post
    I suggest looking into TPAs and ATPAs, with them it can pretty much find the monster in a little box, and within that box you could look for a HP bar.


    http://villavu.com/forum/showthread.php?t=92301

    http://villavu.com/forum/showthread.php?t=49067
    Thank you very much, just want I need!

  4. #4
    Join Date
    Sep 2008
    Posts
    754
    Mentioned
    8 Post(s)
    Quoted
    275 Post(s)

    Default

    Once you grasp TPA'S, look at this topic, many solutions have been offered:

    http://villavu.com/forum/showthread.php?t=102670

    my favorite is getting the bound of the ATPA then increasing its size just a bit so it, and if it doesn't find the HP bar Red/Green Color and Blue/Red splat hit colors inside the box, it will attack, else it will search again for another monster, you make the bounds over the monster :-).

    Works quiet well on large monsters, but really hard for a monster like Tz-Kih.

    Also you can do a timer command fail safe, setup a Timer:integer var and have it reset every-time the script does a red click (attack) then the loop cant repeat the attack procedure if the time running for the script is shorter than the time to re-attack (like say your running to a monster and need it to click only once not 5 times while your running towards it, this way it clicks once and you dont need to put any wait time/sleep time after click, your script continues to cycle through the mainloop and fail safes and random detection :-).

    Something like this:

    Simba Code:
    program TestTimers;

    {$I SRL-OSR/SRL.Simba}


    var
    AttackTimer:integer;

    const
    AttackTime1 = 5000;
    AttackTime2 = 7000;


    procedure Attacktiming;
    begin
    AttackTimer := GetTimeRunning + RandomRange(AttackTime1,AttackTime2);
    end;



    Function killit:boolean;
    begin
    {script here
    {and here...
    { and so on...
    { at the end:}


    if didclick(true,2000) then
    begin
    Attacktiming;      // this resets your Timer, adds up 5 seconds or whatever time

    result := true;    // you want it to add and won't repeat attack till 5 seconds
    exit;              // have passed.. Above this you should have a Tbox as ATPA
    end;               // or TPA Bounds and increase about 12-17 pixels above it
                       // So if it finds Hp Bar colors or Splat Colors it will not
                       // attack the monster again nor reset the timer. I suggest
                       // ATPA Bounds or look into what ShatterHand posted.



    procedure AttackMonster;
    begin

    if (not(loggedin)) then exit;

    if (GetTimeRunning >= AttackTimer) then
    begin
    Killit;
    end;
    end;


    begin
    setupsrl;
    AttackMonster;
    end.

    So that way it starts with your timer as Zero, once it attacks it will add 5 seconds (or whatever you decide) onto the timer, so that way it won't repeat attacks for at least 5 seconds (or whatever time you need).
    I think its better this way than adding Sleep/Wait times after click, at least its working for me .

    I recommend you start with something simple as TPA bounds then increase box size around it to include hp bar/splat hits colors

    I.E these colors:

    Color: 255, Tol: 3.
    Color: 192, Tol 3.
    Color: 65280, tol: 3.
    Color: 16777215, tol 3.


    You can also use DTM'S or merging some TPA's and excluding others (look at shatterhand post, but only do so once you fully grasp tpa's), debug all the stuff while you do it ;0

    Good luck!

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
  •