1. #include "ScriptPCH.h"
  2. class npc_waypoint : public CreatureScript
  3. {
  4. public:
  5. npc_waypoint() : CreatureScript("npc_waypoint") { }
  6. struct npc_waypointAI : public ScriptedAI
  7. {
  8. npc_waypointAI(Creature * c) : ScriptedAI(c) { }
  9. int moveCount;
  10. void Reset()
  11. {
  12. moveCount = 0;
  13. me->SetSpeed(MOVE_RUN, 1.0f, true);
  14. }
  15. void MovementInform(uint32 type, uint32 id)
  16. {
  17. if (type != POINT_MOTION_TYPE)
  18. return;
  19. moveCount++;
  20. }
  21. void UpdateAI(uint32 const diff)
  22. {
  23. switch(moveCount)
  24. {
  25. case 0:
  26. me->GetMotionMaster()->MovePoint(0, -13179.666016f, 316.836945f, 33.242424f);
  27. break;
  28. case 1:
  29. me->GetMotionMaster()->MovePoint(0, -13198.463867f, 323.198944f, 33.242424f);
  30. break;
  31. case 2:
  32. me->GetMotionMaster()->MovePoint(0, -13215.075195f, 323.894623f, 33.242462f);
  33. break;
  34. case 3:
  35. me->GetMotionMaster()->MovePoint(0, -13234.995117f, 314.123047f, 33.220901f);
  36. break;
  37. case 4:
  38. me->GetMotionMaster()->MovePoint(0, -13249.653320f, 297.987000f, 33.241779f);
  39. me->MonsterYell("Test!", LANG_UNIVERSAL, me->GetGUID());
  40. break;
  41. case 5:
  42. me->GetMotionMaster()->MovePoint(0, -13254.754883f, 282.916412f, 33.242786f);
  43. me->MonsterYell("Test2!", LANG_UNIVERSAL, me->GetGUID());
  44. me->setFaction(14);
  45. break;
  46. }
  47. DoMeleeAttackIfReady();
  48. }
  49. };
  50. CreatureAI * GetAI(Creature * pCreature) const
  51. {
  52. return new npc_waypointAI(pCreature);
  53. }
  54. };
  55. void AddSC_npc_waypoint()
  56. {
  57. new npc_waypoint();
  58. }