aputridbandit.lua 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. --[[
  2. Script Name : SpawnScripts/Cache/aputridbandit.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.12.05 04:12:24
  5. Script Purpose :
  6. :
  7. --]]
  8. require "SpawnScripts/Generic/CombatModule"
  9. function spawn(NPC, Spawn)
  10. combatModule(NPC, Spawn)
  11. waypoints(NPC)
  12. SetPlayerProximityFunction(NPC, 8, "InRange", "LeaveRange")
  13. SetTempVariable(NPC, "OnGuard", "true")
  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,2500,"Checking",1,Spawn)
  20. AddTimer(NPC,5000,"Checking",1,Spawn)
  21. AddTimer(NPC,8000,"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 bandit 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 ResetGuardEmote(NPC,Spawn)
  46. if not IsInCombat(NPC) then
  47. choice = MakeRandomInt(1,2)
  48. if choice ==1 then
  49. PlayFlavor(NPC, "", "", "confused", 0, 0, Spawn, 0)
  50. elseif choice ==2 then
  51. PlayFlavor(NPC, "", "", "shrug", 0, 0, Spawn, 0)
  52. end
  53. end
  54. end
  55. function respawn(NPC)
  56. spawn(NPC)
  57. end
  58. function aggro(NPC,Spawn)
  59. choice = MakeRandomInt(1,3)
  60. if choice ==1 then
  61. PlayFlavor(NPC, "voiceover/english/human_base_1/ft/human/human_base_1_1_aggro_gm_583690dc.mp3", "Summon help! We have invaders!", "", 3340212225, 279643307, Spawn, 0)
  62. elseif choice ==2 then
  63. PlayFlavor(NPC, "voiceover/english/human_base_1/ft/human/human_base_1_1_aggro_gm_a203c9ec.mp3", "Prepare to face your doom, meddler.", "", 1496819882, 365167432, Spawn, 0)
  64. elseif choice ==3 then
  65. PlayFlavor(NPC, "voiceover/english/human_base_1/ft/human/human_base_1_1_aggro_gm_a30c4f9d.mp3", "To arms!", "", 1238020980, 748146443, Spawn, 0)
  66. end
  67. end
  68. function waypoints(NPC)
  69. if GetSpawnLocationID(NPC)==133781204 then
  70. MovementLoopAddLocation(NPC, -5.06, -0.24, -10.23, 2, 5)
  71. MovementLoopAddLocation(NPC, -3.49, -0.24, -11.35, 2, 0)
  72. MovementLoopAddLocation(NPC, -6.24, -0.24, -9.04, 2, 0)
  73. MovementLoopAddLocation(NPC, -7.12, -0.24, -8.16, 2, 0)
  74. MovementLoopAddLocation(NPC, -10.14, -0.24, -9.51, 2, 0)
  75. MovementLoopAddLocation(NPC, -15.12, -0.24, -13.31, 2, 0)
  76. MovementLoopAddLocation(NPC, -22.86, -0.24, -18.79, 2, 0)
  77. MovementLoopAddLocation(NPC, -26.16, -0.24, -23.02, 2, 5)
  78. MovementLoopAddLocation(NPC, -26.16, -0.24, -23.02, 2, 0)
  79. MovementLoopAddLocation(NPC, -24.21, -0.24, -20.26, 2, 0)
  80. MovementLoopAddLocation(NPC, -14.36, -0.24, -11.92, 2, 0)
  81. MovementLoopAddLocation(NPC, -10.78, -0.24, -9.64, 2, 0)
  82. MovementLoopAddLocation(NPC, -7.39, -0.24, -8.42, 2, 0)
  83. elseif GetSpawnLocationID(NPC)==133781205 then
  84. MovementLoopAddLocation(NPC, -10.37, -0.24, -3.42, 2, 5)
  85. MovementLoopAddLocation(NPC, -10.63, -0.24, -2.49, 2, 0)
  86. MovementLoopAddLocation(NPC, -10.83, -0.24, -4.8, 2, 0)
  87. MovementLoopAddLocation(NPC, -10.54, -0.24, -6.24, 2, 0)
  88. MovementLoopAddLocation(NPC, -12.06, -0.24, -8.13, 2, 0)
  89. MovementLoopAddLocation(NPC, -16.51, -0.24, -12.03, 2, 0)
  90. MovementLoopAddLocation(NPC, -18.91, -0.24, -13.85, 2, 0)
  91. MovementLoopAddLocation(NPC, -20.33, -0.24, -13.45, 2, 5)
  92. MovementLoopAddLocation(NPC, -20.33, -0.24, -13.45, 2, 0)
  93. MovementLoopAddLocation(NPC, -20.66, -0.24, -16.74, 2, 0)
  94. MovementLoopAddLocation(NPC, -24.44, -0.24, -19.53, 2, 0)
  95. MovementLoopAddLocation(NPC, -25.51, -0.24, -22.94, 2, 5)
  96. MovementLoopAddLocation(NPC, -25.51, -0.24, -22.94, 2, 0)
  97. MovementLoopAddLocation(NPC, -21.56, -0.24, -17.22, 2, 0)
  98. MovementLoopAddLocation(NPC, -19.4, -0.24, -14.51, 2, 0)
  99. MovementLoopAddLocation(NPC, -12.66, -0.24, -8.94, 2, 0)
  100. end
  101. end