OlOneEye.lua 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. --[[
  2. Script Name : SpawnScripts/Antonica/OlOneEye.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.08.13 07:08:33
  5. Script Purpose :
  6. :
  7. --]]
  8. local TheOneThatGotAway = 5338
  9. function ChooseMovement(NPC)
  10. local route = math.random(1,4)
  11. if route == 1 then
  12. RouteOne(NPC, Spawn)
  13. elseif route == 2 then
  14. RouteTwo(NPC, Spawn)
  15. elseif route == 3 then
  16. RouteThree(NPC, Spawn)
  17. elseif route == 4 then
  18. RouteFour(NPC, Spawn)
  19. end
  20. end
  21. function RouteOne(NPC, Spawn)
  22. local X = GetX(NPC)
  23. local Y = GetY(NPC)
  24. local Z = GetZ(NPC)
  25. MovementLoopAddLocation(NPC, X, Y, Z, 2, 0)
  26. MovementLoopAddLocation(NPC, X + 5, Y, Z, 2,0)
  27. MovementLoopAddLocation(NPC, X , Y, Z + 8, 2, 0)
  28. MovementLoopAddLocation(NPC, X + 5, Y, Z -5, 2, 0)
  29. MovementLoopAddLocation(NPC, X + 8, Y, Z + 4, 2, 0)
  30. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10), "ChooseMovement")
  31. end
  32. function RouteTwo(NPC, Spawn)
  33. local X = GetX(NPC)
  34. local Y = GetY(NPC)
  35. local Z = GetZ(NPC)
  36. MovementLoopAddLocation(NPC, X, Y, Z, 2, 0)
  37. MovementLoopAddLocation(NPC, X - 8, Y, Z, 2, 0)
  38. MovementLoopAddLocation(NPC, X, Y, Z - 8, 2, 0)
  39. MovementLoopAddLocation(NPC, X - 5, Y, Z -5, 2, 0)
  40. MovementLoopAddLocation(NPC, X , Y, Z - 4, 2, 0)
  41. MovementLoopAddLocation(NPC, X, Y, Z, 1, 0, "ChooseMovement")
  42. end
  43. function RouteThree(NPC, Spawn)
  44. local X = GetX(NPC)
  45. local Y = GetY(NPC)
  46. local Z = GetZ(NPC)
  47. MovementLoopAddLocation(NPC, X, Y, Z, 2, 0)
  48. MovementLoopAddLocation(NPC, X + 5, Y, Z, 2, 0)
  49. MovementLoopAddLocation(NPC, X -8, Y, Z - 4, 2, 0)
  50. MovementLoopAddLocation(NPC, X + 8, Y, Z -5, 2, 0)
  51. MovementLoopAddLocation(NPC, X + 5, Y, Z - 5, 2, 0)
  52. MovementLoopAddLocation(NPC, X, Y, Z, 2, 0, "ChooseMovement")
  53. end
  54. function RouteFour(NPC, Spawn)
  55. local X = GetX(NPC)
  56. local Y = GetY(NPC)
  57. local Z = GetZ(NPC)
  58. MovementLoopAddLocation(NPC, X, Y, Z, 2, 0)
  59. MovementLoopAddLocation(NPC, X - 5, Y, Z -8, 2, 0)
  60. MovementLoopAddLocation(NPC, X - 8, Y, Z + 5, 2, 0)
  61. MovementLoopAddLocation(NPC, X + 5, Y, Z, 2, 0)
  62. MovementLoopAddLocation(NPC, X - 8, Y, Z + 5, 2, 0)
  63. MovementLoopAddLocation(NPC, X, Y, Z, 2, 0, "ChooseMovement")
  64. end
  65. function spawn(NPC)
  66. SetPlayerProximityFunction(NPC, 5, "InRange", "InRange", Spawn)
  67. ChooseMovement(NPC)
  68. end
  69. function hailed(NPC, Spawn)
  70. FaceTarget(NPC, Spawn)
  71. end
  72. function InRange(NPC, Spawn)
  73. if GetQuestStep(Spawn, TheOneThatGotAway) == 1 then
  74. SetStepComplete(Spawn, TheOneThatGotAway, 1)
  75. end
  76. end
  77. function respawn(NPC)
  78. spawn(NPC)
  79. end