Results 1 to 6 of 6

Thread: Npc detection help

  1. #1
    Join Date
    Jan 2012
    Location
    in a galaxy far far away
    Posts
    371
    Mentioned
    3 Post(s)
    Quoted
    48 Post(s)

    Default Npc detection help

    How would I go about more accurately finding an npc then being able to tell if it is in combat. Want to keep current scrit private atm.will pm only
    >:)

  2. #2
    Join Date
    Feb 2013
    Location
    Narnia
    Posts
    615
    Mentioned
    8 Post(s)
    Quoted
    252 Post(s)

    Default

    Use a color finding function based off of the head of the NPC and then create a static search box for the health bar "y" amount of pixels above the location of the color found on the NPC's head.

    Might run into problems in populated combat areas.

    View my OSR Script Repository!


    Botted to max
    Guides: How to Report Bugs to the Scripter
    ~~~~ Moved to Java. Currently Lurking ~~~~

  3. #3
    Join Date
    Jan 2012
    Location
    in a galaxy far far away
    Posts
    371
    Mentioned
    3 Post(s)
    Quoted
    48 Post(s)

    Default

    Quote Originally Posted by Sk1nyNerd View Post
    Use a color finding function based off of the head of the NPC and then create a static search box for the health bar "y" amount of pixels above the location of the color found on the NPC's head.

    Might run into problems in populated combat areas.
    sounds good, but have no idea how to look for a static box from the position of my mouse after it found the npc/color.
    >:)

  4. #4
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default

    Quote Originally Posted by chief herb View Post
    sounds good, but have no idea how to look for a static box from the position of my mouse after it found the npc/color.
    GetMousePos(var x, y: integer);
    http://docs.villavu.com/simba/script...dkeyboard.html
    Will return mouse position

    But you'd be better off just using using the variables the position was stored in using the findColor function:
    FindColor(var x, y: Integer; col, x1, y1, x2, y2: Integer)
    http://docs.villavu.com/simba/scriptref/color.html

    Then you would just use the findColors within a specific region relating to the point where you found the color.
    Because health bars are typically above the NPCs head, you would just search for health bar colors (green/red) at a Y distance downwards of color found.

    So If your color of the npc is found at 100, 100, you would search the NPCs health bar at around 90, 80 - 110, 90.
    If found, you know that NPC is in combat.

  5. #5
    Join Date
    Jan 2012
    Location
    in a galaxy far far away
    Posts
    371
    Mentioned
    3 Post(s)
    Quoted
    48 Post(s)

    Default

    Quote Originally Posted by Aspect View Post
    GetMousePos(var x, y: integer);
    http://docs.villavu.com/simba/script...dkeyboard.html
    Will return mouse position

    But you'd be better off just using using the variables the position was stored in using the findColor function:
    FindColor(var x, y: Integer; col, x1, y1, x2, y2: Integer)
    http://docs.villavu.com/simba/scriptref/color.html

    Then you would just use the findColors within a specific region relating to the point where you found the color.
    Because health bars are typically above the NPCs head, you would just search for health bar colors (green/red) at a Y distance downwards of color found.

    So If your color of the npc is found at 100, 100, you would search the NPCs health bar at around 90, 80 - 110, 90.
    If found, you know that NPC is in combat.
    ok i was thinking it'd be something like this. but how do i go about the procedure knowing where the "100(x),100(y)" is at after finding it, and then searching from the x, y? do is assign my hp bar search co ords as x1 -10 y1 -10 x2 +10 y2 +10?
    >:)

  6. #6
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default

    Yes, you are on the right track.
    FindColor will store the color position(if found) in the x y value you passed to it. You can then use those for parameters for your next color search functions area

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
  •