Alright so it's been a while seen I've tried modding Stardew Valley, over a year I think? But with it coming out to the switch tomorrow I've gotten back into the game, and an old project I was working on. Basically I was trying to add a new NPC called Dakota. I managed to figure it out, but I can't remember how anymore since it was a while ago, and because of the game updating the old mod I was working on doesn't work anymore. So I'm redoing it from memory, but honestly I have no idea if what I'm doing is right anymore. I'm getting an error with SMAPI, but my NPC is showing up in the game and in the villager list: She just isn't following any schedule for some reason, even though she has a schedule XBB file. If anyone could give me some pointers as to what I'm doing wrong I'd really appreciate it. (Also, I don't know C#, only Java, so my code's probably a mess.) Here's my code so far: using System; using Microsoft.Xna.Framework; using StardewModdingAPI; using StardewModdingAPI.Events; using StardewValley; using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; namespace CharaExpansionMod { public class ModEntry : Mod { public override void Entry(IModHelper helper) { GameEvents.UpdateTick += GameEvents_UpdateTick;} private void GameEvents_UpdateTick(object sender, EventArgs e) { if (Game1.currentLocation != null) { if (Game1.getCharacterFromName("Dakota") == null) foreach (var i in Game1.locations) if (i.name == "SeedShop") { var test = new NPC(new AnimatedSprite(Game1.content.Load<Texture2D>("Characters\\Dakota"), 0, Game1.tileSize / 4, Game1.tileSize * 2 / 4), new Vector2((float)(8 * Game1.tileSize), (float)(7 * Game1.tileSize)), "SeedShop", 2, "Dakota", false, (Dictionary<int, int[]>)null, Game1.content.Load<Texture2D>("Portraits\\Dakota")); i.addCharacter(test); test.getSchedule(Game1.dayOfMonth); test.reloadSprite();} if (!Game1.NPCGiftTastes.ContainsKey("Dakota")) Game1.NPCGiftTastes.Add("Dakota", "Wow I can't believe you got this for me! Thanks!$h/64 336/Hey this is pretty neat, thanks!$h/-28 420 257 281 107 305 247/What? You're giving me THIS? Thanks...$s/80 348 346 303 -74/Is this supposed to be a joke?/390 388 330 571 568 569/Oh... Thanks?$u// ");}}}} And the error from SMAPI: [01:47:03 ERROR SMAPI] A mod failed handling the GameEvents.UpdateTick event: System.NullReferenceException: Object reference not set to an instance of an object. at StardewValley.NPC.getLocationRoute(String startingLocation, String endingLocation) at StardewValley.NPC.pathfindToNextScheduleLocation(String startingLocation, Int32 startingX, Int32 startingY, String endingLocation, Int32 endingX, Int32 endingY, Int32 finalFacingDirection, String endBehavior, String endMessage) at StardewValley.NPC.parseMasterSchedule(String rawData) at StardewValley.NPC.getSchedule(Int32 dayOfMonth) at CharaExpansionMod.ModEntry.GameEvents_UpdateTick(Object sender, EventArgs e) in d:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Mods\CharaExpansionMod\CharaExpansionMod\ModEntry.cs:line 29 at StardewModdingAPI.Framework.InternalExtensions.SafelyRaisePlainEvent(IMonitor monitor, String name, IEnumerable`1 handlers, Object sender, EventArgs args) in d:\source\_Stardew\SMAPI\src\StardewModdingAPI\Framework\InternalExtensions.cs:line 40
Hi @silrae. Come ask in #modding on the Stardew Valley Discord and we'll help you get it working. It'll be easier than doing it through forum posts.