afangedsentinel55897.lua 1.1 KB

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