Catch event when player

Discussion in 'Mods' started by bluesaka111, Jul 1, 2016.

  1. bluesaka111

    bluesaka111 Scruffy Nerf-Herder

    I want to create a mod (require Chest Label System): whenever you deposit item(s), it will look for chests that:
    1. Chest TAG that contains string as format
      1. [Allow] Copper Iron Gold Iridium // Only allow those in list
      2. [Disallow] Copper Iron Gold Iridium // Allows all except those in list
      3. [UseTerm] TermID // single termID
    so which event should i catch when player:
    • Open a chest
    • Deposit item(s)
    • Catch when player press a key
    And how i draw custom sprite (obey Zoom level) to allow player... eh i means farmer define Terms that chests use to sort items?
     
      Last edited: Jul 1, 2016
    • Entoarox

      Entoarox Oxygen Tank

      There are draw hooks that get fired during the main draw call, use any of those to have zoom-level compliant drawing.

      For opening a chest, you can use the same preformatted code used to find custom tile actions, but adjust it to check for there being a chest instead.
      You can then listen for changes to the players own inventory to know if the chest inventory has changed.
      Keypresses require the relevant event to be registered and checked for.

      Edit: see https://github.com/ClxS/SMAPI/tree/master/src/StardewModdingAPI/Events for all events SMAPI provides.
       

      Share This Page