9
3

Anikra.lua 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. --[[
  2. Script Name : SpawnScripts/FarJourneyFreeport/Anikra.lua
  3. Script Author : Ememjr
  4. Script Date : 2019.05.11 03:05:38
  5. Script Purpose :
  6. :
  7. --]]
  8. require "SpawnScripts/Generic/DialogModule"
  9. function spawn(NPC)
  10. SetTempVariable(NPC, "GoblinCheck", nil) -- Checks for Goblin attack and resets POST rain spell.
  11. AddTimer(NPC,6000,"DrakeLoop",1)
  12. end
  13. function hailed(NPC, Spawn)
  14. goblin = GetSpawn(NPC, 270008)
  15. if goblin == nil or IsAlive(goblin) == false and GetTempVariable(NPC,"GoblinCheck") == nil then
  16. FaceTarget(NPC, Spawn)
  17. choice = MakeRandomInt(1, 2)
  18. if choice == 1 then
  19. PlayFlavor(NPC, "voiceover/english/anikra/boat_06p_tutorial02_fvo_001.mp3", "Thanks for saving me", "thanks", 3802219844, 3242323771)
  20. else
  21. PlayFlavor(NPC, "voiceover/english/anikra/boat_06p_tutorial02/anikra_0_003.mp3", "I don't know how I did that. What was that?", "confused", 927876289, 3048340606)
  22. end
  23. elseif IsAlive(goblin) == true and GetSpawn(NPC, 270011)== nil and GetTempVariable(NPC, "GoblinCheck") == nil then --Stops hails during goblin attack
  24. elseif IsAlive(goblin) == true and GetSpawn(NPC, 270011)~= nil then
  25. PlayFlavor(NPC, "voiceover/english/anikra/boat_06p_tutorial02_fvo_002.mp3", "I really miss my husband. Why did those smugglers have to throw him overboard?", "sigh", 1493499523, 2767493059)
  26. end
  27. end
  28. function DrakeLoop(NPC)
  29. Drake = GetSpawn(NPC,270011)
  30. Goblin = GetSpawn(NPC,270008)
  31. if Drake == nil then
  32. AddTimer(NPC,6000,"GoblinLoop",1)
  33. SetTempVariable(NPC, "GoblinCheck", 1)
  34. else
  35. AddTimer(NPC,6000,"DrakeLoop",1)
  36. end
  37. end
  38. function GoblinLoop(NPC)
  39. Drake = GetSpawn(NPC,270011)
  40. Goblin = GetSpawn(NPC,270008)
  41. if IsAlive(Goblin) == false or Goblin == nil then
  42. AddTimer(NPC,3000,"RainPath",1)
  43. else
  44. AddTimer(NPC,6000,"GoblinLoop",1)
  45. end
  46. end
  47. function RainPath(NPC)
  48. MoveToLocation(NPC, -2.32, -2.07, 6.77, 2)
  49. MoveToLocation(NPC, -2.32, -2.07, 6.77, 2,"RainTimer")
  50. end
  51. function RainTimer(NPC)
  52. SetHeading(NPC,180)
  53. AddTimer(NPC, 1500, "Rain")
  54. end
  55. function Rain(NPC)
  56. CastSpell(NPC,20)
  57. AddTimer(NPC, 6000, "Rain2",1)
  58. AddTimer(NPC, 8000, "Reset",1)
  59. AddTimer(NPC, 10000, "Boggle",1)
  60. end
  61. function Rain2(NPC)
  62. Boxes = GetSpawn(NPC, 270013)
  63. PlaySound(NPC,"sounds/widgets/triggered_environmental/enviro_thunderroll001.wav",GetX(NPC),GetY(NPC),GetZ(NPC))
  64. PlayFlavor(Boxes,"","","rain")
  65. AddTimer(NPC, 14000, "Rain3",1)
  66. end
  67. function Reset(NPC)
  68. SetTempVariable(NPC, "GoblinCheck", nil)
  69. end
  70. function Boggle(NPC)
  71. PlayFlavor(NPC,"","","boggle")
  72. end
  73. function Rain3(NPC)
  74. Boxes = GetSpawn(NPC, 270013)
  75. PlayFlavor(Boxes,"","","kill_rain")
  76. end
  77. function respawn(NPC)
  78. spawn(NPC)
  79. end