Jump to content

Q: creature_movement synch issues


Recommended Posts

Hey, so I've been trying to get 3 mobs to walk alongside each other in a given path. The thing is they're turning, which means the path is of different lengths for each mob. This results in the mobs, after walking for a while, getting out of synch.

I have been trying to get them in synch by testing various values on wait time, and the more I try the closer I get; but since they walk back and forth they eventually get out of synch it seems, no matter how much I tweek the wait times.

So, my question is simply; is there some way, say through a script or something, to get them to go in synch? I'm thinking of two possible options:

1) A rendezvous point, where the mobs all wait until the three of them have reached their corresponding point.

2) Modified speed on the shorter pathed mob and the in the middle mob.

Are either of these solutions doable? And if so, care to give me a hint? Been looking all over to find a solution, but to no avail.

Huge thanks to anyone able to answer my question.

(P.S. Just noticed that creature_linking_template has a FLAG_FOLLOW, is that something I could apply here?)

Link to comment
Share on other sites

Rendevous point would maybe be a good temp solution, but you have to code it well ( which is maybe harder then it seems ) else they still get out of sync ( there're for example timers creatures have to wait at one point before moving to another but this won't do the trick ).

But anyway the problem is related to the follow system in my opinion. This isn't smooth, you can't create creature formations in a nice and smooth way, which almost every dungeon and raid contains ( patrols ). This can't be done using waypoint because they will get out of sync when you're waitin some minutes.

In my opinion a really big issue of MaNGOS because other cores 2/3 years ago already had this feature.

Link to comment
Share on other sites

The table creature_linking_template won't do the trick, because it only works for entry id's and not for GUID's. Even if creature_linking_template worked with GUID's, it would still mess up because of the "bad" follow system, the creature's follow their master with a distance of 10-20 yards and not smooth at all.

Link to comment
Share on other sites

Don't mean to bump my own question, but I'm looking for some information about trying to modify the core to allow better group patrolling.

Anyone have any idea or tip for me? Lost atm, tried a lot of stuff, but don't really know how I could get the patrols in synch.

So, I'm basically looking for some brain storming; if you have ever thought about implementing something that would make mobs go in synch, or if you have a clue how it might be done, please do share some of that information. I really need it :).


Link to comment
Share on other sites

Okay, so I solved this problem now. In case anyone is looking for a way to do this, I'll briefly go over what I did.

1. I started out with rewriting the CreatureLinkingMgr to use GUID rather than entry ID (don't really get why it was entry ID to begin with :o).

2. Then I added an update function to the LinkingMgr's holder class, as well as made the creature class call that function every 2.5 secs if it was a) a slave and b) had the follow flag. So the creature update function would be something like this:


if (m_creatureLinkingSlaveFollower) // AddSlaveToHolder() now returns bool if it needs regular updating


if (m_creatureLinkingSlaveTimer < update_diff)



m_creatureLinkingSlaveTimer = 2500;



m_creatureLinkingSlaveTimer -= update_diff;


3.In the CreatureLinkingMgr's update function I check if distance is further than max_dist (which is a new float added to the creature_linking_template), and if it is I use MovePoint to catch up, kind of like this:

if (!pWho || !pWhom) return;

// (left out get delta x and y for space)

float dist = sqrt(dx*dx + dy*dy);

dist = dist - pWho->GetObjectBoundingRadius() - pWhom->GetObjectBoundingRadius();

if (dist < 0.0f) dist = 0.0f;

CreatureLinkingInfo const *pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pWho);

if (dist < pInfo->max_dist) return;

pWho->GetMotionMaster()->MovePoint(0, pWhom->GetPositionX(), pWhom->GetPositionY(), pWhom->GetPositionZ());

4.The last touch was to get the creature to pickup the waypoint system (so it wouldn't wanna keep going back to the old WPs), the first touch was another HasInArc function with different parameters:

bool HasInArc( const float arcangle, const float posAngle ) const; // So we don't have to use a game object

5.The last part was adding some extra code to the WaypointMovementGenerator.cpp. It's split up like this:


m_arrivedAsIntended = true; // We did not get interrupted by MovePoint


if (creature.IsLinkingFollower() && !m_arrivedAsIntended)


for whole i_path list:


// Is this WP closer than the last? And, is it also in front of us (we don't wanna be going back)

if (newDist < distance && creature.HasInArc(M_PI_F, angle))

closestWP = this one; dist = newDist;


i_currentNode = closestWP;


m_arrivedAsIntended = false;

And that is the mist of the system. It's not the most delicate system, but at least it works.

Hope this helps someone in a similar pickle.

Link to comment
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use