Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Looting only items that belong to me [Ironman]


    redrum

    Recommended Posts

    Hello all. I'm back to scripting. Been since 2010 since I've done anything.

    I'm going to be an iron man and doing my own scripts.

     

    Currently what I'm doing is I'm tracking the location of the NPC i'm attacking and then waiting until it despawns and I hope that the location that I've last tracked is the location where the loot appears. I'm usually right but often the NPC dies when it's moving around so my last tracked position is one tile off. 

     

    I'm using this code: 

     GroundItem pickup = getGroundItems().closest(item -> item.getName().equals("Bones") && (deadPositionX == item.getX()) && (deadPositioY) == item.getY());
    
    

    Bones is the example, deadPositionX and Y are the last tracked spot, I'm updating the location of the NPC every cycle within a while loop in combat. 

    I cannot simply just take +/- 1 of my X/Y position because of this:

     WMXWkqG.png

    The IGNORE is the true closest item to me, the PICKUP is the one dropped by the monster I am facing.

     

    Is the solution to this problem just to find NPCs that don't move around a lot when I'm attacking them? 

     

    Thank you.

     

    Edit: Added picture of my logger. 

    Link to comment
    Share on other sites

    Why would you have to track where the monster died? You can just have it pick up the closet ground item relevant to what your trying to pick up? Just set up an if statement in your fighting state to where if any of the game objects become visible to pick them up if not in combat within a certain distance.

    Link to comment
    Share on other sites

    Why would you have to track where the monster died? You can just have it pick up the closet ground item relevant to what your trying to pick up? Just set up an if statement in your fighting state to where if any of the game objects become visible to pick them up if not in combat?

     

     

    I cannot pick up loot that doesn't belong to me. I can only pick up my own loot. If I am in a public area, I wish to only loot the items that dropped from the monster I killed. I cannot take somebody else's bones even if they are 1 tile away from me. In the example in the picture, the one that was IGNORED is actually closer according to the getClosest() method but it didn't belong to me. 

    Link to comment
    Share on other sites

    I cannot pick up loot that doesn't belong to me. I can only pick up my own loot. If I am in a public area, I wish to only loot the items that dropped from the monster I killed. I cannot take somebody else's bones even if they are 1 tile away from me. In the example in the picture, the one that was IGNORED is actually closer according to the getClosest() method but it didn't belong to me. 

     

    So why couldn't you just set it up to only loot the item if its within a certain distance from you. Let's say 1 tile. That would allow you to pickup the loot from a monster that died directly in front of you. Only issue I see is it moving around and happening to be next to someones loot pile. 

    Link to comment
    Share on other sites

    So why couldn't you just set it up to only loot the item if its within a certain distance from you. Let's say 1 tile. That would allow you to pickup the loot from a monster that died directly in front of you.

    ...? Because there could be bones dropped 1 east, 1 west, 1 north and 1 south of me and I can only pick up one of these items. Unless there's a "I'm facing north" type of enum then I'm at a loss for your method...

     

     

    I suppose I can write that part. I'll be back with my success if DreamBot doesn't have one built in - I'll write one. Going to check the javadocs.

    Link to comment
    Share on other sites

    ...? Because there could be bones dropped 1 east, 1 west, 1 north and 1 south of me and I can only pick up one of these items. Unless there's a "I'm facing north" type of enum then I'm at a loss for your method...

     

     

    I suppose I can write that part. I'll be back with my success if DreamBot doesn't have one built in - I'll write one. Going to check the javadocs.

     

    You can easily fix this by doing what your doing and setting a tile based on the method your using and only pickup the loot if the your standing on the tile that was set last and if its not there to walk to it and then pickup.

    Link to comment
    Share on other sites

    You can easily fix this by doing what your doing and setting a tile based on the method your using and only pickup the loot if the your standing on the tile that was set last and if its not there to walk to it and then pickup.

    The problem: I'm using while (inCombat) { update locations}

     

    Then once I'm out of combat, I wait to loot the location. Sometimes the combat loop is off because the NPC moved in the middle of one, it's a classical situation of a variable changing when it shouldn't be changin - like a semaphore dealing with critical data and another method mucks the variable before it's finalized.

     

    https://dreambot.org/javadocs/org/dreambot/api/wrappers/interactive/util/Direction.html This is the only thing I'm seeing containing Direction.

    Link to comment
    Share on other sites

    The problem: I'm using while (inCombat) { update locations}

     

    Then once I'm out of combat, I wait to loot the location. Sometimes the combat loop is off because the NPC moved in the middle of one, it's a classical situation of a variable changing when it shouldn't be changin - like a semaphore dealing with critical data and another method mucks the variable before it's finalized.

     

    https://dreambot.org/javadocs/org/dreambot/api/wrappers/interactive/util/Direction.html This is the only thing I'm seeing containing Direction.

     

    Maybe look into a way to setting a tile based on where the NPC you were fighting was last located before it didn't exist :P

    Link to comment
    Share on other sites

    S05lGZZ.png

     

    The IGNORE in this case is a drop of mine.


    Maybe look into a way to setting a tile based on where the NPC you were fighting was last located before it didn't exist :P

    I'm waiting until it despawns already >,< loot is just fucky.

    Link to comment
    Share on other sites

    S05lGZZ.png

     

    The IGNORE in this case is a drop of mine.

    I'm waiting until it despawns already >,< loot is just fucky.

     

    Hmm I found a solution. It seems like its only 1 tile off. Just check to see if the loot is within the distance of 1 tile of the tile that was set. Should work.

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.