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
  • Try asking for help in the chatbox
  • Avoid chopping tree and mining rock already being used by another player?


    Samuel91
     Share

    Recommended Posts

    For a tree you can check or the tree has the "Chop down" option: 

    GameObject tree = caller.getGameObjects().closest(object -> object != null && object.hasAction("Chop down"));

    Combine that with the name of the tree you want to chop and you should be fine

     

    Rocks, I don't know yet ;)

    Link to comment
    Share on other sites

    I think you've misunderstood. I'm not trying to avoid resources that are already depleted I'm trying to to avoid resources that are still there but have another player trying to harvest them.

    Link to comment
    Share on other sites

    52 minutes ago, Empyrean GB said:

    Rocks, I don't know yet ;)

    As an aside you can filter for depleted rocks by using this snippet of code from dQw4w9WgXcQ.

     

    GameObject rock = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals("Rocks") && gameObject.getModelColors()[0] == ROCK_COLOR);

    It uses the rocks color to tell whether or not it is depleted.

    Link to comment
    Share on other sites

    O sorry my bad, I only did woodcutting so far and from lvl 15 onwards it doesn't matter if multiple player interact with the same tree so misunderstood the issue.

    Never worked with this. You could check if there's a player standing next to the game object facing it and is in the mining animation... A player has a tile he is on, getFacingDirection and getAnimation.

    But that sounds more like a work around if anything with a lot of looping or a really complex labda. Other then that I wouldn't know sorry

     

     

    Link to comment
    Share on other sites

    8 hours ago, Samuel91 said:

    As title says is there anyway to check if a tree/rock is already being used by another player and avoid it?

    As far as I know, there isn't an easy way of doing this. What I can think of is check if there are player around, check if it's 1 tile away from the tree/rock, check animations to see if he is mining/woodcutting and check if the player is facing the rock/tree.

    Link to comment
    Share on other sites

    so from the tutorial of goblin killing

    ,  game filter was introduced. base on that idea. you expand on it. you can check if there are players around by using getPlayers.all() and compare there location. its a good idea. i have the same idea and implemented. heres my checker for rocks. the problem is. for rocks its only up down left right. but i used get area. so its not perfect yet. good list is the list of rocks i want to mine.

    public Boolean checkIfTileAroundHasPlayer(GameObject go){
        Tile temp=new Tile(go.getX(),go.getY());
        for(Player i:getPlayers().all()){
           if( temp.getArea(1).contains(i)&&!i.getName().equals(getLocalPlayer().getName())){
                return true;
           }
        }
    
        return false;
    }
    public Filter<GameObject> rockFilter = new Filter<GameObject>() {
        @Override
        public boolean match(GameObject gameObject) {
    
            if(checkIfTileAroundHasPlayer(gameObject)){
               return false;
            }
            if (goodList.contains(gameObject.getID())) {
                return true;
            }
            return false;
        }
    };
    Edited by pokemonhuang
    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • 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.