acrudepitoncannon.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --[[
  2. Script Name : SpawnScripts/FrostfangSea/acrudepitoncannon.lua
  3. Script Purpose : for the spawn "a cude piton cannon"
  4. Script Author : theFoof
  5. Script Date : 2013.6.5
  6. Script Notes :
  7. --]]
  8. local SiegeOver = 53
  9. function spawn(NPC)
  10. SetRequiredQuest(NPC, SiegeOver, 1)
  11. LoadCannon(NPC) -- this starts the firing loop
  12. end
  13. function respawn(NPC)
  14. spawn(NPC)
  15. end
  16. function LoadCannon(NPC) -- sets the cannon to load the harpooon and start a timer
  17. SpawnSet(NPC, "visual_state", "20580")
  18. AddTimer(NPC, math.random(2000,5000), "FireCannon")
  19. end
  20. function FireCannon(NPC) -- fires the cannon and loops back to LoadCannon
  21. SpawnSet(NPC, "visual_state", "20579")
  22. AddTimer(NPC, 2000, "kill_fire")
  23. AddTimer(NPC, math.random(6000,15000), "LoadCannon")
  24. end
  25. function kill_fire(NPC) -- stops the firing animation from repeating
  26. SpawnSet(NPC, "visual_state", "53347")
  27. end
  28. function casted_on(NPC, Spawn, SpellName)
  29. if SpellName == 'destroy the cannon' then
  30. if GetQuestStep(Spawn, SiegeOver) == 1 then
  31. SpawnSet(NPC, "action_state", "2018")
  32. AddStepProgress(Spawn, SiegeOver, 1, 1)
  33. AddTimer(NPC, 1000, "depop")
  34. end
  35. end
  36. end
  37. function depop(NPC)
  38. Despawn(NPC)
  39. end