Jump to content

Hunter Script


IkiritokunI

Recommended Posts

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.

Link to comment
Share on other sites

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"));
}
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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