9
3

orcsiegetower.lua 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. --[[
  2. Script Name : SpawnScripts/Commonlands/orcsiegetower.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.03.08 08:03:54
  5. Script Purpose :
  6. :
  7. --]]
  8. local OrcSiegeTowerExplosionID = 330917
  9. local BloodskullDisruption = 404
  10. function spawn(NPC)
  11. SetPlayerProximityFunction(NPC, 5, "InRange")
  12. end
  13. function InRange(NPC, Spawn)
  14. if HasQuest(Spawn, BloodskullDisruption) then
  15. AddPrimaryEntityCommand(Spawn, NPC, "Destroy")
  16. SpawnSet(NPC, "display_hand_icon", 1)
  17. SpawnSet(NPC, "show_command_icon", 1)
  18. end
  19. end
  20. function casted_on(NPC, Spawn, SpellName)
  21. if SpellName == 'Destroy' then
  22. if not HasItem(Spawn, 6975) then
  23. SendPopUpMessage(Spawn, "You need explosives to destroy this. Perhaps you can find some in the orc supplies", 255, 215, 0)
  24. else
  25. RemoveItem(Spawn, 6975, 1)
  26. AddTimer(NPC, 2000, "explode")
  27. SpawnSet(NPC, "visual_state", "2017")
  28. if GetQuestStep(Spawn, BloodskullDisruption) == 4 then
  29. SetStepComplete(Spawn, BloodskullDisruption, 4)
  30. end
  31. end
  32. end
  33. end
  34. function explode(NPC, Spawn)
  35. local OrcSiegeTowerExplosion = GetSpawn(Spawn, 330917)
  36. SpawnSet(OrcSiegeTowerExplosion, "visual_state", "4557")
  37. SpawnSet(NPC, "model_type", 2375)
  38. SpawnSet(NPC, "visual_state", "0")
  39. AddTimer(NPC, 150000, "default_state")
  40. end
  41. function default_state(NPC, Spawn)
  42. SpawnSet(NPC, "model_type", 2374)
  43. end
  44. function respawn(NPC)
  45. spawn(NPC)
  46. end