afaerieguardianroam.lua 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. --[[
  2. Script Name : SpawnScripts/PeatBog/afaerieguardianroam.lua
  3. Script Author : LordPazuzu
  4. Script Date : 2022.05.24 11:05:16
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. local Level = GetLevel(NPC)
  10. local level1 =11
  11. local level2 = 12
  12. local difficulty1 = 6
  13. local hp1 = 430
  14. local power1 = 160
  15. local difficulty2 = 6
  16. local hp2 = 450
  17. local power2 = 190
  18. if Level == level1 then
  19. SpawnSet(NPC, "difficulty", difficulty1)
  20. SpawnSet(NPC, "hp", hp1)
  21. SpawnSet(NPC, "power", power1)
  22. elseif Level == level2
  23. then
  24. SpawnSet(NPC, "difficulty", difficulty2)
  25. SpawnSet(NPC, "hp", hp2)
  26. SpawnSet(NPC, "power", power2)
  27. end
  28. ChooseMovement(NPC)
  29. end
  30. function ChooseMovement(NPC)
  31. local route = math.random(1,4)
  32. if route == 1 then
  33. RouteOne(NPC, Spawn)
  34. elseif route == 2 then
  35. RouteTwo(NPC, Spawn)
  36. elseif route == 3 then
  37. RouteThree(NPC, Spawn)
  38. elseif route == 4 then
  39. RouteFour(NPC, Spawn)
  40. end
  41. end
  42. function RouteOne(NPC, Spawn)
  43. local X = GetX(NPC)
  44. local Y = GetY(NPC)
  45. local Z = GetZ(NPC)
  46. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  47. MovementLoopAddLocation(NPC, X + 7, Y, Z, 2, math.random(5,10))
  48. MovementLoopAddLocation(NPC, X + 7, Y, Z + 4, 2, math.random(5,10))
  49. MovementLoopAddLocation(NPC, X + 14, Y, Z, 2, math.random(5,10))
  50. MovementLoopAddLocation(NPC, X + 7, Y, Z + 4, 2, math.random(5,10))
  51. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  52. end
  53. function RouteTwo(NPC, Spawn)
  54. local X = GetX(NPC)
  55. local Y = GetY(NPC)
  56. local Z = GetZ(NPC)
  57. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  58. MovementLoopAddLocation(NPC, X - 7, Y, Z, 2, math.random(5,10))
  59. MovementLoopAddLocation(NPC, X - 7, Y, Z - 4, 2, math.random(5,10))
  60. MovementLoopAddLocation(NPC, X - 14, Y, Z, 2, math.random(5,10))
  61. MovementLoopAddLocation(NPC, X - 7, Y, Z - 4, 2, math.random(5,10))
  62. MovementLoopAddLocation(NPC, X, Y, Z, 1, math.random(5,10))
  63. end
  64. function RouteThree(NPC, Spawn)
  65. local X = GetX(NPC)
  66. local Y = GetY(NPC)
  67. local Z = GetZ(NPC)
  68. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  69. MovementLoopAddLocation(NPC, X + 7, Y, Z, 2, math.random(5,10))
  70. MovementLoopAddLocation(NPC, X + 7, Y, Z - 4, 2, math.random(5,10))
  71. MovementLoopAddLocation(NPC, X + 14, Y, Z, 2, math.random(5,10))
  72. MovementLoopAddLocation(NPC, X + 7, Y, Z - 4, 2, math.random(5,10))
  73. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  74. end
  75. function RouteFour(NPC, Spawn)
  76. local X = GetX(NPC)
  77. local Y = GetY(NPC)
  78. local Z = GetZ(NPC)
  79. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  80. MovementLoopAddLocation(NPC, X - 7, Y, Z, 2, math.random(5,10))
  81. MovementLoopAddLocation(NPC, X - 7, Y, Z + 4, 2, math.random(5,10))
  82. MovementLoopAddLocation(NPC, X - 14, Y, Z, 2, math.random(5,10))
  83. MovementLoopAddLocation(NPC, X - 7, Y, Z + 4, 2, math.random(5,10))
  84. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  85. end
  86. function respawn(NPC, Spawn)
  87. spawn(NPC)
  88. end
  89. function hailed(NPC, Spawn)
  90. FaceTarget(NPC, Spawn)
  91. end