IkiritokunI Posted May 10, 2019 Posted May 10, 2019 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?
dreameo Posted May 11, 2019 Posted May 11, 2019 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.
IkiritokunI Posted May 12, 2019 Author Posted May 12, 2019 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")); }
ProjectPact Posted May 12, 2019 Posted May 12, 2019 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.