step_towards(src,M)
&
step_rand(src)
ID:159045
May 25 2009, 3:11 am
|
|
How would I make it when an NPC moves, it calls on the North(), South(), West(), East() for it's movement? I have player movement so that Diagonal movement is blocked, that's why I'm trying to set NPCs to the same movement so that they don't move diagonal all over the place. Here are the codes I'm using for the enemy movement:
step_towards(src,M) & step_rand(src) |
In response to Mysame
|
|
How would I rewrite Move()?
I thought it would be similar to client So I tried: client Can you please explain it to me? |
In response to Forerunnerz
|
|
Any help?
|
In response to Forerunnerz
|
|
Bump..
|
In response to Forerunnerz
|
|
Forget overriding Move() to do this, it won't really do a lot of good. What you need to do is not to use a function that does things you don't want. i.e., BYOND's walking functions use diagonal movement, but you don't want that, so you need to use something else.
There are a few pathfinding libraries available, which I believe you can tweak/override/configure to do what you want here. |
works for just random movement (within a loop, of course), but for going towards something.. You'd have to somewhat rewrite Move(), and if the dir is diagonal, make it move vertical/horizontal with a 50% chance or something (If he's going south east, 50% chance for south, else east).
Anyways, I'm assuming there must be a better method.