9
3

BackHallofSteeldoor.lua 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --[[
  2. Script Name : SpawnScripts/QeynosHarbor/BackHallofSteeldoor.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.10.24 08:10:46
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. SetPlayerProximityFunction(NPC, 16, "InRange", "LeaveRange")
  10. end
  11. function InRange(NPC,Spawn)
  12. if HasItem(Spawn,1001032,1) and not IsOpen(2210362) then
  13. SetAccessToEntityCommand(Spawn,NPC,"Open", 0)
  14. SpawnSet(NPC, "show_command_icon", 0)
  15. SpawnSet(NPC, "display_hand_icon", 0)
  16. else
  17. SetAccessToEntityCommand(Spawn,NPC,"Open", 1)
  18. SpawnSet(NPC, "show_command_icon", 1)
  19. SpawnSet(NPC, "display_hand_icon", 1)
  20. end
  21. end
  22. function casted_on(NPC, Spawn, SpellName)
  23. if SpellName == 'Open' then
  24. if HasItem(Spawn,1001032,1) and not IsOpen(2210362) then
  25. local widget = GetSpawn(Spawn, 2210362)
  26. OpenDoor(widget)
  27. UseWidget(2210362)
  28. RemoveItem(Spawn,1001032,1)
  29. SendMessage(Spawn,"Your old Halls of Steel key opens the door but crumbles in the lock.")
  30. AddTimer(NPC,11000,"CloseDoor")
  31. else
  32. SendMessage(Spawn,"The large door doesn't budge.")
  33. end
  34. end
  35. end
  36. function CloseDoor(NPC)
  37. local widget = GetSpawn(Spawn, 2210362)
  38. CloseDoor(widget)
  39. end
  40. function respawn(NPC)
  41. spawn(NPC)
  42. end