9
3

random_pattern_medium_short_delay.lua 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. --[[
  2. Script Name : SpawnScripts/Generic/random_pattern_medium_short_delay.lua
  3. Script Author : LordPazuzu
  4. Script Date : 2022.05.21 04:05:01
  5. Script Purpose :
  6. :
  7. --]]
  8. dofile("SpawnScripts/Generic/CatalogueQuestUpdates.lua")
  9. require "SpawnScripts/Generic/CombatModule"
  10. function spawn(NPC, Spawn)
  11. combatModule(NPC, Spawn)
  12. AddTimer(NPC, 6000, "ChooseMovement")
  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, 0)
  31. MovementLoopAddLocation(NPC, X + 14, Y, Z, 2,0)
  32. MovementLoopAddLocation(NPC, X + 14, Y, Z + 4, 2, 5)
  33. MovementLoopAddLocation(NPC, X + 20, Y, Z, 2, 0)
  34. MovementLoopAddLocation(NPC, X + 14, Y, Z + 4, 2, 0)
  35. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10), "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, 0)
  42. MovementLoopAddLocation(NPC, X - 14, Y, Z, 2, 0)
  43. MovementLoopAddLocation(NPC, X - 14, Y, Z - 4, 2, 5)
  44. MovementLoopAddLocation(NPC, X - 20, Y, Z, 2, 0)
  45. MovementLoopAddLocation(NPC, X - 14, Y, Z - 4, 2, 0)
  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, 0)
  53. MovementLoopAddLocation(NPC, X + 14, Y, Z, 2, 0)
  54. MovementLoopAddLocation(NPC, X + 14, Y, Z - 4, 2, 5)
  55. MovementLoopAddLocation(NPC, X + 20, Y, Z, 2, 0)
  56. MovementLoopAddLocation(NPC, X + 14, Y, Z - 4, 2, 0)
  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, 2, 0)
  64. MovementLoopAddLocation(NPC, X - 14, Y, Z, 2, 0)
  65. MovementLoopAddLocation(NPC, X - 14, Y, Z + 4, 2, 5)
  66. MovementLoopAddLocation(NPC, X - 20, Y, Z, 2, 0)
  67. MovementLoopAddLocation(NPC, X - 14, Y, Z + 4, 2, 0)
  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