Results 1 to 7 of 7

Thread: Need help with fighting script

  1. #1
    Join Date
    Oct 2012
    Location
    Porto, Portugal
    Posts
    218
    Mentioned
    0 Post(s)
    Quoted
    42 Post(s)

    Question Need help with fighting script

    Hi. Im currently making a fighting script and I want to know how can I know if the monster is dead so I can wait a bit and then click when he respawns. I have read the fighting includes but didn't get much of it. If anyone could post a code to do that I would appreciate. Thanks

  2. #2
    Join Date
    Feb 2012
    Posts
    390
    Mentioned
    2 Post(s)
    Quoted
    14 Post(s)

    Default

    Think on this
    Code:
    (*
    srl_InFight
    ~~~~~~~~~~~
    
    .. code-block:: pascal
    
        function srl_InFight: Boolean;
    
    Checks whether player currently is in a fight, using mainscreen
    HP bar presence detection. Returns True if Player's HP bar is detected.
    Idea for improvement: Also check using PixelShift(); to see whether Player
    is performing fighting animations to further improve the certainty of results.
    
    .. note::
    
        by Narcle
    
    Example:
    
    .. code-block:: pascal
    
        while srl_InFight do
        begin
          CheckHP;
          EatFood;
        end;
    
    *)

  3. #3
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    You're specifically looking at when a monster is dead?
    Check out SRL_InFight and maybe use a while do loop.

    Simba Code:
    While SRL_InFight do
    begin
      Wait(100);
      CheckHP;
      if HP < 20 then
        Eat;
    end;

    Obviously some of those are just example procedure and don't exist, but you get my drift..

    Also, if there is only 1 of that NPC that you are fighting you could try having a look at the minimap NPC dots, there's a function in the include for counting them IIRC.

  4. #4
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    For me, SRL_Infight takes a few seconds to realize that it's in a fight, but seems to detect not being in a fight almost instantly, so you might want a slightly longer wait (unless you expect the monster to die in a few seconds anyway.)

  5. #5
    Join Date
    Jan 2012
    Posts
    713
    Mentioned
    3 Post(s)
    Quoted
    9 Post(s)

    Default

    SRL_InFight has always been inaccurate for me. Try this by putonnajonny is pretty accurate. http://villavu.com/forum/showthread.php?t=79633

  6. #6
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    ^this would fix everything

  7. #7
    Join Date
    Oct 2012
    Location
    Porto, Portugal
    Posts
    218
    Mentioned
    0 Post(s)
    Quoted
    42 Post(s)

    Default

    Thanks

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
  •