9
3

Greybul.lua 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. --[[
  2. Script Name : SpawnScripts/Nettleville/Greybul.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.06.19 06:06:15
  5. Script Purpose :
  6. :
  7. --]]
  8. local AttackTimer = false
  9. function spawn(NPC)
  10. waypoints(NPC)
  11. SetPlayerProximityFunction(NPC,3, "InRange", "LeaveRange")
  12. end
  13. function hailed(NPC, Spawn)
  14. if AttackTimer == false then
  15. AttackTimer = true
  16. FaceTarget(NPC,Spawn)
  17. PlayFlavor(NPC, "", "", "attack", 0, 0)
  18. AddTimer(NPC,10000,"AttackTimerReset")
  19. end
  20. end
  21. function InRange(NPC,Spawn)
  22. if AttackTimer == false then
  23. if math.random(1,100) <=20 then
  24. AttackTimer = true
  25. FaceTarget(NPC,Spawn)
  26. PlayFlavor(NPC, "", "", "attack", 0, 0)
  27. AddTimer(NPC,25000,"AttackTimerReset")
  28. end
  29. end
  30. end
  31. function Sleep(NPC)
  32. local choice = math.random(1,2)
  33. if choice == 1 then
  34. SpawnSet(NPC, "action_state", 540)
  35. AddTimer(NPC, 22000, "Wake")
  36. AttackTimer = true
  37. elseif choice ==2 then
  38. end
  39. end
  40. function Wake(NPC)
  41. SpawnSet(NPC, "action_state", 0)
  42. AttackTimer = false
  43. end
  44. function AttackTimerReset(NPC,Spawn)
  45. AttackTimer = false
  46. end
  47. function respawn(NPC)
  48. spawn(NPC)
  49. end
  50. function waypoints(NPC)
  51. MovementLoopAddLocation(NPC, 686.5, -35.01, 343.35, 1, 25,"Sleep")
  52. MovementLoopAddLocation(NPC, 684.08, -35.71, 339.32, 1, 25)
  53. MovementLoopAddLocation(NPC, 684.32, -34.47, 327.75, 1, 15)
  54. MovementLoopAddLocation(NPC, 687.05, -34.48, 328.51, 1, 25,"Sleep")
  55. MovementLoopAddLocation(NPC, 690.05, -30.47, 342.64, 1, 0)
  56. MovementLoopAddLocation(NPC, 690.27, -30.45, 343.05, 1, 1)
  57. MovementLoopAddLocation(NPC, 690.27, -30.45, 343.05, 1, 2,"AttackRat")
  58. MovementLoopAddLocation(NPC, 690.27, -30.45, 343.05, 1, 1,"Rat")
  59. MovementLoopAddLocation(NPC, 705.34, -27.26, 339.5, 6, 0)
  60. MovementLoopAddLocation(NPC, 702.6, -24.09, 329.17, 6, 0)
  61. MovementLoopAddLocation(NPC, 687.08, -20.42, 333.46, 6, 0)
  62. MovementLoopAddLocation(NPC, 684.33, -20.42, 335.94, 6, 0)
  63. MovementLoopAddLocation(NPC, 671.21, -20.52, 328.9, 6, 0)
  64. MovementLoopAddLocation(NPC, 668.27, -20.46, 330.07, 6, 1)
  65. MovementLoopAddLocation(NPC, 668.27, -20.46, 330.07, 6, 2,"AttackRat")
  66. MovementLoopAddLocation(NPC, 668.27, -20.46, 330.07, 6, 2,"DespawnRat")
  67. MovementLoopAddLocation(NPC, 667.05, -20.46, 331.19, 6, 16)
  68. MovementLoopAddLocation(NPC, 668.95, -20.47, 328.88, 1, 0)
  69. MovementLoopAddLocation(NPC, 671.65, -20.52, 329.14, 1, 0)
  70. MovementLoopAddLocation(NPC, 675.08, -20.52, 336.21, 1, 2)
  71. MovementLoopAddLocation(NPC, 675.08, -20.52, 336.21, 1, 25,"Sleep")
  72. MovementLoopAddLocation(NPC, 678.68, -20.42, 336.2, 1, 0)
  73. MovementLoopAddLocation(NPC, 685.32, -20.36, 338.68, 1, 25)
  74. MovementLoopAddLocation(NPC, 687.72, -20.41, 333.58, 1, 0)
  75. MovementLoopAddLocation(NPC, 693.49, -20.46, 332.06, 1, 0)
  76. MovementLoopAddLocation(NPC, 702.24, -24.04, 329.74, 1, 0)
  77. MovementLoopAddLocation(NPC, 703.46, -24.03, 330.43, 1, 0)
  78. MovementLoopAddLocation(NPC, 707.39, -27.22, 339.06, 1, 0)
  79. MovementLoopAddLocation(NPC, 706.67, -27.23, 341.76, 1, 2)
  80. MovementLoopAddLocation(NPC, 706.67, -27.23, 341.76, 1, 25,"Sleep")
  81. MovementLoopAddLocation(NPC, 697.47, -30.2, 343.68, 1, 0)
  82. MovementLoopAddLocation(NPC, 689.13, -30.44, 344.11, 1, 2)
  83. MovementLoopAddLocation(NPC, 689.13, -30.44, 344.11, 1, 25,"Sleep")
  84. MovementLoopAddLocation(NPC, 688.02, -34.48, 331.94, 1, 0)
  85. MovementLoopAddLocation(NPC, 684.8, -34.47, 327.88, 1, 2)
  86. MovementLoopAddLocation(NPC, 684.8, -34.47, 327.88, 1, 25,"Sleep")
  87. MovementLoopAddLocation(NPC, 684.55, -34.74, 333.41, 1, 0)
  88. MovementLoopAddLocation(NPC, 683.4, -35.7, 336.4, 1, 2)
  89. MovementLoopAddLocation(NPC, 683.4, -35.7, 336.4, 1, 25,"Sleep")
  90. MovementLoopAddLocation(NPC, 681.85, -35.79, 331.65, 1, 0)
  91. MovementLoopAddLocation(NPC, 686.5, -35.01, 343.35, 1, 0)
  92. MovementLoopAddLocation(NPC, 686.5, -35.01, 343.35, 1, 0)
  93. MovementLoopAddLocation(NPC, 684.08, -35.71, 339.32, 1, 2)
  94. MovementLoopAddLocation(NPC, 684.08, -35.71, 339.32, 1, 25,"Sleep")
  95. MovementLoopAddLocation(NPC, 684.32, -34.47, 327.75, 1, 15)
  96. MovementLoopAddLocation(NPC, 687.05, -34.48, 328.51, 1, 25)
  97. MovementLoopAddLocation(NPC, 690.05, -30.47, 342.64, 1, 0)
  98. MovementLoopAddLocation(NPC, 690.27, -30.45, 343.05, 1, 0)
  99. MovementLoopAddLocation(NPC, 705.34, -27.26, 339.5, 1, 2)
  100. MovementLoopAddLocation(NPC, 705.34, -27.26, 339.5, 1, 25,"Sleep")
  101. MovementLoopAddLocation(NPC, 702.6, -24.09, 329.17, 1, 0)
  102. MovementLoopAddLocation(NPC, 687.08, -20.42, 333.46, 1, 0)
  103. MovementLoopAddLocation(NPC, 684.33, -20.42, 335.94, 1, 0)
  104. MovementLoopAddLocation(NPC, 671.21, -20.52, 328.9, 1, 0)
  105. MovementLoopAddLocation(NPC, 680.57, -20.34, 323.36,1, 2)
  106. MovementLoopAddLocation(NPC, 680.57, -20.34, 323.36,1, 25,"Sleep")
  107. MovementLoopAddLocation(NPC, 668.95, -20.47, 328.88, 1, 0)
  108. MovementLoopAddLocation(NPC, 671.65, -20.52, 329.14, 1, 0)
  109. MovementLoopAddLocation(NPC, 675.08, -20.52, 336.21, 1, 2)
  110. MovementLoopAddLocation(NPC, 675.08, -20.52, 336.21, 1, 25,"Sleep")
  111. MovementLoopAddLocation(NPC, 678.68, -20.42, 336.2, 1, 0)
  112. MovementLoopAddLocation(NPC, 685.32, -20.36, 338.68, 1, 2)
  113. MovementLoopAddLocation(NPC, 685.32, -20.36, 338.68, 1, 25,"Sleep")
  114. MovementLoopAddLocation(NPC, 687.72, -20.41, 333.58, 1, 0)
  115. MovementLoopAddLocation(NPC, 693.49, -20.46, 332.06, 1, 0)
  116. MovementLoopAddLocation(NPC, 702.24, -24.04, 329.74, 1, 0)
  117. MovementLoopAddLocation(NPC, 703.46, -24.03, 330.43, 1, 0)
  118. MovementLoopAddLocation(NPC, 707.39, -27.22, 339.06, 1, 0)
  119. MovementLoopAddLocation(NPC, 706.67, -27.23, 341.76, 1, 2)
  120. MovementLoopAddLocation(NPC, 706.67, -27.23, 341.76, 1, 25,"Sleep")
  121. MovementLoopAddLocation(NPC, 697.47, -30.2, 343.68, 1, 0)
  122. MovementLoopAddLocation(NPC, 689.13, -30.44, 344.11, 1, 2)
  123. MovementLoopAddLocation(NPC, 689.13, -30.44, 344.11, 1, 25,"Sleep")
  124. MovementLoopAddLocation(NPC, 688.02, -34.48, 331.94, 1, 0)
  125. MovementLoopAddLocation(NPC, 684.8, -34.47, 327.88, 1, 2)
  126. MovementLoopAddLocation(NPC, 684.8, -34.47, 327.88, 1, 25,"Sleep")
  127. MovementLoopAddLocation(NPC, 684.55, -34.74, 333.41, 1, 0)
  128. MovementLoopAddLocation(NPC, 683.4, -35.7, 336.4, 1, 25,"Sleep")
  129. MovementLoopAddLocation(NPC, 681.85, -35.79, 331.65, 1, 0)
  130. end
  131. function AttackRat(NPC,Spawn)
  132. AttackTimer = true
  133. PlayFlavor(NPC,"","","attack",0,0)
  134. AddTimer(NPC,30000,"AttackTimerReset")
  135. end
  136. function Rat(NPC,Spawn)
  137. local rat = GetSpawn(NPC,2330138)
  138. if rat ~=nil then
  139. SetTarget(NPC,rat)
  140. PlayFlavor(rat,"","","attack",0,0)
  141. MovementLoopAddLocation(rat, 705.34, -27.26, 339.5, 6, 0)
  142. MovementLoopAddLocation(rat, 702.6, -24.09, 329.17, 6, 0)
  143. MovementLoopAddLocation(rat, 687.08, -20.42, 333.46, 6, 0)
  144. MovementLoopAddLocation(rat, 684.33, -20.42, 335.94, 6, 0)
  145. MovementLoopAddLocation(rat, 671.21, -20.52, 328.9, 6, 0)
  146. MovementLoopAddLocation(rat, 668.27, -20.46, 330.07, 6, 4)
  147. MovementLoopAddLocation(rat, 667.57, -20.46, 330.85, 6, 15)
  148. end
  149. end
  150. function DespawnRat(NPC,Spawn)
  151. local rat = GetSpawn(NPC,2330138)
  152. if rat ~=nil then
  153. KillSpawn(rat,NPC)
  154. end
  155. end