Vilius Posted March 9, 2016 Share Posted March 9, 2016 (edited) RuneScape has multiple entity types NPC's Objects GroundItems Determining which one to use is way simpler than people think. NPC's will have yellow name tags in game Objects will have blue name tags in game GroundItems will have orange name tags in game Now when it comes to declaring variables what should we use? For NPC's we would use the NPC class. Our code should look like this NPC npc = ... For Objects we would use the RS2Object class. Our Code should look like this RS2Object object = ... For GroundItems we would use the GroundItem class. Our code should look like this GroundItem item = ... Why would we shy away from using Entity class to define any entity from the game? Well simply put Entity is just an interface and it might not contain things needed to any specific Entity implementing classes. Like RS2Object will have getType() method but Entity will not. The main place to use Entity class is when we are passing it to a parameter of a method and making your own lets say interacting methods. We would use Entity in our parameter to make it accept any Entity type. public void interactCustom(Entity entity, String action){ if(entity.isVisible()) entity.interact(action); else getCamera().toEntity(entity); } Of course again there will come limitations, which are when you are making a method for getting the type of an Object and logging it. Having our code look like this will not work and give us an error. public void getTypeAndLog(Entity entity){ log("[Debug] objects type: " + entity.getType(); } So passing Entity to our parameter wouldn't give us the method getType() which RS2Object has, so we would need to have RS2Object in our parameter So we would need to have RS2Object in our parameter. And our code will work if he have it look like this public void getTypeAndLog(RS2Object object){ log("[Debug] objects type: " + object.getType(); } I hope this guide helped you understand the types of Entities and how to use them correctly Edited March 9, 2016 by Vilius 7 Quote Link to comment Share on other sites More sharing options...
Token Posted March 9, 2016 Share Posted March 9, 2016 Let's not forget about GroundDecoration, Player, WallDecoration, WallObject and other interactables. Quote Link to comment Share on other sites More sharing options...
Harry Posted March 9, 2016 Share Posted March 9, 2016 Awesome guide, keep up the good work lad. GroundItems will have brown name tags in game But pls? I'm pretty sure that is orange m8 Quote Link to comment Share on other sites More sharing options...
Vilius Posted March 9, 2016 Author Share Posted March 9, 2016 Awesome guide, keep up the good work lad. But pls? I'm pretty sure that is orange m8 Fixed Quote Link to comment Share on other sites More sharing options...
TheGreatests Posted December 22, 2016 Share Posted December 22, 2016 So what"public void interactCustom(Entity entity, String action){if(entity.isVisible())entity.interact(action);elsegetCamera().toEntity(entity);}" Is basically doing is clicking it no matter what. I am assuming or could you maybe go into more depth of each parameter and its purpose. This method passes a string called action to it using entity. So its basically clicking it right? Quote Link to comment Share on other sites More sharing options...