bloodskullsupplies.lua 1.5 KB

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