9
3

door12.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --[[
  2. Script Name : SpawnScripts/WailingCaves/door12.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.02.18 08:02:02
  5. Script Purpose :
  6. Note : Updated for various states & related indicators. Dorbin 2/17/2022
  7. --]]
  8. function spawn(NPC)
  9. end
  10. function usedoor(NPC, Spawn, IsOpen)
  11. local zone = GetZone(NPC)
  12. local LordRee = GetSpawnByLocationID(zone, 404840)
  13. -- Checks if Ree is spawned but not active and player doesn't have a key
  14. if IsAlive(LordRee) and GetTempVariable(LordRee, "HAILED1") == "true" and not HasItem(Spawn, 2006) and IsOpen == false then
  15. CloseDoor(NPC)
  16. SendMessage(Spawn, "The door is locked.", "yellow")
  17. --Closes door
  18. elseif GetTempVariable(LordRee, "HAILED1") == "false" and IsOpen == true then
  19. CloseDoor(NPC)
  20. SendMessage(Spawn, "The door is closed.", "yellow")
  21. -- if player has 'a large orcish key', the door can be closed
  22. elseif IsAlive(LordRee) and IsOpen == true and HasItem(Spawn, 2006) then
  23. CloseDoor(NPC)
  24. -- if player has 'a large orcish key', the door can be opened and they lose their key
  25. elseif IsAlive(LordRee) and HasItem(Spawn, 2006) and IsOpen == false then
  26. OpenDoor(NPC)
  27. RemoveItem(Spawn, 2006)
  28. SendMessage(Spawn, "Your key falls apart as the door opens.", "yellow")
  29. else
  30. --if Ree is active or dead
  31. --if not IsAlive(LordRee) and IsOpen == false then
  32. SendMessage(Spawn, "The door won't budge.", "yellow")
  33. end
  34. end
  35. function respawn(NPC)
  36. spawn(NPC)
  37. end