afairyseeker.lua 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. --[[
  2. Script Name : SpawnScripts/TheRuins_Classic/afairyseeker.lua
  3. Script Author : Dorbin
  4. Script Date : 2023.07.06 07:07:11
  5. Script Purpose :
  6. :
  7. --]]
  8. require "SpawnScripts/Generic/NPCModule"
  9. function spawn(NPC, Spawn)
  10. NPCModule(NPC, Spawn)
  11. local zone = GetZone(NPC)
  12. local SpawnLocation = GetSpawnLocationID(NPC)
  13. if SpawnLocation == 133785610 or SpawnLocation == 133785611 then
  14. AddTimer(NPC,2000,"following_Xel")
  15. elseif SpawnLocation == 133785614 or SpawnLocation == 133785615 then
  16. AddTimer(NPC,2000,"following_Wele")
  17. end
  18. end
  19. function following_Xel(NPC)
  20. local zone = GetZone(NPC)
  21. local SpawnLocation = GetSpawnLocationID(NPC)
  22. local Xel = GetSpawnByLocationID(zone, 133785612)
  23. local Xel_X = GetX(Xel)
  24. local Xel_Y = GetY(Xel)
  25. local Xel_Z = GetZ(Xel)
  26. local speed = 2
  27. if Xel ~=nil then
  28. if SpawnLocation == 133785610 then --Xel Fairy 1
  29. if GetDistance(NPC, Xel) >= 8 then
  30. speed = 5
  31. MoveToLocation(NPC, Xel_X - 2, Xel_Y+1.5, Xel_Z, speed)
  32. else
  33. speed = 2
  34. MoveToLocation(NPC, Xel_X - 2, Xel_Y+1.5, Xel_Z, speed)
  35. end
  36. elseif SpawnLocation == 133785611 then --Xel Fairy 2
  37. if GetDistance(NPC, Xel) >= 8 then
  38. speed = 5
  39. MoveToLocation(NPC, Xel_X, Xel_Y+1.5, 2+ Xel_Z, speed)
  40. else
  41. speed = 2
  42. MoveToLocation(NPC, Xel_X, Xel_Y+1.5, 2+ Xel_Z, speed)
  43. end
  44. end
  45. else
  46. Despawn(NPC)
  47. end
  48. speed = 2
  49. AddTimer(NPC, 2000, "following_Xel")
  50. end
  51. function following_Wele(NPC)
  52. local zone = GetZone(NPC)
  53. local SpawnLocation = GetSpawnLocationID(NPC)
  54. local Wele = GetSpawnByLocationID(zone, 133785613)
  55. local Wele_X = GetX(Wele)
  56. local Wele_Y = GetY(Wele)
  57. local Wele_Z = GetZ(Wele)
  58. local speed = 2
  59. if Wele ~=nil then
  60. if SpawnLocation == 133785614 then --Wele Fairy 1
  61. if GetDistance(NPC, Wele) >= 8 then
  62. speed = 5
  63. MoveToLocation(NPC, Wele_X - 2, Wele_Y+1.5, Wele_Z, speed)
  64. else
  65. speed = 2
  66. MoveToLocation(NPC, Wele_X - 2, Wele_Y+1.5, Wele_Z, speed)
  67. end
  68. elseif SpawnLocation == 133785615 then --Wele Fairy 2
  69. if GetDistance(NPC, Wele) >= 8 then
  70. speed = 5
  71. MoveToLocation(NPC, Wele_X, Wele_Y+1.5, 2+ Wele_Z, speed)
  72. else
  73. speed = 2
  74. MoveToLocation(NPC, Wele_X, Wele_Y+1.5, 2+ Wele_Z, speed)
  75. end
  76. end
  77. else
  78. Despawn(NPC)
  79. end
  80. speed = 2
  81. AddTimer(NPC, 2000, "following_Wele")
  82. end
  83. function respawn(NPC)
  84. spawn(NPC)
  85. end