Gavinfell.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. --[[
  2. Script Name : SpawnScripts/SouthQeynos/Gavinfell.lua
  3. Script Purpose : Gavinfell <Guard>
  4. Script Author : Cynnar
  5. Script Date : 2020.04.12
  6. Script Notes : Auto-Generated Conversation from PacketParser Data
  7. --]]
  8. dofile("SpawnScripts/Generic/GenericGuardVoiceOvers.lua")
  9. dofile("SpawnScripts/Generic/ExpelNonCitizen.lua")
  10. function spawn(NPC)
  11. AddTimer(NPC, 1900, "follow_Erwin")
  12. SetPlayerProximityFunction(NPC, 10, "InRange", "LeaveRange")
  13. end
  14. function InRange(NPC, Spawn)
  15. NonCitizen(NPC,Spawn)
  16. end
  17. function hailed(NPC, Spawn)
  18. if GetFactionAmount(Spawn,11)<0 then
  19. else
  20. FaceTarget(NPC, Spawn)
  21. GenericGuardHail(NPC,Spawn)
  22. end
  23. end
  24. function respawn(NPC)
  25. spawn(NPC)
  26. end
  27. function follow_Erwin(NPC)
  28. local zone = GetZone(NPC)
  29. local Erwin_location = GetSpawnByLocationID(zone, 133779451)
  30. local sli = GetSpawnLocationID(NPC)
  31. local leaderX = GetX(Erwin_location)
  32. local leaderY = GetY(Erwin_location)
  33. local leaderZ = GetZ(Erwin_location)
  34. local speed = 2
  35. -- Say(NPC, "Leader location is: " .. GetX(guard_A_placement) .. ", " .. GetY(guard_A_placement) .. ", " .. GetZ(guard_A_placement))
  36. if Erwin_location ~=nil and not IsInCombat(NPC) then
  37. if sli == 415227 then --Galla
  38. if GetDistance(NPC, Erwin_location) >= 8 then
  39. speed = 5
  40. MoveToLocation(NPC, leaderX - 2, leaderY, leaderZ, speed)
  41. else
  42. speed = 2
  43. MoveToLocation(NPC, leaderX - 2, leaderY, leaderZ, speed)
  44. end
  45. elseif sli == 415226 then --Gavinfell
  46. if GetDistance(NPC, Erwin_location) >= 8 then
  47. -- Say(NPC, "Leader location is: " .. GetX(guard_A_placement) .. "")
  48. -- Say(NPC, "My location is: " .. GetX(NPC) .. "")
  49. speed = 5
  50. MoveToLocation(NPC, leaderX, leaderY, 1+ leaderZ, speed)
  51. else
  52. speed = 2
  53. MoveToLocation(NPC, leaderX, leaderY, 1+ leaderZ, speed)
  54. end
  55. end
  56. end
  57. speed = 2
  58. AddTimer(NPC, 2000, "follow_Erwin")
  59. end