Modding Help Repeating Events

Discussion in 'Mods' started by MissCoriel, Mar 21, 2018.

  1. MissCoriel

    MissCoriel Phantasmal Quasar

    I am asking for one little thing right now on a mod I am working on. I want certain events to repeat on their own on certain days. I am still figuring things out and a bit of help would push forward my project much quicker.
    As an example, I made an event that Robin will visit you every week. I want to not have to make a new event for each week.
     
    • Digus

      Digus Spaceman Spiff

      Are you making a SMAPI mod? If not, I don't know if its possible.
      If it is, you will need to remove your event id from the list of events seen by the player at the end of everyday, so it can happen again next week.
      Or you can dynamically add the same event with a new id when you want it to happen.
       
      • MissCoriel

        MissCoriel Phantasmal Quasar

        ok... well then how best do I remove the event id? I been reading but not all of it is apparent to me
         
        • Digus

          Digus Spaceman Spiff

          I don't have the de-compiled game code right now. I can look for you later tonight.
          I would start looking into Game1.player
           
          • MissCoriel

            MissCoriel Phantasmal Quasar

            i don't even have decompiled game code.. i am quite the novice.
             
            • Digus

              Digus Spaceman Spiff

              The list is really there: Game1.player.eventsSeen
              It's a int list, just call remove at the end of begin of the day and it should work.
               
              • MissCoriel

                MissCoriel Phantasmal Quasar

                Sooo. I got to figure that out lol. Thanks for pointing me in the right direction
                 
                • Digus

                  Digus Spaceman Spiff

                  After get your SMAPI mod working(there is guides for that), just add this line to the entry method:
                  Code:
                  TimeEvents.AfterDayStarted += (s,e) => Game1.player.eventsSeen.Remove(999999)
                  Replace 999999 with you event ID.
                   
                  • MissCoriel

                    MissCoriel Phantasmal Quasar

                    I see.. i am not using SMAPI, I am just adding/editing yamls
                     
                    • Digus

                      Digus Spaceman Spiff

                      I guessed that, but I don't see how you can do it without using SMAPI. You would have to add an event for each week of each year you would like your mod to support. And you can't even choose the year for the event, just a minimal. So if someone installed your mod on year four, it would show the event 4 times if the player kept entering and existing the location.
                       
                      • MissCoriel

                        MissCoriel Phantasmal Quasar

                        not even sure where to begin on that. I kinda stumbled on how to do this.

                        I am open to making the adjustment. I just got to figure out how to change it from my current setup to the new one. I have everything saved in a separate place to edit and update as I please. Making the events and dialogue is super easy. I just need to figure out how to put SMAPI into it.
                         
                          Last edited: Mar 23, 2018
                        • Digus

                          Digus Spaceman Spiff

                          You could use SMAPI to edit events and dialog, but it's more complicated and you don't need to. You can keep your current setup, and people using your mod would have to install like they do know, and also install your SMAPI module.
                          If you have no coding experience at all it will more difficult, but you can still follow this guide:
                          https://stardewvalleywiki.com/Modding:Creating_a_SMAPI_mod
                          Then just replace
                          Code:
                          InputEvents.ButtonPressed += this.InputEvents_ButtonPressed;
                          with the code I posted before.
                           

                          Share This Page