9
3

acrumblingskeleton.lua 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. --[[
  2. Script Name : SpawnScripts/Graveyard/acrumblingskeleton.lua
  3. Script Purpose : a crumbling skeleton
  4. Script Author : Scatman
  5. Script Date : 2009.07.10/ 2020.11.11
  6. Script Notes :
  7. Modified by : premierio015
  8. Modified Notes: : Added bone fragments function for quest Bone Dust(583)
  9. --]]
  10. local spoke = false
  11. function spawn(NPC)
  12. spoke = false
  13. end
  14. function hailed(NPC, Spawn)
  15. FaceTarget(NPC, Spawn)
  16. end
  17. function respawn(NPC)
  18. spawn(NPC)
  19. end
  20. function healthchanged(NPC, Spawn)
  21. local hp_percent = GetHP(NPC) / GetMaxHP(NPC)
  22. if hp_percent <= 0.50 and spoke == false then
  23. spoke = true
  24. RandomCallOut(NPC, Spawn)
  25. AddTimer(NPC, 30000, "ResetSpoke")
  26. end
  27. end
  28. function RandomCallOut(NPC, Spawn)
  29. local choice = math.random(1, 5)
  30. if choice == 1 then
  31. PlayFlavor(NPC, "voiceover/english/optional3/skeleton_base_2/ft/skeleton/skeleton_base_2_1_halfhealth_29344c6f.mp3", "I didn't need those bones anyway.", "", 1704957193, 2042978689)
  32. elseif choice == 2 then
  33. PlayFlavor(NPC, "voiceover/english/skeleton_base_1/ft/skeleton/skeleton_base_1_1_halfhealth_a4c947e4.mp3", "I'm shattered and broken.", "", 4021018144, 1305053073)
  34. elseif choice == 3 then
  35. PlayFlavor(NPC, "voiceover/english/skeleton_base_1/ft/skeleton/skeleton_base_1_1_halfhealth_d9ece37f.mp3", "You've shaken the dust from my bones.", "", 2011286772, 326848383)
  36. elseif choice == 4 then
  37. PlayFlavor(NPC, "voiceover/english/optional3/skeleton_base_2/ft/skeleton/skeleton_base_2_1_halfhealth_f1d542e0.mp3", "Dying didn't feel good the first time.", "", 766636803, 1915881366)
  38. elseif choice == 5 then
  39. PlayFlavor(NPC, "voiceover/english/optional3/skeleton_base_2/ft/skeleton/skeleton_base_2_1_aggro_18d1544d.mp3", "As I rise from the grave, you will now take my place!", "", 485726074, 3646499350)
  40. end
  41. end
  42. function ResetSpoke(NPC)
  43. spoke = false
  44. end
  45. function death(NPC, Spawn)
  46. if HasQuest(Spawn, 583) then
  47. local choice = math.random(1, 4)
  48. if choice == 1 then
  49. AddStepProgress(Spawn, 583, 1, 2)
  50. elseif choice == 2 then
  51. AddStepProgress(Spawn, 583, 1, 4)
  52. elseif choice == 3 then
  53. AddStepProgress(Spawn, 583, 1, 6)
  54. elseif choice == 4 then
  55. AddStepProgress(Spawn, 583, 1, 7)
  56. end
  57. end
  58. if HasQuest(Spawn, 584) or HasCompletedQuest(Spawn, 584) then
  59. RemoveLootItem(NPC, 2555)
  60. end
  61. spoke = false
  62. local chance = math.random(1, 100)
  63. if chance <= 10 then
  64. local choice = math.random(1, 2)
  65. if choice == 1 then
  66. PlayFlavor(NPC, "voiceover/english/skeleton_base_1/ft/skeleton/skeleton_base_1_1_death_fbcb503b.mp3", "Rest in peace.", "", 3591309093, 1423656405, Spawn)
  67. elseif choice == 2 then
  68. PlayFlavor(NPC, "voiceover/english/skeleton_base_1/ft/skeleton/skeleton_base_1_1_death_ff39f327.mp3", "Final death comes at last.", "", 3768284332, 62777040, Spawn)
  69. end
  70. end
  71. end