9
3

aBrokentuskwarrior.lua 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. --[[
  2. Script Name : SpawnScripts/Ruins/aBrokentuskwarrior.lua
  3. Script Purpose : a Brokentusk warrior
  4. Script Author : Scatman (updated by jakejp 2018.10.08)
  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. spoke = false
  12. local sli = GetSpawnLocationID(NPC)
  13. if sli == 408926 then
  14. -- Roamer by the statue with the prophets to the stairs.
  15. StartPath1(NPC)
  16. elseif sli == 159749 or sli == 159750 or sli == 159751 then
  17. -- Runners from the statue with the prophets around it. Run right into the seasoned guards.
  18. StartPath2(NPC)
  19. elseif sli == 1585501 or sli == 1585502 or sli == 1585523 or sli == 1585524 or sli == 1585525 or sli == 408808 then
  20. -- Orcs that cheer on the harried vagrant squatter.
  21. SetPlayerProximityFunction(NPC, 10, "InRange")
  22. EmoteLoop(NPC)
  23. end
  24. end
  25. function respawn(NPC)
  26. spawn(NPC)
  27. end
  28. function InRange(NPC, Spawn)
  29. local vagrant_squatter = GetSpawn(NPC, 1270015)
  30. if vagrant_squatter ~= nil and GetDistance(NPC, vagrant_squatter) <= 50 then
  31. local choice = math.random(1, 3)
  32. if choice == 1 then
  33. Say(NPC, "Dance, or I give you to HIM!", Spawn)
  34. elseif choice == 2 then
  35. Say(NPC, "So fragile, so...funny!", Spawn)
  36. elseif choice == 3 then
  37. Say(NPC, "Dance little one!", Spawn)
  38. end
  39. end
  40. end
  41. function hailed(NPC, Spawn)
  42. FaceTarget(NPC, Spawn)
  43. end
  44. function aggro(NPC, Spawn)
  45. local chance = math.random(0, 100)
  46. if chance <= 25 then
  47. generic_aggro(NPC, Spawn)
  48. end
  49. end
  50. function healthchanged(NPC, Spawn)
  51. local chance = math.random(0, 100)
  52. if chance <= 25 then
  53. local health_percent = GetHP(NPC) / GetMaxHP(NPC)
  54. if health_percent < 0.50 and spoke == false then
  55. spoke = true
  56. generic_healthchanged(NPC, Spawn)
  57. end
  58. end
  59. end
  60. function killed(NPC, Spawn)
  61. generic_killed(NPC, Spawn)
  62. end
  63. function death(NPC, Spawn)
  64. spoke = false
  65. local chance = math.random(0, 100)
  66. if chance <= 25 then
  67. generic_death(NPC, Spawn)
  68. end
  69. end
  70. function StartPath1(NPC)
  71. MovementLoopAddLocation(NPC, -35.9, -3.62, 47.9, 2, 0)
  72. MovementLoopAddLocation(NPC, -35.18, -2.72, 58.96, 2, 0)
  73. MovementLoopAddLocation(NPC, -42.3, -2.43, 71.24, 2, 0)
  74. MovementLoopAddLocation(NPC, -40.02, -2.38, 75.94, 2, 0)
  75. MovementLoopAddLocation(NPC, -43.62, -2.08, 81.69, 2, 0)
  76. MovementLoopAddLocation(NPC, -47.92, -2.5, 73.39, 2, 0)
  77. MovementLoopAddLocation(NPC, -46.64, -2.59, 65.03, 2, 0)
  78. MovementLoopAddLocation(NPC, -41.31, -2.89, 58.72, 2, 0)
  79. MovementLoopAddLocation(NPC, -44.55, -3.94, 45.11, 2, 0)
  80. MovementLoopAddLocation(NPC, -36.96, -3.82, 42.52, 2, 0)
  81. end
  82. function StartPath2(NPC)
  83. MovementLoopAddLocation(NPC, -47.47, -2.4, 67.54, 4, 0)
  84. MovementLoopAddLocation(NPC, -37.98, -2.22, 81.62, 4, 0)
  85. MovementLoopAddLocation(NPC, -14.18, -4.24, 91.13, 4, 0)
  86. MovementLoopAddLocation(NPC, -19.79, -4.42, 109.62, 4, 0)
  87. MovementLoopAddLocation(NPC, -4.71, -4.42, 120.59, 4, 0)
  88. MovementLoopAddLocation(NPC, -1.99, -4.42, 96.09, 4, 0)
  89. MovementLoopAddLocation(NPC, 10.14, -3.2, 79.98, 4, 0)
  90. MovementLoopAddLocation(NPC, -6.7, -4.27, 63.84, 4, 0)
  91. MovementLoopAddLocation(NPC, -11.05, -5.06, 39.66, 4, 0)
  92. MovementLoopAddLocation(NPC, -24.45, -3.71, 82.41, 4, 0)
  93. MovementLoopAddLocation(NPC, -45.66, -2.42, 76.96, 4, 0)
  94. MovementLoopAddLocation(NPC, -46.29, -2.55, 68.6, 4, 0)
  95. MovementLoopAddLocation(NPC, -67.39, -0.9, 67.99, 4, 0)
  96. end
  97. function EmoteLoop(NPC) -- Thanks theFoof
  98. local choice = math.random(1,4)
  99. local emote
  100. if choice == 1 then
  101. emote = "cheer"
  102. elseif choice == 2 then
  103. emote = "chuckle"
  104. end
  105. PlayFlavor(NPC, "", "", emote, 0, 0)
  106. AddTimer(NPC, math.random(1000,5000), "EmoteLoop")
  107. end