Chest.gd 944 B

123456789101112131415161718192021222324252627282930313233343536
  1. extends NpcScript
  2. # Reward items
  3. var appleID : int = DB.GetCellHash("Apple")
  4. # Required items
  5. var dorianKeyID : int = DB.GetCellHash("Dorian's Key")
  6. var gabrielKeyID : int = DB.GetCellHash("Gabriel's Key")
  7. var marvinKeyID : int = DB.GetCellHash("Marvin's Key")
  8. #
  9. func OnStart():
  10. match GetQuest(ProgressCommons.QUEST_SPLATYNA_OFFERING):
  11. ProgressCommons.STATE_SPLATYNA.INACTIVE: Inactive()
  12. ProgressCommons.STATE_SPLATYNA.STARTED: TryOpen()
  13. _: Empty()
  14. func Inactive():
  15. Chat("This chest seems to be sealed.")
  16. func TryOpen():
  17. if IsMonsterAlive("Splatyna"):
  18. Chat("A dark presence is still around.")
  19. else:
  20. # Chest is not open, try to open it
  21. if not IsTriggering():
  22. Trigger()
  23. # Chest is opened, you can withdraw your reward
  24. if HasSpace(1):
  25. SetQuest(ProgressCommons.QUEST_SPLATYNA_OFFERING, ProgressCommons.STATE_SPLATYNA.REWARDS_WITHDREW)
  26. AddItem(appleID, 5)
  27. func Empty():
  28. Chat("This chest is empty.")