9
3

digging_machine_2.lua 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --[[
  2. Script Name : SpawnScripts/Caves/digging_machine_2.lua
  3. Script Purpose : digging_machine_2
  4. Script Author : Scatman
  5. Script Date : 2009.10.18
  6. Script Notes :
  7. --]]
  8. local QUEST2_FROM_EMMA = 227
  9. function spawn(NPC)
  10. SetRequiredQuest(NPC, QUEST2_FROM_EMMA, 2)
  11. end
  12. function respawn(NPC)
  13. spawn(NPC)
  14. end
  15. function hailed(NPC, Spawn)
  16. end
  17. function casted_on(Target, Caster, SpellName)
  18. if HasQuest(Caster, QUEST2_FROM_EMMA) and not QuestStepIsComplete(Caster, QUEST2_FROM_EMMA, 2) and SpellName == "Place Explosives" then
  19. SetStepComplete(Caster, QUEST2_FROM_EMMA, 2)
  20. AddTimer(Target, 1000, "DespawnMachine")
  21. end
  22. end
  23. function DespawnMachine(NPC)
  24. local digging_machine2 = GetSpawn(NPC, 1970122)
  25. Despawn(digging_machine2)
  26. local control_device2 = GetSpawn(NPC, 1970128)
  27. Despawn(control_device2)
  28. local crate2 = GetSpawn(NPC, 1970130)
  29. Despawn(crate2)
  30. local instructions2 = GetSpawn(NPC, 1970127)
  31. Despawn(instructions2)
  32. local shovel2 = GetSpawn(NPC, 1970129)
  33. while shovel2 ~= nil do
  34. Despawn(shovel2)
  35. shovel2 = GetSpawn(NPC, 1970129)
  36. end
  37. -- spawn smashed machine
  38. Despawn(NPC)
  39. end