Results 1 to 4 of 4

Thread: Looting Function

  1. #1
    Join Date
    Jul 2012
    Posts
    113
    Mentioned
    7 Post(s)
    Quoted
    34 Post(s)

    Default Looting Function

    I made a function that can loot items that monsters drop if anyone is interested.

    It uses the RedBar on kill to locate the loot piles (On kill, stolen from old chaosmosskiller script, credits to Shatterhand)

    At the moment, I've programmed this for my own needs to loot charms from waterfiends, but I'm sure it could be tweaked (by adjusting how relative the Y coordinate is from the bar) for any monster.

    You'll also need to add X and Y to Integer vars at the top.

    REDBAR FUNCTION (TAKEN FROM SHATTERHAND'S CHAOSMOSSKILLER)
    Simba Code:
    function FindRedBar : Boolean;                                                  //returns True if a full red hp bar is found
    var
      RedBarDTM1, RedBarDTM2 : Integer;
    begin
      Result := False;
      RedBarDTM1 := DTMFromString('mlwAAAHicY2dgYDBnZmCQBWIZKB0ExQpA3AiUr2OA0C1QDOPvZOBgsGZnwsBdDIwM+AAjHgwFAAvPB5w='); //two DTMs just in case
      RedBarDTM2 := DTMFromString('mlwAAAHicY2dgYDBnZmCQBWIZKB0ExQpA3AiUr2OA0C1QDOPvZOBgsGZnwsBdDIwM+AAjHgwFAAvPB5w=');

      if FindDTM(RedBarDTM1,X,Y,MSX1,MSY1,MSX2,MSY2) or
         FindDTM(RedBarDTM2,X,Y,MSX1,MSY1,MSX2,MSY2) then
      begin
        {if DebugLines then
          Writeln('Found redbar, we killed it.');
        if PaintDebug then
        begin}

          SMART_DrawBoxEx(false,false,IntToBox(X-30,Y-10,X+30,Y+10),ClYellow);      //drawing box around the redbar
          Wait(50);
          SMART_ClearCanvasArea(IntToBox(0,MSY1+49,520,MSY2+50));
        //end;
        Result := True;
      end;
      FreeDTM(RedBarDTM1);
      FreeDTM(RedBarDTM2);
    end;

    Looting (Clicks where loot pile should be relative to kill bar)
    Simba Code:
    if (FindRedBar) then
      begin
          wait(1000); //Waiting to see if we can detect it twice to make sure that it didn't detect it early (messes up coords)
          if (FindRedBar) then
            wait(200);
          MMouse(X+random(3),Y+20,0,0);
          wait(1000+random(200));
          ClickMouse2(False);
          WaitOptionMulti(['ake Crims','ake Gold c', 'ake Green', 'ake Blue'], 1000);
          repeat until not IsMoving
            wait(300+random(100));
      end;
    Last edited by SeanStar; 01-04-2013 at 10:51 AM.

  2. #2
    Join Date
    Mar 2007
    Posts
    674
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Simba Code:
    if (FindRedBar) then
      begin
          wait(1000); //Waiting to see if we can detect it twice to make sure that it didn't detect it early (messes up coords)
          if (FindRedBar) then
            wait(200);
          MMouse(X+random(3),Y+20,0,0); //are you sure about the y co ord? The height of the mister will affect this. Hill giant vs golbin.
          wait(1000+random(200));
          ClickMouse2(False);
          WaitOptionMulti(['ake Crims','ake Gold c', 'ake Green', 'ake Blue'], 1000);
          repeat
            wait(300+random(100));
          Until (not(ismoving)) /////<---like this
      end;

    You can also do this:
    Well you detect player is in a fight, look at the mm and get an array of all the red dots(array1). after the fishy, get a new array of all the red dots (array2), and cross off the array2 points from those in array 1. (This can be problematic if some red dot disappears during the fight, or some new drop appears during the fight).
    then, use the dist function to get the closest red dot from the player (since we were fighting it, it will be the closest to the player). Move the player to the reddot on the minimal. And then use the mscx and mscy to get to the ground tile the player is standing on and mouseclick(false) there.

  3. #3
    Join Date
    Jul 2012
    Posts
    113
    Mentioned
    7 Post(s)
    Quoted
    34 Post(s)

    Default

    Quote Originally Posted by Lalaji View Post
    Simba Code:
    if (FindRedBar) then
      begin
          wait(1000); //Waiting to see if we can detect it twice to make sure that it didn't detect it early (messes up coords)
          if (FindRedBar) then
            wait(200);
          MMouse(X+random(3),Y+20,0,0); //are you sure about the y co ord? The height of the mister will affect this. Hill giant vs golbin.
          wait(1000+random(200));
          ClickMouse2(False);
          WaitOptionMulti(['ake Crims','ake Gold c', 'ake Green', 'ake Blue'], 1000);
          repeat
            wait(300+random(100));
          Until (not(ismoving)) /////<---like this
      end;

    You can also do this:
    Well you detect player is in a fight, look at the mm and get an array of all the red dots(array1). after the fishy, get a new array of all the red dots (array2), and cross off the array2 points from those in array 1. (This can be problematic if some red dot disappears during the fight, or some new drop appears during the fight).
    then, use the dist function to get the closest red dot from the player (since we were fighting it, it will be the closest to the player). Move the player to the reddot on the minimal. And then use the mscx and mscy to get to the ground tile the player is standing on and mouseclick(false) there.
    1. I stated in the first post that the Y coordinate would need to be adjusted, I was simply giving the code I was using for waterfeinds.
    2. There was nothing wrong with my original repeat wait until is not moving statement, and it's 2 lines instead of 3, but whatever.
    3. Drops disappear after 3 minutes and it's highly likely they will disappear while you're in a fight frequently.. you also don't want random people dropping shit to screw up your bot.
    4. The closest red dot may not be what you were fighting. For example, I was using ranged when fighting the waterfiends when using this function to loot.


    A good idea you could implement is detecting the new red dot after you kill the monster and add it to the array, then have it automatically remove based on the drop disappearance delay. (What is it, like 3 minutes?)

    Even that wouldn't really be flawless.. you could have random people dropping stuff, plus you have to actually walk to the item location on the minimap to check the loot on it.

    This function works 100% of the time it's able to detect the kill bar, as the loot pile is always in a fixed coordinate offset relative to it. Plus it checks the loot instead of running to it before you even know what's there, and it checks after each kill so it doesn't miss a loot pile (unless it's unable to detect the kill bar, which happens when you're not trying to find it exclusively on repeat)

    For anyone who was looking for a pretty reliable looting method, this is about as good as you can get with color.

  4. #4
    Join Date
    Sep 2012
    Location
    Here.
    Posts
    2,007
    Mentioned
    88 Post(s)
    Quoted
    1014 Post(s)

    Default

    Quote Originally Posted by SeanStar View Post
    1. I stated in the first post that the Y coordinate would need to be adjusted, I was simply giving the code I was using for waterfeinds.
    2. There was nothing wrong with my original repeat wait until is not moving statement, and it's 2 lines instead of 3, but whatever.
    3. Drops disappear after 3 minutes and it's highly likely they will disappear while you're in a fight frequently.. you also don't want random people dropping shit to screw up your bot.
    4. The closest red dot may not be what you were fighting. For example, I was using ranged when fighting the waterfiends when using this function to loot.


    A good idea you could implement is detecting the new red dot after you kill the monster and add it to the array, then have it automatically remove based on the drop disappearance delay. (What is it, like 3 minutes?)

    Even that wouldn't really be flawless.. you could have random people dropping stuff, plus you have to actually walk to the item location on the minimap to check the loot on it.

    This function works 100% of the time it's able to detect the kill bar, as the loot pile is always in a fixed coordinate offset relative to it. Plus it checks the loot instead of running to it before you even know what's there, and it checks after each kill so it doesn't miss a loot pile (unless it's unable to detect the kill bar, which happens when you're not trying to find it exclusively on repeat)

    For anyone who was looking for a pretty reliable looting method, this is about as good as you can get with color.
    To back him up, I also feel this would work far better in the case of any sort of bot that did not choose to use a melee weapon as well for some reason. In that case, the monster and loot pile would not be next to the player (fighting also a ranged monster that is) and it would handle piles that may be equal distances away better as well.

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
  •