44
55/* ScriptData
66SDName: FollowerAI
7- SD%Complete: 50
7+ SD%Complete: 60
88SDComment: This AI is under development
99SDCategory: Npc
1010EndScriptData */
@@ -37,9 +37,6 @@ void FollowerAI::AttackStart(Unit* pWho)
3737 m_creature->SetInCombatWith (pWho);
3838 pWho->SetInCombatWith (m_creature);
3939
40- if (m_creature->hasUnitState (UNIT_STAT_FOLLOW ))
41- m_creature->clearUnitState (UNIT_STAT_FOLLOW );
42-
4340 if (IsCombatMovement ())
4441 m_creature->GetMotionMaster ()->MoveChase (pWho);
4542 }
@@ -129,8 +126,8 @@ void FollowerAI::JustDied(Unit* pKiller)
129126 {
130127 if (Player* pMember = pRef->getSource ())
131128 {
132- if (pPlayer ->GetQuestStatus (m_pQuestForFollow->GetQuestId ()) == QUEST_STATUS_INCOMPLETE )
133- pPlayer ->FailQuest (m_pQuestForFollow->GetQuestId ());
129+ if (pMember ->GetQuestStatus (m_pQuestForFollow->GetQuestId ()) == QUEST_STATUS_INCOMPLETE )
130+ pMember ->FailQuest (m_pQuestForFollow->GetQuestId ());
134131 }
135132 }
136133 }
@@ -339,10 +336,8 @@ Player* FollowerAI::GetLeaderForFollower()
339336
340337void FollowerAI::SetFollowComplete (bool bWithEndEvent)
341338{
342- if (m_creature->hasUnitState ( UNIT_STAT_FOLLOW ) )
339+ if (m_creature->GetMotionMaster ()-> GetCurrentMovementGeneratorType () == FOLLOW_MOTION_TYPE )
343340 {
344- m_creature->clearUnitState (UNIT_STAT_FOLLOW );
345-
346341 m_creature->StopMoving ();
347342 m_creature->GetMotionMaster ()->Clear ();
348343 m_creature->GetMotionMaster ()->MoveIdle ();
@@ -368,10 +363,8 @@ void FollowerAI::SetFollowPaused(bool bPaused)
368363 {
369364 AddFollowState (STATE_FOLLOW_PAUSED );
370365
371- if (m_creature->hasUnitState ( UNIT_STAT_FOLLOW ) )
366+ if (m_creature->GetMotionMaster ()-> GetCurrentMovementGeneratorType () == FOLLOW_MOTION_TYPE )
372367 {
373- m_creature->clearUnitState (UNIT_STAT_FOLLOW );
374-
375368 m_creature->StopMoving ();
376369 m_creature->GetMotionMaster ()->Clear ();
377370 m_creature->GetMotionMaster ()->MoveIdle ();
0 commit comments