Jump to content

Dealing with dynamic areas


triggamortis

Recommended Posts

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?

Link to comment
Share on other sites

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 wink.png

 

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 by Czar
Link to comment
Share on other sites

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 wink.png

 

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 wink.png ). But i was just hoping there would be something easier to calculate in dynamic regions.

 

I'll try contacting them.

Edited by triggamortis
Link to comment
Share on other sites

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 wink.png ). 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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Don't listen to these knobs :doge:

 

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);

Link to comment
Share on other sites

Don't listen to these knobs doge.png

 

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...