9
3

afallenknight.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --[[
  2. Script Name : SpawnScripts/QeynosCitizenshipTrialChamber/afallenknight.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.08.31 03:08:14
  5. Script Purpose :
  6. :
  7. --]]
  8. local CalloutCount = true
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 7, "InRange", "LeaveRange")
  11. end
  12. function InRange(NPC, Spawn)
  13. if GetQuestStep(Spawn, 5718) >=4 or GetQuestStep(Spawn, 5719) >=4 or GetQuestStep(Spawn, 5720) >=4 or GetQuestStep(Spawn, 5721) >=4 or GetQuestStep(Spawn, 5722) >=4 or GetQuestStep(Spawn, 5723) >=4 then
  14. DoorCheck(NPC,Spawn)
  15. end
  16. end
  17. function DoorCheck(NPC,Spawn)
  18. Door = GetSpawn(NPC,22101355)
  19. if Door ~= nil then
  20. Despawn(Door)
  21. end
  22. end
  23. function hailed(NPC, Spawn)
  24. if CalloutCount == true then
  25. choice = MakeRandomInt(1,2)
  26. if choice == 1 then
  27. Say(NPC,"Avenge my death...")
  28. else
  29. Say(NPC,"Unghhh...")
  30. end
  31. CalloutCount = false
  32. else
  33. choice = MakeRandomInt(1,3)
  34. if choice == 1 then
  35. SendMessage(Spawn, "The knight does not respond to your actions.")
  36. elseif choice == 2 then
  37. SendMessage(Spawn, "There is no indication the knight is still breathing.")
  38. elseif choice == 3 then
  39. SendMessage(Spawn, "No amount of hailing stirs the knight.")
  40. end
  41. end
  42. end
  43. function respawn(NPC)
  44. spawn(NPC)
  45. end