aGruttoothrunt.lua 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. require "SpawnScripts/Generic/NPCModule"
  10. function spawn(NPC, Spawn)
  11. NPCModule(NPC, Spawn)
  12. ChooseMovement(NPC)
  13. end
  14. function ChooseMovement(NPC)
  15. local route = math.random(1,4)
  16. if route == 1 then
  17. RouteOne(NPC, Spawn)
  18. elseif route == 2 then
  19. RouteTwo(NPC, Spawn)
  20. elseif route == 3 then
  21. RouteThree(NPC, Spawn)
  22. elseif route == 4 then
  23. RouteFour(NPC, Spawn)
  24. end
  25. end
  26. function RouteOne(NPC, Spawn)
  27. local X = GetX(NPC)
  28. local Y = GetY(NPC)
  29. local Z = GetZ(NPC)
  30. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  31. MovementLoopAddLocation(NPC, X + 12, Y, Z, 2,math.random(5,10))
  32. MovementLoopAddLocation(NPC, X + 12, Y, Z + 4, 2 , 15 , "InitialPause")
  33. MovementLoopAddLocation(NPC, X + 14, Y, Z, 2, math.random(5,10))
  34. MovementLoopAddLocation(NPC, X + 5, Y, Z + 4, 4, math.random(5,10), "InitialPause")
  35. MovementLoopAddLocation(NPC, X, Y, Z, 4, 15 ,"ChooseMovement")
  36. end
  37. function RouteTwo(NPC, Spawn)
  38. local X = GetX(NPC)
  39. local Y = GetY(NPC)
  40. local Z = GetZ(NPC)
  41. MovementLoopAddLocation(NPC, X, Y, Z, 2, 15 , "InitialPause")
  42. MovementLoopAddLocation(NPC, X - 5, Y, Z, 2, math.random(5,10))
  43. MovementLoopAddLocation(NPC, X - 14, Y, Z - 4, 4, math.random(5,10))
  44. MovementLoopAddLocation(NPC, X - 12, Y, Z, 2, 15 , "InitialPause")
  45. MovementLoopAddLocation(NPC, X - 12, Y, Z - 4, 2, math.random(5,10))
  46. MovementLoopAddLocation(NPC, X, Y, Z, 1, 0, "ChooseMovement")
  47. end
  48. function RouteThree(NPC, Spawn)
  49. local X = GetX(NPC)
  50. local Y = GetY(NPC)
  51. local Z = GetZ(NPC)
  52. MovementLoopAddLocation(NPC, X, Y, Z, 2, 15 , "InitialPause")
  53. MovementLoopAddLocation(NPC, X + 12, Y, Z, 4, math.random(5,10))
  54. MovementLoopAddLocation(NPC, X + 5, Y, Z - 4, 2, math.random(5,10))
  55. MovementLoopAddLocation(NPC, X + 14, Y, Z, 2, 15 , "InitialPause")
  56. MovementLoopAddLocation(NPC, X + 12, Y, Z - 4, 4, math.random(5,10))
  57. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10), "ChooseMovement")
  58. end
  59. function RouteFour(NPC, Spawn)
  60. local X = GetX(NPC)
  61. local Y = GetY(NPC)
  62. local Z = GetZ(NPC)
  63. MovementLoopAddLocation(NPC, X, Y, Z, 4, math.random(5,10))
  64. MovementLoopAddLocation(NPC, X - 12, Y, Z, 2, 15 , "InitialPause")
  65. MovementLoopAddLocation(NPC, X - 5, Y, Z + 4, 2, math.random(5,10))
  66. MovementLoopAddLocation(NPC, X - 14, Y, Z, 4, math.random(5,10))
  67. MovementLoopAddLocation(NPC, X - 12, Y, Z + 4, 2, 15 , "InitialPause")
  68. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10), "ChooseMovement")
  69. end
  70. function respawn(NPC, Spawn)
  71. spawn(NPC)
  72. end
  73. function hailed(NPC, Spawn)
  74. FaceTarget(NPC, Spawn)
  75. end
  76. function InitialPause(NPC)
  77. math.randomseed(os.time())
  78. local pause = math.random (1, 4)
  79. if pause == 1 then
  80. AddTimer(NPC, 100, "stop_gathering")
  81. else
  82. AddTimer(NPC, 1000, "Gather")
  83. end
  84. end
  85. function Gather(NPC)
  86. -- SpawnSet(NPC, "visual_state", "gathering_search") -- Start gathering
  87. PlayFlavor(NPC,"","","gathering_search",0,0)
  88. AddTimer(NPC, 8000, "Collect") -- for 5 seconds, then stop
  89. end
  90. function Collect(NPC)
  91. -- SpawnSet(NPC, "visual_state", "gathering_success") -- Start gathering
  92. PlayFlavor(NPC,"","","gathering_success",0,0)
  93. AddTimer(NPC, 2000, "stop_gathering") -- for 5 seconds, then stop
  94. end
  95. function stop_gathering(NPC)
  96. SpawnSet(NPC, "visual_state", "0") -- Stop gathering
  97. end
  98. function aggro(NPC,Spawn)
  99. SpawnSet(NPC, "visual_state", "0") -- Stop gathering
  100. end