9
3

afetteredguard.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. --[[
  2. Script Name : SpawnScripts/Cache/afetteredguard.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.12.05 04:12:18
  5. Script Purpose :
  6. :
  7. --]]
  8. require "SpawnScripts/Generic/CombatModule"
  9. function spawn(NPC, Spawn)
  10. combatModule(NPC, Spawn)
  11. -- SetPlayerProximityFunction(NPC, 7, "InRange", "LeaveRange")
  12. SetTempVariable(NPC, "OnGuard", "true")
  13. SetSeeHide(NPC,1)
  14. end
  15. function InRange(NPC,Spawn)
  16. if GetTempVariable(NPC,"OnGuard")=="true" and not IsInCombat(NPC) and GetY(Spawn) <=2 then
  17. FaceTarget(NPC,Spawn)
  18. SetTempVariable(NPC, "OnGuard", "false")
  19. AddTimer(NPC,1000,"Checking",1,Spawn)
  20. AddTimer(NPC,4000,"Checking",1,Spawn)
  21. AddTimer(NPC,7500,"Checking",1,Spawn)
  22. AddTimer(NPC,10000,"ResetGuard",1,Spawn)
  23. AddTimer(NPC,9000,"ResetGuardEmote",1,Spawn)
  24. choice = MakeRandomInt(1,3)
  25. if choice ==1 then
  26. PlayFlavor(NPC, "", "What was that?", "peer", 0, 0, Spawn, 0)
  27. elseif choice ==2 then
  28. PlayFlavor(NPC, "", "", "doubletake", 0, 0, Spawn, 0)
  29. SendMessage(Spawn,"The guard heard something.")
  30. elseif choice ==3 then
  31. PlayFlavor(NPC, "", "Hmm?", "stare", 0, 0, Spawn, 0)
  32. end
  33. end
  34. end
  35. function LeaveRange(NPC,Spawn)
  36. if GetTempVariable(NPC,"OnGuard")=="false" then
  37. SetTempVariable(NPC, "OnGuard", "true")
  38. end
  39. end
  40. function Checking(NPC,Spawn)
  41. if GetDistance(NPC,Spawn) <=8 and HasMoved(Spawn) and GetY(Spawn) <=2 then
  42. Attack(NPC,Spawn)
  43. end
  44. end
  45. function respawn(NPC)
  46. spawn(NPC)
  47. end
  48. function aggro(NPC,Spawn)
  49. choice = MakeRandomInt(1,3)
  50. if choice ==1 then
  51. PlayFlavor(NPC, "voiceover/english/optional3/halfelf_base_2/ft/halfelf/halfelf_base_2_1_aggro_gf_f28ca26e.mp3", "Brace yourselves! We have trouble!", "", 773678310, 2089682843, Spawn, 0)
  52. elseif choice ==2 then
  53. PlayFlavor(NPC, "voiceover/english/optional3/halfelf_base_1/ft/halfelf/halfelf_base_1_1_aggro_gf_12fbaefb.mp3", "Destroy the invader!", "", 1313233821, 723410897, Spawn, 0)
  54. elseif choice ==3 then
  55. PlayFlavor(NPC, "voiceover/english/optional3/halfelf_base_1/ft/halfelf/halfelf_base_1_1_aggro_gf_a68f64b6.mp3", "Alarm! Alarm!", "", 1220383018, 2962002142, Spawn, 0)
  56. end
  57. end