afangedsentinel56784.lua 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. --[[
  2. Script Name : SpawnScripts/Freeport/afangedsentinel56784.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.05.03 08:05:46
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. AddTimer(NPC, 500, "followguard", 1)
  10. end
  11. function hailed(NPC, Spawn)
  12. FaceTarget(NPC, Spawn)
  13. end
  14. function respawn(NPC)
  15. spawn(NPC)
  16. end
  17. function followguard(NPC, Spawn)
  18. local zone = GetZone(NPC)
  19. local GUARD_LEADER = GetSpawnByLocationID(zone, 56794)
  20. if GUARD_LEADER ~= nil then
  21. local leaderX = GetX(GUARD_LEADER)
  22. local leaderY = GetY(GUARD_LEADER)
  23. local leaderZ = GetZ(GUARD_LEADER)
  24. local speed = 2
  25. -- Say(NPC, "Leader location is: " .. GetX(guard_A_placement) .. ", " .. GetY(guard_A_placement) .. ", " .. GetZ(guard_A_placement))
  26. if GetDistance(NPC, GUARD_LEADER) >= 8 then
  27. speed = 2
  28. MoveToLocation(NPC, leaderX +2, leaderY, leaderZ +2 , speed)
  29. else
  30. speed = 2
  31. MoveToLocation(NPC, leaderX +2, leaderY, leaderZ +2 , speed)
  32. end
  33. AddTimer(NPC, 3000, "followguard")
  34. end
  35. end