1. /*
  2. http://emudevs.com
  3. */
  4. static Waypoints waypoints[] =
  5. {
  6. { },
  7. /* Splintertree NPC Waypoints */
  8. { 1, 2232.689f, -2540.322f, 87.151680f, 2.994325f },
  9. { 2, 2199.957f, -2525.335f, 81.887581f, 2.491666f },
  10. { 3, 2161.294f, -2499.362f, 79.792213f, 2.625184f },
  11. { 4, 2113.347f, -2470.833f, 81.907562f, 2.389565f },
  12. { 5, 2060.820f, -2421.534f, 87.170036f, 2.695870f },
  13. { 6, 2000.545f, -2395.062f, 89.300522f, 1.990349f },
  14. { 7, 1950.070f, -2280.594f, 91.488533f, 1.754730f },
  15. { 8, 1930.723f, -2163.582f, 93.615677f, 1.252074f },
  16. { 9, 1968.390f, -1995.599f, 96.493195f, 1.204951f },
  17. { 10, 2008.603f, -1899.979f, 98.502579f, 0.623756f },
  18. { 11, 2171.254f, -1783.098f, 101.723885f, 0.521654f },
  19. { 12, 2273.168f, -1724.195f, 114.672012f, 0.800470f },
  20. { 13, 2324.556f, -1669.796f, 124.625069f, 1.157827f },
  21. { 14, 2362.465f, -1553.154f, 125.286140f, 1.322760f },
  22. { 15, 2437.212f, -1325.737f, 125.279434f, 1.499475f },
  23. { 16, 2469.889f, -1155.896f, 125.181503f, 1.240294f },
  24. { 17, 2516.389f, -984.656f, 129.455795f, 1.562307f },
  25. { 18, 2513.096f, -875.639f, 134.581512f, 2.104232f },
  26. { 19, 2479.504f, -799.719f, 137.150238f, 1.727241f },
  27. { 20, 2445.496f, -557.477f, 115.004616f, 1.413082f },
  28. { 21, 2453.443f, -510.455f, 114.829971f, 0.352794f },
  29. { 22, 2632.077f, -448.599f, 106.659004f, 0.399918f }
  30. };
  31. class npcs_astranaar : public CreatureScript
  32. {
  33. public:
  34. npcs_astranaar() : CreatureScript("npcs_astranaar") { }
  35. struct npcs_astranaarAI : public ScriptedAI
  36. {
  37. npcs_astranaarAI(Creature * c) : ScriptedAI(c) { }
  38. int moved;
  39. void Reset()
  40. {
  41. moved = 0;
  42. me->SetSpeed(MOVE_RUN, 1.0f, true);
  43. }
  44. void MovementInform(uint32 type, uint32 id)
  45. {
  46. if (type != POINT_MOTION_TYPE)
  47. return;
  48. moved++;
  49. }
  50. void UpdateAI(uint32 const diff)
  51. {
  52. if(factionWar.activeBattle)
  53. {
  54. switch(moved)
  55. {
  56. case 0:
  57. me->GetMotionMaster()->MovePoint(1, waypoints[22].x, waypoints[22].y, waypoints[22].z);
  58. break;
  59. case 1:
  60. me->GetMotionMaster()->MovePoint(2, waypoints[21].x, waypoints[21].y, waypoints[21].z);
  61. break;
  62. case 2:
  63. me->GetMotionMaster()->MovePoint(3, waypoints[20].x, waypoints[20].y, waypoints[20].z);
  64. break;
  65. case 3:
  66. me->GetMotionMaster()->MovePoint(4, waypoints[19].x, waypoints[19].y, waypoints[19].z);
  67. break;
  68. case 4:
  69. me->GetMotionMaster()->MovePoint(5, waypoints[18].x, waypoints[18].y, waypoints[18].z);
  70. break;
  71. case 5:
  72. me->GetMotionMaster()->MovePoint(6, waypoints[17].x, waypoints[17].y, waypoints[17].z);
  73. break;
  74. case 6:
  75. me->GetMotionMaster()->MovePoint(7, waypoints[16].x, waypoints[16].y, waypoints[16].z);
  76. break;
  77. case 7:
  78. me->GetMotionMaster()->MovePoint(8, waypoints[15].x, waypoints[15].y, waypoints[15].z);
  79. break;
  80. case 8:
  81. me->GetMotionMaster()->MovePoint(9, waypoints[14].x, waypoints[14].y, waypoints[14].z);
  82. break;
  83. case 9:
  84. me->GetMotionMaster()->MovePoint(10, waypoints[13].x, waypoints[13].y, waypoints[13].z);
  85. break;
  86. case 10:
  87. me->GetMotionMaster()->MovePoint(11, waypoints[12].x, waypoints[12].y, waypoints[12].z);
  88. break;
  89. case 11:
  90. me->GetMotionMaster()->MovePoint(12, waypoints[11].x, waypoints[11].y, waypoints[11].z);
  91. break;
  92. case 12:
  93. me->GetMotionMaster()->MovePoint(13, waypoints[10].x, waypoints[10].y, waypoints[10].z);
  94. break;
  95. case 13:
  96. me->GetMotionMaster()->MovePoint(14, waypoints[9].x, waypoints[9].y, waypoints[9].z);
  97. break;
  98. case 14:
  99. me->GetMotionMaster()->MovePoint(15, waypoints[8].x, waypoints[8].y, waypoints[8].z);
  100. break;
  101. case 15:
  102. me->GetMotionMaster()->MovePoint(16, waypoints[7].x, waypoints[7].y, waypoints[7].z);
  103. break;
  104. case 16:
  105. me->GetMotionMaster()->MovePoint(17, waypoints[6].x, waypoints[6].y, waypoints[6].z);
  106. break;
  107. case 17:
  108. me->GetMotionMaster()->MovePoint(18, waypoints[5].x, waypoints[5].y, waypoints[5].z);
  109. break;
  110. case 18:
  111. me->GetMotionMaster()->MovePoint(19, waypoints[4].x, waypoints[4].y, waypoints[4].z);
  112. break;
  113. case 19:
  114. me->GetMotionMaster()->MovePoint(20, waypoints[3].x, waypoints[3].y, waypoints[3].z);
  115. break;
  116. case 20:
  117. me->GetMotionMaster()->MovePoint(21, waypoints[2].x, waypoints[2].y, waypoints[2].z);
  118. break;
  119. case 21:
  120. me->GetMotionMaster()->MovePoint(22, waypoints[1].x, waypoints[1].y, waypoints[1].z);
  121. moved = 22;
  122. break;
  123. }
  124. }
  125. DoMeleeAttackIfReady();
  126. }
  127. };
  128. CreatureAI * GetAI(Creature * pCreature) const
  129. {
  130. return new npcs_astranaarAI(pCreature);
  131. }
  132. };

EmuDevs - Example