atreasurechest.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --[[
  2. Script Name : SpawnScripts/FarJourneyFreeport/atreasurechest.lua
  3. Script Author : LethalEncounter
  4. Script Date : 2020.07.02
  5. Script Purpose :
  6. :
  7. --]]
  8. function prespawn(NPC)
  9. SpawnSet(NPC, "visual_state", 0) -- default visual state of 0, we set the visual state when we open it
  10. end
  11. function spawn(NPC)
  12. ChangeHandIcon(NPC, 0)
  13. SpawnSet(NPC, "targetable", 0)
  14. end
  15. function respawn(NPC)
  16. spawn(NPC)
  17. end
  18. function open(NPC, Player)
  19. SendStateCommand(NPC, 399)
  20. AddTimer(NPC, 2000, "finished_open_animation")
  21. if HasPendingLoot(NPC, Player) then
  22. ShowLootWindow(Player, NPC)
  23. DisplayText(Player, 12, "There appears to be something inside this box.")
  24. InstructionWindow(Player, -1.0, "This screen shows the contents of the box you just opened. Left click on the loot all button to take the items from the box.", "voiceover/english/narrator/boat_06p_tutorial02/narrator_013_f0780e49.mp3", 1581263773, 1569244108, "tutorial_stage_17", "Left click on the loot all button.", "server")
  25. SetTutorialStep(player, 16)
  26. else
  27. DisplayText(Player, 12, "This box is empty.")
  28. ChangeHandIcon(NPC, 0)
  29. SpawnSet(NPC, "targetable", 0)
  30. end
  31. end
  32. function finished_open_animation(NPC)
  33. SpawnSet(NPC, "visual_state", 11903) -- this swings open right in DoF, in AoM its really quick but better, not aware of any time we can expose
  34. SendStateCommand(NPC, 400)
  35. end