aBrokentuskguard.lua 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. --[[
  2. Script Name : SpawnScripts/Ruins/aBrokentuskguard.lua
  3. Script Purpose : a Brokentusk guard
  4. Script Author : Scatman (updated by jakejp 2018.06.10)
  5. Script Date : 2009.08.21
  6. Script Notes :
  7. --]]
  8. dofile("SpawnScripts/Generic/BrokentuskVoiceOvers.lua")
  9. local spoke = false
  10. function spawn(NPC)
  11. SetPlayerProximityFunction(NPC, 10, "InRange")
  12. spoke = false
  13. local sli = GetSpawnLocationID(NPC)
  14. -- Wanderer from where the 'an Overseer' spawns.
  15. if sli == 408961 or sli == 408975 then
  16. local choice = math.random(1,2)
  17. if choice == 1 then
  18. AddTimer(NPC, math.random(0, 10000), "StartPath1")
  19. elseif choice == 2 then
  20. AddTimer(NPC, math.random(0, 10000), "StartPath1Reverse")
  21. end
  22. end
  23. -- Spawns in front of guard by well
  24. if sli == 1585507 or sli == 1585508 or sli == 1585509 then
  25. EmoteLoop(NPC)
  26. end
  27. end
  28. function InRange(NPC, Spawn)
  29. local scared = "cringe"
  30. if GetLevel(Spawn) > 9 then
  31. PlayFlavor(NPC, "", "", scared, 0, 0)
  32. end
  33. end
  34. function respawn(NPC)
  35. spawn(NPC)
  36. end
  37. function hailed(NPC, Spawn)
  38. FaceTarget(NPC, Spawn)
  39. end
  40. function EmoteLoop(NPC) -- Thanks theFoof
  41. local choice = math.random(1,4)
  42. local emote
  43. if choice == 1 then
  44. emote = "flex"
  45. elseif choice == 2 then
  46. emote = "stretch"
  47. elseif choice == 3 then
  48. emote = "point"
  49. elseif choice == 4 then
  50. emote = "peer"
  51. end
  52. PlayFlavor(NPC, "", "", emote, 0, 0)
  53. AddTimer(NPC, math.random(3000,10000), "EmoteLoop")
  54. end
  55. function aggro(NPC, Spawn)
  56. local chance = math.random(0, 100)
  57. if chance <= 25 then
  58. generic_aggro(NPC, Spawn)
  59. end
  60. end
  61. function healthchanged(NPC, Spawn)
  62. local chance = math.random(0, 100)
  63. if chance <= 25 then
  64. local health_percent = GetHP(NPC) / GetMaxHP(NPC)
  65. if health_percent < 0.50 and spoke == false then
  66. spoke = true
  67. generic_healthchanged(NPC, Spawn)
  68. end
  69. end
  70. end
  71. function killed(NPC, Spawn)
  72. generic_killed(NPC, Spawn)
  73. end
  74. function death(NPC, Spawn)
  75. spoke = false
  76. local chance = math.random(0, 100)
  77. if chance <= 25 then
  78. generic_death(NPC, Spawn)
  79. end
  80. end
  81. function StartPath1(NPC)
  82. MovementLoopAddLocation(NPC, -140.28, -2.57, 22.58, 2, 0)
  83. MovementLoopAddLocation(NPC, -137.92, -2.56, 20.52, 2, 0)
  84. MovementLoopAddLocation(NPC, -129.41, -2.57, 19.94, 2, 0)
  85. MovementLoopAddLocation(NPC, -126.23, -2.56, 18.19, 2, 0)
  86. MovementLoopAddLocation(NPC, -122.83, -2.55, 14.43, 2, 0)
  87. MovementLoopAddLocation(NPC, -114.21, -2.61, 17.31, 2, 0)
  88. MovementLoopAddLocation(NPC, -109.99, -2.64, 17.76, 2, 0)
  89. MovementLoopAddLocation(NPC, -103.32, -2.67, 19.41, 2, 0)
  90. MovementLoopAddLocation(NPC, -99.51, -2.68, 17.5, 2, 0)
  91. MovementLoopAddLocation(NPC, -94.95, -2.72, 17.96, 2, 0)
  92. MovementLoopAddLocation(NPC, -87.91, -2.7, 15.73, 2, 0)
  93. MovementLoopAddLocation(NPC, -80.37, -2.73, 16.74, 2, 0)
  94. MovementLoopAddLocation(NPC, -73.37, -2.7, 24.81, 2, 0)
  95. MovementLoopAddLocation(NPC, -61.57, -2.68, 26.83, 2, 0)
  96. MovementLoopAddLocation(NPC, -50.97, -2.78, 26.87, 2, 0)
  97. MovementLoopAddLocation(NPC, -46.63, -2.62, 29.66, 2, 0)
  98. MovementLoopAddLocation(NPC, -44.9, -2.46, 34.15, 2, 0)
  99. MovementLoopAddLocation(NPC, -50.13, -2.46, 37.13, 2, 0)
  100. MovementLoopAddLocation(NPC, -54.52, -2.63, 34.25, 2, 0)
  101. MovementLoopAddLocation(NPC, -61.37, -2.76, 33.77, 2, 0)
  102. MovementLoopAddLocation(NPC, -65.66, -2.71, 32.21, 2, 0)
  103. MovementLoopAddLocation(NPC, -74.41, -2.67, 31.71, 2, 0)
  104. MovementLoopAddLocation(NPC, -76.57, -2.76, 33.66, 2, 0)
  105. MovementLoopAddLocation(NPC, -96.97, -2.72, 31.94, 2, 0)
  106. MovementLoopAddLocation(NPC, -101.32, -2.71, 26.16, 2, 0)
  107. MovementLoopAddLocation(NPC, -108.64, -2.71, 24.22, 2, 0)
  108. MovementLoopAddLocation(NPC, -112.72, -2.63, 21.67, 2, 0)
  109. MovementLoopAddLocation(NPC, -121.34, -2.6, 20.29, 2, 0)
  110. MovementLoopAddLocation(NPC, -126.81, -2.61, 23.84, 2, 0)
  111. MovementLoopAddLocation(NPC, -128.9, -2.63, 27.83, 2, 0)
  112. MovementLoopAddLocation(NPC, -134.67, -2.63, 31.56, 2, 0)
  113. MovementLoopAddLocation(NPC, -139.13, -2.61, 30.96, 2, 0)
  114. MovementLoopAddLocation(NPC, -140.67, -2.59, 28.5, 2, 0)
  115. end
  116. function StartPath1Reverse(NPC)
  117. MovementLoopAddLocation(NPC, -140.67, -2.59, 28.5, 2, 0)
  118. MovementLoopAddLocation(NPC, -139.13, -2.61, 30.96, 2, 0)
  119. MovementLoopAddLocation(NPC, -134.67, -2.63, 31.56, 2, 0)
  120. MovementLoopAddLocation(NPC, -128.9, -2.63, 27.83, 2, 0)
  121. MovementLoopAddLocation(NPC, -126.81, -2.61, 23.84, 2, 0)
  122. MovementLoopAddLocation(NPC, -121.34, -2.6, 20.29, 2, 0)
  123. MovementLoopAddLocation(NPC, -112.72, -2.63, 21.67, 2, 0)
  124. MovementLoopAddLocation(NPC, -108.64, -2.71, 24.22, 2, 0)
  125. MovementLoopAddLocation(NPC, -101.32, -2.71, 26.16, 2, 0)
  126. MovementLoopAddLocation(NPC, -96.97, -2.72, 31.94, 2, 0)
  127. MovementLoopAddLocation(NPC, -76.57, -2.76, 33.66, 2, 0)
  128. MovementLoopAddLocation(NPC, -74.41, -2.67, 31.71, 2, 0)
  129. MovementLoopAddLocation(NPC, -65.66, -2.71, 32.21, 2, 0)
  130. MovementLoopAddLocation(NPC, -61.37, -2.76, 33.77, 2, 0)
  131. MovementLoopAddLocation(NPC, -54.52, -2.63, 34.25, 2, 0)
  132. MovementLoopAddLocation(NPC, -50.13, -2.46, 37.13, 2, 0)
  133. MovementLoopAddLocation(NPC, -44.9, -2.46, 34.15, 2, 0)
  134. MovementLoopAddLocation(NPC, -46.63, -2.62, 29.66, 2, 0)
  135. MovementLoopAddLocation(NPC, -50.97, -2.78, 26.87, 2, 0)
  136. MovementLoopAddLocation(NPC, -61.57, -2.68, 26.83, 2, 0)
  137. MovementLoopAddLocation(NPC, -73.37, -2.7, 24.81, 2, 0)
  138. MovementLoopAddLocation(NPC, -80.37, -2.73, 16.74, 2, 0)
  139. MovementLoopAddLocation(NPC, -87.91, -2.7, 15.73, 2, 0)
  140. MovementLoopAddLocation(NPC, -94.95, -2.72, 17.96, 2, 0)
  141. MovementLoopAddLocation(NPC, -99.51, -2.68, 17.5, 2, 0)
  142. MovementLoopAddLocation(NPC, -103.32, -2.67, 19.41, 2, 0)
  143. MovementLoopAddLocation(NPC, -109.99, -2.64, 17.76, 2, 0)
  144. MovementLoopAddLocation(NPC, -114.21, -2.61, 17.31, 2, 0)
  145. MovementLoopAddLocation(NPC, -122.83, -2.55, 14.43, 2, 0)
  146. MovementLoopAddLocation(NPC, -126.23, -2.56, 18.19, 2, 0)
  147. MovementLoopAddLocation(NPC, -129.41, -2.57, 19.94, 2, 0)
  148. MovementLoopAddLocation(NPC, -137.92, -2.56, 20.52, 2, 0)
  149. MovementLoopAddLocation(NPC, -140.28, -2.57, 22.58, 2, 0)
  150. end