ID:170416
 
I have monsters that march like in a line but when they turn corners they get off balance. any body know how I could get them to line back up?
Tag one of the mobs as the leader of the group and give every mob in the group a position relative to the leader. When the group moves, the leader goes for the group's goal and each other mob in the group calculates where to move based on the position and facing of the leader.

You may want the leader to slow down when the formation is broken and each member has a clear path to their position in the formation. That way the leader will push on through narrow areas, but when the group gets through to an open space he'll let the rest of the group catch up and resume the formation.
In response to Shadowdarke
ok. thats what I have been trying to do. but cant get it right Im having to use the walk() proc and turfs to turn them because at times obsticals block off their way ..
In response to Lifehunter
Use walk_to()

walk_to(Ref,Trg,Min,Lag)

Red = the thing you want to make walk
Trg = the place you want the thing to walk to
Min = the distance you need to be beffor you stop (1 is to stop beside)
Lag = the delay in 1/10th second between each step
In response to FranquiBoy
the monsters have no density so they would walk over cliffs and [stuff] and plus walk_to they always use stupid paths and they would all end up looking whorse then what I have them walking right now..

btw exactly what it does is they skip ahead by one on each time they turn
In response to Lifehunter
how about I edit there loc to make it consistant with the laders each time by using -= on there Y or X acording to dir?

nevermind;doesnt exactly work,and a question if the monster tagged Leader got destroyed wouldnt that mess up the entire thing?
In response to Lifehunter
walk_to() is the best built in proc for it. I recommend using Deadron's Pathfinding or a similar library for your pathfinding.

As in any team, when the leader dies one of the others step up to the role. You might want to tighten the formation again to compensate, but you could get away with using the old relative positions.
In response to Lifehunter
Lifehunter wrote:
ok. thats what I have been trying to do. but cant get it right Im having to use the walk() proc and turfs to turn them because at times obsticals block off their way ..

I recommend A* Pathfinding.