9
3

LieutenantViceroy.lua 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. --[[
  2. Script Name : SpawnScripts/Rogue_IrontoeInn/LieutenantViceroy.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.12.03 05:12:29
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. waypoints(NPC)
  10. SetPlayerProximityFunction(NPC, 5, "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) >= 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,8500,"Checking",1,Spawn)
  20. AddTimer(NPC,10000,"ResetGuard",1,Spawn)
  21. AddTimer(NPC,10000,"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 Lieutenant heard something.")
  28. elseif choice ==3 then
  29. PlayFlavor(NPC, "", "Hmm? I thought I heard something.", "stare", 0, 0, Spawn, 0)
  30. end
  31. end
  32. end
  33. function Checking(NPC,Spawn)
  34. if GetDistance(NPC,Spawn) <=8 and HasMoved(Spawn) then
  35. Attack(NPC,Spawn)
  36. end
  37. end
  38. function LeaveRange(NPC,Spawn)
  39. if GetTempVariable(NPC,"OnGuard")=="false" then
  40. SetTempVariable(NPC, "OnGuard", "true")
  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. SetTempVariable(NPC, "OnGuard", "true")
  55. end
  56. function respawn(NPC)
  57. spawn(NPC)
  58. end
  59. function waypoints(NPC)
  60. MovementLoopAddLocation(NPC, 0.15, 6.23, 2, 2, 0)
  61. MovementLoopAddLocation(NPC, 1.82, 6.23, 0.64, 2, 6)
  62. MovementLoopAddLocation(NPC, 1.82, 6.23, 0.64, 2, 0)
  63. MovementLoopAddLocation(NPC, -2.23, 6.23, 4.58, 2, 0)
  64. MovementLoopAddLocation(NPC, -3.57, 6.23, 6.67, 2, 8,"Face")
  65. MovementLoopAddLocation(NPC, -3.76, 6.23, 6.45, 2, 0)
  66. MovementLoopAddLocation(NPC, -0.05, 6.23, 2.09, 2, 0)
  67. end
  68. function Face(NPC)
  69. SetHeading(NPC,50)
  70. end
  71. function aggro(NPC,Spawn)
  72. choice = MakeRandomInt(1,3)
  73. if choice ==1 then
  74. 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)
  75. elseif choice ==2 then
  76. 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)
  77. else
  78. 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)
  79. end
  80. end