Modding Help NPC Caves Permissions?

Discussion in 'Mods' started by AlisterAzimuth, Oct 14, 2016.

  1. AlisterAzimuth

    AlisterAzimuth Scruffy Nerf-Herder

    I tried to be as succinct as possible with the title, but what I mean is where in the game code would I find the permissions that enable specific NPCs to go retrieve a player in the caves, and is it possible to add more NPCs onto this list?

    For instance, Clint, Linus, Robin, Maru, and your spouse all have the ability to retrieve the player in the caves. What I want to do is modify it to where all bachelor/bachelorettes have the ability to retrieve the player as well. Unfortunately, the Mine event for where the player dies doesn't seem to provide much, and looking through the specified characters mentioned above doesn't seem to yield much information either.

    And of course my enter key stuck, so I posted this prematurely... I'd appreciate any help!

    Cheers!
     
    • badungu

      badungu Void-Bound Voyager

      Hmm, you can find the code inside the StardewValley.exe under StardewValley.GameLocation in the checkForEvents() Function:

      Code:
      if (Game1.killScreen && !Game1.eventUp)
          {
              if (this.name.Equals("Mine"))
              {
                  string text;
                  string text2;
                  switch (Game1.random.Next(7))
                  {
                  case 0:
                      text = "Robin";
                      text2 = "Data\\ExtraDialogue:Mines_PlayerKilled_Robin";
                      goto IL_B8;
                  case 1:
                      text = "Clint";
                      text2 = "Data\\ExtraDialogue:Mines_PlayerKilled_Clint";
                      goto IL_B8;
                  case 2:
                      text = "Maru";
                      text2 = ((Game1.player.spouse != null && Game1.player.spouse.Equals("Maru")) ? "Data\\ExtraDialogue:Mines_PlayerKilled_Maru_Spouse" : "Data\\ExtraDialogue:Mines_PlayerKilled_Maru_NotSpouse");
                      goto IL_B8;
                  }
                  text = "Linus";
                  text2 = "Data\\ExtraDialogue:Mines_PlayerKilled_Linus";
                  IL_B8:
                  if (Game1.random.NextDouble() < 0.1 && Game1.player.spouse != null && !Game1.player.spouse.Contains("engaged") && Game1.player.spouse.Length > 1)
                  {
                      text = Game1.player.spouse;
                      text2 = (Game1.player.isMale ? "Data\\ExtraDialogue:Mines_PlayerKilled_Spouse_PlayerMale" : "Data\\ExtraDialogue:Mines_PlayerKilled_Spouse_PlayerFemale");
                  }
                  this.currentEvent = new Event(Game1.content.LoadString("Data\\Events\\Mine:PlayerKilled", new object[]
                  {
                      text,
                      text2,
                      Game1.player.name
                  }), -1);
              }
              else if (this.name.Equals("Hospital"))
              {
                  this.currentEvent = new Event(Game1.content.LoadString("Data\\Events\\Hospital:PlayerKilled", new object[]
                  {
                      Game1.player.name
                  }), -1);
              }
      So maybe, if you check for (Game1.killScreen && !Game1.eventUp) and also for the Location, you could write your own code in SMAPI... :)
       
      • AlisterAzimuth

        AlisterAzimuth Scruffy Nerf-Herder

        Yes!! Yess this is exactly what I was missing!! Thank you SOOO much!! I guess now all that's left is implementing the code to be recognized by the game...
         
          Last edited: Oct 14, 2016

        Share This Page