ID:157489
Feb 27 2010, 3:07 pm (Edited on Feb 27 2010, 3:14 pm)
|
|
i wanted to make a click and walk system that wouldnt move northwest,northeast,southwest,and southeast because moving in those directions is ugly in the isometric byond system when you are near a wall.
|
Feb 27 2010, 3:20 pm
|
|
In response to Popisfizzy
|
|
Yeah this works but if the mob would move diagnol the walk_to proc stops and that makes the movement by clicking very bad, is there a way to make the mob choose other directions than diagnol and not to stop moving?
|
In response to Karffebon
|
|
You can change Move() to make it split up diagonal directions into two parts, though that might not always work.
|
In response to Jeff8500
|
|
if(dir==NORTHEAST) this is my basic idea i would do it with every direction but how would i insert it in move proc? or is there any other way? |
In response to Karffebon
|
|
That's a pretty bad way to do it. I would split the direction, then call Move(direction1) and then Move(direction2), though if the first one doesn't work, then I'd call Move(direction2) then Move(direction1). It's not exactly perfect, and you can implement one of BYOND's pathfinding libraries instead, but it's a decent fix.
Regardless, you don't really know what you're doing, you should read the DM guide. |
Like Jeff8500 mentioned, I would use one of the pathfinding libraries available. (See hub://kuraudo.libpathfinder and hub://theodis.pathfinder.) If you just prevented movement in diagonal directions you run the risk of walk_to() getting stuck in an example like so:
..... .XO.. .@X.. ..... Key: X = Wall, O = Target, @ = Ref (@ gets stuck because it is trying to move NORTHEAST to O, but blocking NORTHEAST movement prevents it from making it through. Attempting to break it into a NORTH step followed by an EAST step also fails.) If, for example, you were using hub://kuraudo.libpathfinder, you could implement a proc similar to walk_to() and step_to() like so: /****************************************************************************** (See libpathfinder's documentation for more information regarding how to use it.) That emulates much of the functionality of walk_to(), with the caveat that you can't cancel it after you start it. You could of course modify this to add in such functionality if you wished. You also might want to prevent the atom from otherwise moving until move_to() finishes (as it would interfere with the movement). |
In response to Kuraudo
|
|
How do i use that? i dont understand it's too complicated my head hurts
i donwloaded the library and activated it and your code, and i replaced the walk_to in my click and move to move_to but it doenst show walking animations and it stills move in the diagnol |
In response to Karffebon
|
|
I would need to see some of your code to know what is going wrong, obviously.
|
In response to Kuraudo
|
|
/****************************************************************************** var/move_success = ref.Move(path[path_index++]) -> he just gets teleported, i wanted him to walk(in code he walks i think but not in the visual |