9
3

GuardTolar.lua 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. --[[
  2. Script Name : SpawnScripts/qeynos_combined02/GuardTolar.lua
  3. Script Author : Rylec
  4. Script Date : 2021.10.05 01:10:00
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. SetPlayerProximityFunction(NPC, 15, "InRange")
  10. SpawnCanineWatcher(NPC)
  11. AddTimer(NPC, 3000, "EmoteLoop")
  12. end
  13. function SpawnCanineWatcher(NPC)
  14. if GetSpawnLocationID(NPC) == 133772661 then
  15. SpawnByLocationID(GetZone(NPC), 133772662)
  16. else
  17. SpawnByLocationID(GetZone(NPC), 133772659)
  18. end
  19. end
  20. function hailed(NPC, Spawn)
  21. FaceTarget(NPC, Spawn)
  22. local choice = MakeRandomInt(1,4)
  23. if choice == 1 then
  24. PlayFlavor(NPC, "voiceover/english/barbarian_eco_good_1/ft/service/guard/barbarian_guard_service_good_1_hail_gm_ee473c11.mp3", "Good day to you, citizen. All preserve Queen Antonia.", "salute", 2268064933, 2349331472, Spawn)
  25. elseif choice == 2 then
  26. PlayFlavor(NPC, "voiceover/english/barbarian_eco_good_1/ft/service/guard/barbarian_guard_service_good_1_hail_gm_76da37c9.mp3", "I hate working this shift! If the gnolls don't attack now, I may die of boredom.", "grumble", 174236481, 4250389478, Spawn)
  27. elseif choice == 3 then
  28. PlayFlavor(NPC, "voiceover/english/barbarian_eco_good_1/ft/service/guard/barbarian_guard_service_good_1_hail_gm_ebfceda5.mp3", "Greetings, citizen. I am on guard duty. Should you get into trouble, seek me out.", "attention", 2588751132, 3401521310, Spawn)
  29. else
  30. PlayFlavor(NPC, "voiceover/english/barbarian_eco_good_1/ft/service/guard/barbarian_guard_service_good_1_hail_gm_c865a827.mp3", "Duty above all else, citizen, except honor!", "scold", 3650321797, 745843450, Spawn)
  31. end
  32. end
  33. function respawn(NPC)
  34. spawn(NPC)
  35. end
  36. function death(NPC) -- Removes any companion canine watcher in case a player just kills the guard so the respawned guard doesn't spawn a second watcher
  37. AddTimer(NPC, 200000, "ResetCanineWatcher", 1, Spawn)
  38. end
  39. function ResetCanineWatcher(NPC)
  40. local zone = GetZone(NPC)
  41. local canine1 = GetSpawnByLocationID(zone, 133772659)
  42. local canine2 = GetSpawnByLocationID(zone, 133772662)
  43. if canine1 ~= nil then
  44. Despawn(canine1)
  45. end
  46. if canine2 ~= nil then
  47. Despawn(canine2)
  48. end
  49. end
  50. function EmoteLoop(NPC)
  51. local choice = MakeRandomInt(1,2)
  52. if choice == 1 then
  53. PlayAnimation(NPC, 891)
  54. else
  55. PlayAnimation(NPC, 13008)
  56. end
  57. local time = MakeRandomInt(30000,40000)
  58. AddTimer(NPC, time, "EmoteLoop")
  59. end
  60. function InRange(NPC, Spawn)
  61. FaceTarget(NPC, Spawn)
  62. PlayAnimation(NPC, 12167, Spawn)
  63. -- Emote(NPC, "salutes you.", Spawn)
  64. end