adistractedQeynosCacheguard.lua 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. --[[
  2. Script Name : SpawnScripts/Rogue_IrontoeInn/adistractedQeynosCacheguard.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.12.03 05:12:39
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. SetPlayerProximityFunction(NPC, 4, "InRange", "LeaveRange")
  10. SetTempVariable(NPC, "OnGuard", "true")
  11. NPC_Y = GetY(NPC)
  12. end
  13. function InRange(NPC,Spawn)
  14. if GetTempVariable(NPC,"OnGuard")=="true" and not IsInCombat(NPC) and GetY(Spawn) >= 6 then
  15. FaceTarget(NPC,Spawn)
  16. SetTempVariable(NPC, "OnGuard", "false")
  17. AddTimer(NPC,2500,"Checking",1,Spawn)
  18. AddTimer(NPC,6000,"Checking",1,Spawn)
  19. AddTimer(NPC,10000,"ResetGuard",1,Spawn)
  20. AddTimer(NPC,10000,"ResetGuardEmote",1,Spawn)
  21. choice = MakeRandomInt(1,3)
  22. if choice ==1 then
  23. PlayFlavor(NPC, "", "What was that?", "peer", 0, 0, Spawn, 0)
  24. elseif choice ==2 then
  25. PlayFlavor(NPC, "", "", "doubletake", 0, 0, Spawn, 0)
  26. SendMessage(Spawn,"The guard heard something.")
  27. elseif choice ==3 then
  28. PlayFlavor(NPC, "", "Hmm?", "stare", 0, 0, Spawn, 0)
  29. end
  30. end
  31. end
  32. function Checking(NPC,Spawn)
  33. if GetDistance(NPC,Spawn) <=6 and HasMoved(Spawn) then
  34. Attack(NPC,Spawn)
  35. end
  36. end
  37. function ResetGuardEmote(NPC,Spawn)
  38. if not IsInCombat(NPC) then
  39. choice = MakeRandomInt(1,2)
  40. if choice ==1 then
  41. PlayFlavor(NPC, "", "", "confused", 0, 0, Spawn, 0)
  42. elseif choice ==2 then
  43. PlayFlavor(NPC, "", "", "shrug", 0, 0, Spawn, 0)
  44. end
  45. end
  46. end
  47. function ResetGuard(NPC,Spawn)
  48. SetTempVariable(NPC, "OnGuard", "true")
  49. end
  50. function aggro(NPC,Spawn)
  51. choice = MakeRandomInt(1,3)
  52. if choice ==1 then
  53. PlayFlavor(NPC, "voiceover/english/highelf_eco_good_1/ft/highelf/highelf_eco_good_1_notcitizen_gm_48350e59.mp3", "You're not allowed in here!", "", 237358955, 1041617020, Spawn, 0)
  54. elseif choice ==2 then
  55. PlayFlavor(NPC, "voiceover/english/highelf_eco_good_1/ft/highelf/highelf_eco_good_1_notcitizen_gm_8236a789.mp3", "Remove yourself from my presence, outsider.", "", 3302310786, 2767017909, Spawn, 0)
  56. else
  57. PlayFlavor(NPC, "voiceover/english/human_eco_good_1/ft/service/guard/human_guard_service_good_1_kill_gf_2b7f45ad.mp3", "For the glory of Qeynos!", "", 2825851367, 3848266464, Spawn)
  58. end
  59. end
  60. function respawn(NPC)
  61. spawn(NPC)
  62. end