widgetwaterpump.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. --[[
  2. Script Name : SpawnScripts/SerpentSewer/widgetwaterpump.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.07.01 06:07:51
  5. Script Purpose :
  6. :
  7. --]]
  8. local ASewageProblem = 5267
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 10, "InRange", Spawn)
  11. end
  12. function InRange(NPC, Spawn)
  13. if not HasQuest(Spawn, ASewageProblem) and not HasCompletedQuest(Spawn, ASewageProblem) then
  14. AddPrimaryEntityCommand(Spawn, NPC, "examine pump", 5, "examine pump", "", 100)
  15. SpawnSet(NPC, "show_command_icon", 1)
  16. SpawnSet(NPC, "display_hand_icon", 1)
  17. elseif HasQuest(Spawn, ASewageProblem) and not HasCompletedQuest(Spawn, ASewageProblem) then
  18. SpawnSet(NPC, "show_command_icon", 0)
  19. SpawnSet(NPC, "display_hand_icon", 0)
  20. end
  21. end
  22. function casted_on(NPC, Spawn, SpellName)
  23. if SpellName == 'examine pump' then
  24. conversation = CreateConversation()
  25. AddConversationOption(conversation, "Examine pump", "offer")
  26. AddConversationOption(conversation, "Leave the pump alone")
  27. StartDialogConversation(conversation, 1, NPC, Spawn, "You find a gnomish water pump.")
  28. SetAccessToEntityCommand(Spawn,NPC,"examine pump", 0)
  29. SpawnSet(NPC, "show_command_icon", 0)
  30. SpawnSet(NPC, "display_hand_icon", 0)
  31. AddTimer(NPC, 10000, "check", 1, Spawn)
  32. end
  33. end
  34. function offer(NPC, Spawn)
  35. OfferQuest(NPC, Spawn, ASewageProblem)
  36. conversation = CreateConversation()
  37. AddConversationOption(conversation, "I will stop them")
  38. StartDialogConversation(conversation, 1, NPC, Spawn, "Upon closer inspection you realize that the pump is pumping something into the sewers, not out! Those crazed channel menders must have something to do with this!")
  39. end
  40. function check(NPC, Spawn)
  41. if not HasQuest(Spawn, ASewageProblem) and not HasCompletedQuest(Spawn, ASewageProblem) then
  42. SpawnSet(NPC, "show_command_icon", 1)
  43. SpawnSet(NPC, "display_hand_icon", 1)
  44. SetAccessToEntityCommand(Spawn,NPC,"examine pump", 1)
  45. end
  46. end
  47. function respawn(NPC)
  48. spawn(NPC)
  49. end