kamilo 7 Share Posted June 1, 2021 Lets see i've plotted the attack range of a monster its huge, it cannot be covered within the player viewing range. How do i go about finding the npc? I have an Area (Rectangle), the monster could be anywhere within that area? Do i search each corner? looking for some bright creative ideas please! Link to comment Share on other sites More sharing options...
Pseudo 179 Share Posted June 1, 2021 Even if the NPC isn't visible in the scene you ought to be able to determine its location if it's loaded in the region. Link to comment Share on other sites More sharing options...
kamilo 7 Author Share Posted June 3, 2021 On 6/1/2021 at 7:52 AM, Pseudo said: Even if the NPC isn't visible in the scene you ought to be able to determine its location if it's loaded in the region. its roaming area is big bro Link to comment Share on other sites More sharing options...
kamilo 7 Author Share Posted June 3, 2021 unless im missing something here, take callisto for example when im hunting it it keeps running a lot of places lol, it does have a fixed range but its roaming area is huge Link to comment Share on other sites More sharing options...
likeablePanda 48 Share Posted June 3, 2021 Without constantly keeping track of where you are, and keeping code small, I'd like to propose the following idea(NOT TESTED, just to give the idea): Area bigArea = null;//whatever your search area is Tile searchDestination = getLocalPlayer().getTile(); while(NPCs.all("your npc name").size()<1) { //while you haven't found the NPC yet if (searchDestination.distance() < 5) {// if we're close to the search destination, we need to choose another tile to search int tournamentSelect = 15;//how many random tiles we're going to check to get a far away point, cover a lot of distance for (int i = 0; i < tournamentSelect; i++) {//we just check tournamentSelect number of random tiles, save the one furthest from us Tile randomTile = bigArea.getRandomTile(); if (randomTile.distance() > searchDestination.distance()) { searchDestination = randomTile; } } } else { Walking.walk(searchDestination); } } //after this loop is done, you found it!!!! The idea is to just walk a long straight line path and hope you run into the NPC along the way. if you don't choose another tile far away from you, and navigate to that brand new search destination. and repeat until found. You can change how far away the search destination is on average by adjusting tournamentSelect. Lower will be more random, but could just end up checking a point close to you. Higher will be less random(more detectable?), but you a point pretty far away from you for more efficient search. Without keeping track of where you've been and crazy stuff i'm not sure how much better you can get. I'd love to see other solutions! Link to comment Share on other sites More sharing options...
likeablePanda 48 Share Posted June 5, 2021 @kamilo I'd be curious if you used my solution above or if you found another one you prefer! Link to comment Share on other sites More sharing options...
kamilo 7 Author Share Posted June 8, 2021 On 6/5/2021 at 4:50 PM, likeablePanda said: @kamilo I'd be curious if you used my solution above or if you found another one you prefer! sure thing bro ill definetly test it out and let you know! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.