creationx Posted April 21, 2015 Share Posted April 21, 2015 I am creating my own private script for Rock Crabs (may be released after it's perfected, for a price of course). Is there anyway to detect whether or not the crab is aggressive? My first thought would be to walk near the crab and check for combat, and if no they are non aggressive, however there could be the exception that someone else is simply fighting the rock crab. So here are the questions: How do I detect the crab when it's not an active NPC? How do I detect the crab when it's in a fight with ANOTHER player? (or any NPC for that matter) Is there a way to detect the crab based off of it's model? (not ID, but model) Thank you everyone for your help in my journey to create quality scripts for the community. It may take awhile to get the hang of it, but when I've got it, I'll be releasing the most human like scripts seen. -CX Quote Link to comment Share on other sites More sharing options...
Apaec Posted April 21, 2015 Share Posted April 21, 2015 Welllll Firstly, we already have 3 rock crabs scripts (lol), but I guess we'll all welcome new competition The way I check in my script is much the same to how a human would check: Walk up to crab Check if there is a rock crab in the nearest 3x3 square around the player which is fresh Attack said crab Check if under attack & rock crab still exists If no rock crab (NPC) spawns, then refresh ofcourse there would be timers going on throughout. The only problem with this method is sometimes it refreshes when it doesnt need to if the world lags by over 5 seconds or so, but this rarely happens, so it's not too much of a problemo in my script. Apaec 1 Quote Link to comment Share on other sites More sharing options...
creationx Posted April 21, 2015 Author Share Posted April 21, 2015 Please do not consider my contributions to the community as competition towards other scripters, but rather advancements towards the community. Thank you for your response, however I believe my original question was not necessarily answered; this may have been an error on my part. So the question rephrased would be: How are non-aggressive crabs classified in game? Are they objects or NPCS? Secondly, How do I go about gathering the information that they have changed to be nonaggressive? This way I can relay the information to a new part of the script that will then do what needs to be done in order to re-aggravate the crabs. Quote Link to comment Share on other sites More sharing options...
Vag Posted April 21, 2015 Share Posted April 21, 2015 Look up their object ID from the client, then interact with the object ID (Walk here). After this, make the loop attack the spawned NPC 1 Quote Link to comment Share on other sites More sharing options...
Botre Posted April 21, 2015 Share Posted April 21, 2015 (edited) I'm going to assume that with "non-aggressive" you mean "sleeping" and not "not automatically attacking the player". If I'm assuming wrongly then there's no way to find out if a monster is aggressive (in the API at least, that I'm aware of) but crabs in the "awake" state are ALWAYS NPCs. So the question rephrased would be: How are non-aggressive crabs classified in game? Are they objects or NPCS? "Sleeping" crabs are classified as Object (I'm pretty sure they are at least). You can verify yourself with this debugger: How do I detect the crab when it's in a fight with ANOTHER player? NPC crab = //GET AWAKE CRAB HERE. if (crab.getInteracting() != null) { if (getInteracting().equals(myPlayer()) { // CRAB IS INTERACTING WITH ME } else { // CRAB IS INTERACTING WITH OTHER PLAYER (OR NPC) } } Hope this helped. Edit: like APA said, not sure if there's room for another RC script on the market tbh :p Edited April 21, 2015 by Botre 1 Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted April 21, 2015 Share Posted April 21, 2015 I'm going to assume that with "non-aggressive" you mean "sleeping" and not "not automatically attacking the player". If I'm assuming wrongly then there's no way to find out if a monster is aggressive (in the API at least, that I'm aware of) but crabs in the "awake" state are ALWAYS NPCs. "Sleeping" crabs are classified as Object (I'm pretty sure they are at least). You can verify yourself with this debugger: NPC crab = //GET AWAKE CRAB HERE.if (crab.getInteracting() != null) {if (getInteracting().equals(myPlayer()) { // CRAB IS INTERACTING WITH ME}else {// CRAB IS INTERACTING WITH OTHER PLAYER (OR NPC)}}Hope this helped.Edit: like APA said, not sure if there's room for another RC script on the market tbh :p Make sure you store your instances of getInteracting, and everything else, then operate on those instances. That code can throw an npe. 1 Quote Link to comment Share on other sites More sharing options...
creationx Posted April 21, 2015 Author Share Posted April 21, 2015 Thank you everyone! Most likely I will code the project to fit my play style and reduce banning on my part, seeing as you all are very opposed to it hitting the market. If I have anymore questions I'll be sure to report back here! Quote Link to comment Share on other sites More sharing options...
creationx Posted April 21, 2015 Author Share Posted April 21, 2015 At least I'm making an attempt to contribute to the society, instead of mocking those who do such. Not to mention learning a valuable coding language in this day...Time well spent! 2 Quote Link to comment Share on other sites More sharing options...
Twin Posted April 21, 2015 Share Posted April 21, 2015 Why was my post removed?.. Quote Link to comment Share on other sites More sharing options...
Woody Posted April 21, 2015 Share Posted April 21, 2015 Why was my post removed?.. Yea, mine aswell Quote Link to comment Share on other sites More sharing options...