9
3

aGruttoothrunt.lua 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. --[[
  2. Script Name : SpawnScripts/IsleRefuge1/aGruttoothrunt.lua
  3. Script Author : LordPazuzu
  4. Script Date : 2022.09.05 05:09:30
  5. Script Purpose :
  6. :
  7. --]]
  8. dofile("SpawnScripts/Generic/MonsterCallouts/BaseGoblin2.lua")
  9. function spawn(NPC)
  10. ChooseMovement(NPC)
  11. end
  12. function ChooseMovement(NPC)
  13. local route = math.random(1,4)
  14. if route == 1 then
  15. RouteOne(NPC, Spawn)
  16. elseif route == 2 then
  17. RouteTwo(NPC, Spawn)
  18. elseif route == 3 then
  19. RouteThree(NPC, Spawn)
  20. elseif route == 4 then
  21. RouteFour(NPC, Spawn)
  22. end
  23. end
  24. function RouteOne(NPC, Spawn)
  25. local X = GetX(NPC)
  26. local Y = GetY(NPC)
  27. local Z = GetZ(NPC)
  28. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  29. MovementLoopAddLocation(NPC, X + 12, Y, Z, 2,math.random(5,10))
  30. MovementLoopAddLocation(NPC, X + 12, Y, Z + 4, 2 , 15 , "InitialPause")
  31. MovementLoopAddLocation(NPC, X + 14, Y, Z, 2, math.random(5,10))
  32. MovementLoopAddLocation(NPC, X + 5, Y, Z + 4, 4, math.random(5,10))
  33. MovementLoopAddLocation(NPC, X, Y, Z, 4, 15 , "InitialPause")
  34. end
  35. function RouteTwo(NPC, Spawn)
  36. local X = GetX(NPC)
  37. local Y = GetY(NPC)
  38. local Z = GetZ(NPC)
  39. MovementLoopAddLocation(NPC, X, Y, Z, 2, 15 , "InitialPause")
  40. MovementLoopAddLocation(NPC, X - 5, Y, Z, 2, math.random(5,10))
  41. MovementLoopAddLocation(NPC, X - 14, Y, Z - 4, 4, math.random(5,10))
  42. MovementLoopAddLocation(NPC, X - 12, Y, Z, 2, 15 , "InitialPause")
  43. MovementLoopAddLocation(NPC, X - 12, Y, Z - 4, 2, math.random(5,10))
  44. MovementLoopAddLocation(NPC, X, Y, Z, 1, 0)
  45. end
  46. function RouteThree(NPC, Spawn)
  47. local X = GetX(NPC)
  48. local Y = GetY(NPC)
  49. local Z = GetZ(NPC)
  50. MovementLoopAddLocation(NPC, X, Y, Z, 2, 15 , "InitialPause")
  51. MovementLoopAddLocation(NPC, X + 12, Y, Z, 4, math.random(5,10))
  52. MovementLoopAddLocation(NPC, X + 5, Y, Z - 4, 2, math.random(5,10))
  53. MovementLoopAddLocation(NPC, X + 14, Y, Z, 2, 15 , "InitialPause")
  54. MovementLoopAddLocation(NPC, X + 12, Y, Z - 4, 4, math.random(5,10))
  55. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  56. end
  57. function RouteFour(NPC, Spawn)
  58. local X = GetX(NPC)
  59. local Y = GetY(NPC)
  60. local Z = GetZ(NPC)
  61. MovementLoopAddLocation(NPC, X, Y, Z, 4, math.random(5,10))
  62. MovementLoopAddLocation(NPC, X - 12, Y, Z, 2, 15 , "InitialPause")
  63. MovementLoopAddLocation(NPC, X - 5, Y, Z + 4, 2, math.random(5,10))
  64. MovementLoopAddLocation(NPC, X - 14, Y, Z, 4, math.random(5,10))
  65. MovementLoopAddLocation(NPC, X - 12, Y, Z + 4, 2, 15 , "InitialPause")
  66. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  67. end
  68. function respawn(NPC, Spawn)
  69. spawn(NPC)
  70. end
  71. function hailed(NPC, Spawn)
  72. FaceTarget(NPC, Spawn)
  73. end
  74. function InitialPause(NPC)
  75. math.randomseed(os.time())
  76. local pause = math.random (1, 4)
  77. if pause == 1 then
  78. AddTimer(NPC, 100, "stop_gathering")
  79. else
  80. AddTimer(NPC, 1000, "Gather")
  81. end
  82. end
  83. function Gather(NPC)
  84. SpawnSet(NPC, "visual_state", "2809") -- Start gathering
  85. AddTimer(NPC, 8000, "Collect") -- for 5 seconds, then stop
  86. end
  87. function Collect(NPC)
  88. SpawnSet(NPC, "visual_state", "2810") -- Start gathering
  89. AddTimer(NPC, 2000, "stop_gathering") -- for 5 seconds, then stop
  90. end
  91. function stop_gathering(NPC)
  92. SpawnSet(NPC, "visual_state", "0") -- Stop gathering
  93. end
  94. function aggro(NPC,Spawn)
  95. SpawnSet(NPC, "visual_state", "0") -- Stop gathering
  96. end