Locks.gd 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. extends NpcScript
  2. # Required items
  3. var dorianKeyID : int = DB.GetCellHash("Dorian's Key")
  4. var gabrielKeyID : int = DB.GetCellHash("Gabriel's Key")
  5. var marvinKeyID : int = DB.GetCellHash("Marvin's Key")
  6. var mapID : int = "Splatyna's Chamber".hash()
  7. const mapPosition : Vector2 = Vector2(1500, 2190)
  8. #
  9. func OnStart():
  10. match GetQuest(ProgressCommons.QUEST_SPLATYNA_OFFERING):
  11. ProgressCommons.STATE_SPLATYNA.INACTIVE: Inactive()
  12. _: AskChoice()
  13. func AskChoice():
  14. if HasItem(dorianKeyID) and HasItem(gabrielKeyID) and HasItem(marvinKeyID):
  15. Mes("You notice three different key locks, what would you like to do?")
  16. Choice("Open them", TryOpen)
  17. Choice("Leave")
  18. else:
  19. Chat("You need three different keys to unlock this passage.")
  20. func TryOpen():
  21. # Check and remove items to open the chest
  22. if GetQuest(ProgressCommons.QUEST_SPLATYNA_OFFERING) != ProgressCommons.STATE_SPLATYNA.INACTIVE:
  23. if HasItem(dorianKeyID) and HasItem(gabrielKeyID) and HasItem(marvinKeyID):
  24. if RemoveItem(dorianKeyID) and RemoveItem(gabrielKeyID) and RemoveItem(marvinKeyID):
  25. Warp(mapID, mapPosition)
  26. else:
  27. Chat("You need three different keys to unlock this passage.")
  28. func Inactive():
  29. Chat("Three locks are blocking this passage.")