Jump to content

Hunter Script


Recommended Posts

Posted
21 hours ago, IkiritokunI said:

Hey all,

 

I'm making a new hunter script and I was wondering how I can check my trap is setup and not somebody's else trap.

Im talking about bird traps (atm I can only setup 1 trap but In the future I want to check if there are 2 traps of mine)

Any idea's how I can check this easy? 

 

Keep the reference of the object saved within your code.

Posted

still did not figure it out.

Can somebody help me? 

 

private void doingCopperTails() {
    if (getGroundItems().closest("Bird snare") != null){
        getGroundItems().closest("Bird snare").interact("Take");
        sleepCondition(inventory.contains("Bird snare")); //-1?
    } else if (getGroundItems().closest("Bird snare") != null){
        getGroundItems().closest("Bird snare").interact("Check");
        sleepCondition(inventory.contains("Bones"));
    } else if (inventory.contains("Bird snare") && objects.closest("Bird snare") != null){ //birdsnare is not up?
        // code ..... (maybe do random?)
    }  else if (inventory.contains("Bones")){
        inventory.getItem("Bones").interact("Bury");
        sleepCondition(!inventory.contains("Bones")); //-1?
    } else if (inventory.contains("Raw bird meat"));
    inventory.getItem("Raw bird meat").interact("Drop");
    sleepCondition(!inventory.contains("Raw bird meat"));
}
Posted

Just depends how advanced you want it to be. If you want it to be super basic without any advanced features, just place all your trap location in a list. This only becomes a problem when people tamper with your traps, try to crash you, game lags/server spikes mess up trapping, you lose a trap, you run out of traps, you have an object on your tile, someone places a ground object on your tile... the list could literally go on and on.

If you want it to be simple and easy, just store the tiles in an arraylist and use them as references.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...