aQeynosCacheGuard.lua 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. --[[
  2. Script Name : SpawnScripts/Rogue_IrontoeInn/aQeynosCacheGuard.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.12.03 05:12:25
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. waypoints(NPC)
  10. SetPlayerProximityFunction(NPC, 6, "InRange", "LeaveRange")
  11. SetTempVariable(NPC, "OnGuard", "true")
  12. end
  13. function InRange(NPC,Spawn)
  14. if GetTempVariable(NPC,"OnGuard")=="true" and not IsInCombat(NPC) and GetY(Spawn) <=0 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,8000,"Checking",1,Spawn)
  20. AddTimer(NPC,10000,"ResetGuard",1,Spawn)
  21. AddTimer(NPC,9000,"ResetGuardEmote",1,Spawn)
  22. choice = MakeRandomInt(1,3)
  23. if choice ==1 then
  24. PlayFlavor(NPC, "", "What was that?", "peer", 0, 0, Spawn, 0)
  25. elseif choice ==2 then
  26. PlayFlavor(NPC, "", "", "doubletake", 0, 0, Spawn, 0)
  27. SendMessage(Spawn,"The guard heard something.")
  28. elseif choice ==3 then
  29. PlayFlavor(NPC, "", "Hmm?", "stare", 0, 0, Spawn, 0)
  30. end
  31. end
  32. end
  33. function LeaveRange(NPC,Spawn)
  34. if GetTempVariable(NPC,"OnGuard")=="false" then
  35. SetTempVariable(NPC, "OnGuard", "true")
  36. end
  37. end
  38. function Checking(NPC,Spawn)
  39. if GetDistance(NPC,Spawn) <=8 and HasMoved(Spawn) then
  40. Attack(NPC,Spawn)
  41. end
  42. end
  43. function ResetGuardEmote(NPC,Spawn)
  44. if not IsInCombat(NPC) then
  45. choice = MakeRandomInt(1,2)
  46. if choice ==1 then
  47. PlayFlavor(NPC, "", "", "confused", 0, 0, Spawn, 0)
  48. elseif choice ==2 then
  49. PlayFlavor(NPC, "", "", "shrug", 0, 0, Spawn, 0)
  50. end
  51. end
  52. end
  53. function ResetGuard(NPC,Spawn)
  54. if GetTempVariable(NPC,"OnGuard")=="false" then
  55. SetTempVariable(NPC, "OnGuard", "true")
  56. end
  57. end
  58. function waypoints(NPC)
  59. zone = GetZone(NPC)
  60. if GetSpawnLocationID(NPC)==133780970 then
  61. MovementLoopAddLocation(NPC, -4.92, -0.27, 10.28, 2, 0)
  62. MovementLoopAddLocation(NPC, -4.92, -0.27, 10.28, 2, 0)
  63. MovementLoopAddLocation(NPC, -4.92, -0.27, 10.28, 2, 12)
  64. MovementLoopAddLocation(NPC, -4.92, -0.27, 10.28, 2, 0)
  65. MovementLoopAddLocation(NPC, -4, -0.27, 8.64, 2, 0)
  66. MovementLoopAddLocation(NPC, -2.29, -0.27, 6.19, 2, 0)
  67. MovementLoopAddLocation(NPC, -1.76, -0.27, 5.77, 2, 12,"Face")
  68. MovementLoopAddLocation(NPC, -1.71, -0.27, 6.49, 2, 0)
  69. MovementLoopAddLocation(NPC, -4.5, -0.27, 8.27, 2, 0)
  70. elseif GetSpawnLocationID(NPC)==133780971 then
  71. MovementLoopAddLocation(NPC, -19.05, -0.27, 12.9, 2, 6)
  72. MovementLoopAddLocation(NPC, -19.05, -0.27, 12.9, 2, 0)
  73. MovementLoopAddLocation(NPC, -17.23, -0.27, 11.87, 2, 0)
  74. MovementLoopAddLocation(NPC, -14.8, -0.27, 9.62, 2, 0)
  75. MovementLoopAddLocation(NPC, -11.96, -0.27, 8.71, 2, 0)
  76. MovementLoopAddLocation(NPC, -11.18, -0.27, 7.79, 2, 0)
  77. MovementLoopAddLocation(NPC, -11.8, -0.27, 5.27, 2, 14)
  78. MovementLoopAddLocation(NPC, -11.8, -0.27, 5.27, 2, 0)
  79. MovementLoopAddLocation(NPC, -11.27, -0.27, 6.33, 2, 0)
  80. MovementLoopAddLocation(NPC, -13.57, -0.27, 9.62, 2, 0)
  81. MovementLoopAddLocation(NPC, -16.26, -0.27, 7.38, 2, 14)
  82. MovementLoopAddLocation(NPC, -16.26, -0.27, 7.38, 2, 0)
  83. MovementLoopAddLocation(NPC, -14.76, -0.27, 8.47, 2, 0)
  84. MovementLoopAddLocation(NPC, -15.43, -0.27, 10.07, 2, 0)
  85. MovementLoopAddLocation(NPC, -17.19, -0.27, 11.68, 2, 0)
  86. elseif GetSpawnLocationID(NPC)==133780972 then
  87. MovementLoopAddLocation(NPC, -28.18, -0.27, 3.56, 2, 10)
  88. MovementLoopAddLocation(NPC, -28.18, -0.27, 3.56, 2, 0)
  89. MovementLoopAddLocation(NPC, -25.8, -0.27, 0.91, 2, 0)
  90. MovementLoopAddLocation(NPC, -23.95, -0.27, -1.04, 2, 0)
  91. MovementLoopAddLocation(NPC, -23.05, -0.27, -2.91, 2, 2)
  92. MovementLoopAddLocation(NPC, -23.05, -0.27, -2.91, 2, 0)
  93. MovementLoopAddLocation(NPC, -19.03, -0.27, -0.99, 2, 0)
  94. MovementLoopAddLocation(NPC, -17.47, -0.27, 1.89, 2, 0)
  95. MovementLoopAddLocation(NPC, -21.66, -0.27, 6.59, 2, 0)
  96. MovementLoopAddLocation(NPC, -23.87, -0.27, 8.39, 2, 12)
  97. MovementLoopAddLocation(NPC, -23.87, -0.27, 8.39, 2, 0)
  98. MovementLoopAddLocation(NPC, -20.83, -0.27, 5.5, 2, 0)
  99. MovementLoopAddLocation(NPC, -20.55, -0.27, 4.26, 2, 0)
  100. MovementLoopAddLocation(NPC, -24.97, -0.27, 0.2, 2, 0)
  101. MovementLoopAddLocation(NPC, -26.55, -0.27, 1.61, 2, 0)
  102. end
  103. end
  104. function Face(NPC)
  105. SetHeading(NPC, 230)
  106. end
  107. function aggro(NPC,Spawn)
  108. if GetGender(NPC)==1 then
  109. choice = MakeRandomInt(1,3)
  110. if choice ==1 then
  111. PlayFlavor(NPC, "voiceover/english/human_eco_good_1/ft/human/human_eco_good_1_notcitizen_gm_48350e59.mp3", "You're not allowed in here!", "", 1734668326, 429140096, Spawn, 0)
  112. elseif choice ==2 then
  113. PlayFlavor(NPC, "voiceover/english/human_eco_evil_1/ft/human/human_eco_evil_1_notcitizen_gm_7a80a6a8.mp3", "I thought I smelled something foul.", "", 4043801631, 2162078490, Spawn, 0)
  114. else
  115. PlayFlavor(NPC, "voiceover/english/human_eco_good_1/ft/service/guard/human_guard_service_good_1_kill_gm_2b7f45ad.mp3", "For the glory of Qeynos!", "", 1601992673, 279003315, Spawn)
  116. end
  117. else
  118. choice = MakeRandomInt(1,3)
  119. if choice ==1 then
  120. PlayFlavor(NPC, "voiceover/english/optional2/human_eco_evil_2/ft/human/human_eco_evil_2_notcitizen_gf_7a80a6a8.mp3", "I thought I smelled something foul.", "", 4060680490, 1058882345, Spawn, 0)
  121. elseif choice ==2 then
  122. PlayFlavor(NPC, "voiceover/english/human_eco_good_1/ft/human/human_eco_good_1_notcitizen_gf_48350e59.mp3", "You're not allowed in here!", "", 3258959596, 3448333109, Spawn, 0)
  123. else
  124. 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)
  125. end
  126. end
  127. end
  128. function respawn(NPC)
  129. spawn(NPC)
  130. end