9
3

opentreasurechest.lua 643 B

12345678910111213141516171819202122232425262728
  1. --[[
  2. Script Name : SpawnScripts/FrostfangSea/opentreasurechest.lua
  3. Script Purpose : treasure chest in Frostfang Sea
  4. Script Author : theFoof
  5. Script Date : 2013.10.30
  6. Script Notes :
  7. --]]
  8. function spawn(NPC)
  9. SetPlayerProximityFunction(NPC, 15, "OpenChest")
  10. end
  11. function respawn(NPC)
  12. spawn(NPC)
  13. end
  14. function OpenChest(NPC)
  15. if GetTempVariable(NPC, "open_timer") == nil then
  16. SetTempVariable(NPC, "open_timer", "1")
  17. SpawnSet(NPC, "action_state", "11904")
  18. AddTimer(NPC, 25000, "CloseChest")
  19. end
  20. end
  21. function CloseChest(NPC)
  22. SetTempVariable(NPC, "open_timer", nil)
  23. SpawnSet(NPC, "action_state", "0")
  24. end