triggamortis Posted April 6, 2015 Share Posted April 6, 2015 Im working on a script that deals with dynamic regions and in the script it needs to go to a certain coordinate or not precise but close to exact; and remember I'm dealing with dynamic regions meaning the coordinates change every time i re-enter this region. Does anyone got an algorithm of solving this? I was thinking of calculating my current position and just subtract and add from that. It didn't seem to work at all though by doing that. Wouldn't this be a similar problem with pest control because it uses dynamic regions? How did they solve this issue or what did they do? Quote Link to comment Share on other sites More sharing options...
Czar Posted April 6, 2015 Share Posted April 6, 2015 (edited) Well that is the general idea of how it works, you grab current position (or any position that never changes, e.g. a fireplace or any object position), and then generate a path using that relative position, e.g. in pest control, the north east portal is ALWAYS going to be for example position(+100, +50, 0) of the boat coordinate, so it just adds onto it like you said. If that doesn't work, make sure you calculate the current position correctly, so perhaps grab the position of the npc that shouts (at the beginning of the game?) or something that is in the game, that ISNT in the normal pest control bank area. This would've been a longer post if you provided some code or some more detail as to why it didn't work EDIT: If you need more help, contact either @Valkyr or @Khaleesi as they both have pest control scripts and they may be willing to give you some advice. Edited April 6, 2015 by Czar Quote Link to comment Share on other sites More sharing options...
triggamortis Posted April 6, 2015 Author Share Posted April 6, 2015 (edited) Well that is the general idea of how it works, you grab current position (or any position that never changes, e.g. a fireplace or any object position), and then generate a path using that relative position, e.g. in pest control, the north east portal is ALWAYS going to be for example position(+100, +50, 0) of the boat coordinate, so it just adds onto it like you said. If that doesn't work, make sure you calculate the current position correctly, so perhaps grab the position of the npc that shouts (at the beginning of the game?) or something that is in the game, that ISNT in the normal pest control bank area. This would've been a longer post if you provided some code or some more detail as to why it didn't work EDIT: If you need more help, contact either @Valkyr or @Khaleesi as they both have pest control scripts and they may be willing to give you some advice. Does the method "walk" in the localwalker recalculate a position that isn't walkable? Also isnt the method never precise on the position for obvious reasons(banning). If it doesn't recalculate, then thats what might be my problem be. What sucks for me the area is a small U shape with water around so it might be clicking the water IDK( hint what im working on ). But i was just hoping there would be something easier to calculate in dynamic regions. I'll try contacting them. Edited April 6, 2015 by triggamortis Quote Link to comment Share on other sites More sharing options...
Isolate Posted April 6, 2015 Share Posted April 6, 2015 Does the method "walk" in the localwalker recalculate a position that isn't walkable? Also isnt the method never precise on the position for obvious reasons(banning). If it doesn't recalculate, then thats what might be my problem be. What sucks for me the area is a small U shape with water around so it might be clicking the water IDK( hint what im working on ). But i was just hoping there would be something easier to calculate in dynamic regions. I'll try contacting them. Sssssssound Ssssssslipery to me ; ). I'm sure there'd be a way, Like the people above me said, a good way would be to locate something thats relative position will always be the same. This can even the be the point you enter the instance, if its always the same tile you start off in. Quote Link to comment Share on other sites More sharing options...
triggamortis Posted April 6, 2015 Author Share Posted April 6, 2015 Sssssssound Ssssssslipery to me ; ). I'm sure there'd be a way, Like the people above me said, a good way would be to locate something thats relative position will always be the same. This can even the be the point you enter the instance, if its always the same tile you start off in. Ye... for some reason the walk method doesn't walk to the tile it needs to go to. I have no problem at the start but after that, the safe spot it needs to walk to, it doesnt recognize the tile or the walk method thinks its not a walkable tile so it completely ignores it so i guess the walk method does not correct itself. Is the reason above why its not walking to the tile it needs to go to? Quote Link to comment Share on other sites More sharing options...
Tom Posted April 7, 2015 Share Posted April 7, 2015 I think the location is precise, but I might be wrong. Quote Link to comment Share on other sites More sharing options...
FrostBug Posted April 7, 2015 Share Posted April 7, 2015 Don't listen to these knobs First go and find the local coordinates of the entities (eg. object#getLocalX, object#getLocalY) then, when you need to find the object / walk to the object, you can get its position by grabbing the base coordinates of your instance (An instance area always fills an entire region) So, the position in the instance would be: new Position(objectLocalX + getMap().getBaseX(), objectLocalY + getMap().getBaseY(), z); Quote Link to comment Share on other sites More sharing options...
triggamortis Posted April 8, 2015 Author Share Posted April 8, 2015 Don't listen to these knobs First go and find the local coordinates of the entities (eg. object#getLocalX, object#getLocalY) then, when you need to find the object / walk to the object, you can get its position by grabbing the base coordinates of your instance (An instance area always fills an entire region) So, the position in the instance would be: new Position(objectLocalX + getMap().getBaseX(), objectLocalY + getMap().getBaseY(), z); Omg ty for this. Quote Link to comment Share on other sites More sharing options...