#making-mods-general
1 messages · Page 444 of 1
if everything is working fine now and theres no issues i dont need the patch ill just add a note to the description of the traction
okay!
so what's the use case for regenerating without clearing/replacing terrain features at the target tiles?
if you added a map patch that adds new things to the paths layer
also, it was only tonight i realized that what i thought were anti-duplicate checks are not in fact preventing duplicates. you wouldnt wanna clear a space if you didnt have to bc what if someone planted a tree there themselves or somethin
Remind me in 2 days to look into ammortization/chunking to reduce startup lag for hhd
il smack ye upside the ead tlitookilakin i sware on me mum. but ok just this once mate (#6899719) (2d | <t:1760161712>)
Is it possible to make a content patcher mod to replace the projectile.png?
I'd be surprised if it wasn't possible
Folks, I'm trying to Google how to edit the map to see if I can make a patch for @oblique meadow's Sylvanlight farm.
All I'm getting is stuff on how to create the farm maps, or change the forest, etc. I want to edit the one that is in the menu and shows like the characters on it. (Mostly so I can find my dang character.)
I'm clearly not using the right words, or it's not possible. Any assistance?
WORLD map
Fork.
Thank you 🙏🏻
I'm in a lot of pain today and my brain is not Englishing well 🤣
Sweet deal. Going to add this to the top of mods I want to try writing. (Even if just for me.)
It'll probably be easier to start with replacers then ones that add in quests and NPCs anyway lol
It's really not that hard to modify the map, hardest part is doing the art ^^
And yeah, replacing is always easier than adding for this game, but the processes aren't that different so it's easy to learn :)
Good to know! I have a really fun mod I want to make but I'm intimidated 😩 I figure I'll start smaller and work my way up. Gives me time to figure out dialogue. It's only like one interaction per character, but trying to write in different voices is more difficult than anticipated.
Speaking of, the sprites don't really have hands, do they?

Not really
You just have more or less a vague approximation of one
https://smapi.io/json/content-patcher/92c63a05e5674bfe84929b4d04c73afd does anyone know why the characters aren't spawning during the festival?
Have you done a patch export of Data/Festivals/fall6 to confirm the EditData patch worked?
yep, the festival itself works, it's just the characters don't show up
(it wasn't working earlier, and i figured out i need to load a blank lol)
do you need to see the patch export?
Nah
I don't have much experience with festivals, but in looking at the json I copied from Jorts and Jean I see the year 1 Set-Up_additionalCharacters doesn't have _y1 after it like yours does. Have you tried without it?
yeah, both
Ah yes reading the wiki more it says to use the y1 bit
yep!
I have nothing more to offer without starting a deep dive I can't afford to do right now, sorry. Might be helpful to provide a log with a patch summary for just your mod though
no worries! will do
https://smapi.io/log/0ffd7f4d891e4166b34c6acbace2e0ce you're looking for data/VeilFestival
Log Info: SMAPI 4.3.2 with SDV 1.6.15 build 24356 on Microsoft Windows NT 10.0.22631.0, with 21 C# mods and 1 content packs.
Suggested fixes: One or more mods are out of date, consider updating them
I'm not sure, but I think you need to have a loadActors Set-Up somewhere in the set-up field?
Or maybe that's just for the path icon map thingie?
loadActors does load people from the layer in Tiled of the same name (Set-Up but it can technically be whatever, though Set-Up specifically has some extra stuff for spouses and children?) and will also load <layerId>_additionalCharacters_y[year]
so loadActors Set-Up loads the Set-Up layer in Tiled and Set-Up_additionalCharacters_y[year] in the festival data
it is case sensitive
H-hi, I encountered this problem with my custom Krobus sprite as I tested my custom Krobus mod
I think it's because my spritsheet is taller than vanilla Krobus'
How can I fix this?
hi, you'll want to add a TargetField patch to change Krobus' size in Data/Characters, he's only 16x24 in data
example here:
https://github.com/Pathoschild/StardewMods/blob/develop/ContentPatcher/docs/author-guide/action-editdata.md#target-field
if i've written it out right, it'll look something like this:
{
"Format": "2.8.0",
"Changes": [
{
"Action": "EditData",
"Target": "Data/Characters",
"TargetField": [ "Krobus" ],
"Entries": {
"Size": {
"X": 16,
"Y": 32
}
}
}
]
}
you could also use TargetField: [ Krobus, Size ] with just the X and Y entries if you wanted to be a little funny
but we're very serious here. not very funny at all
It worked!! Thank you 💖
no problem! 
(fwiw since Size is only 1 level in, using Fields instead of Entries + TargetField would've also worked fine)
we choose to be very slightly funny
I love using fields during those very few times i am able to
makes me feel like a slacker
I posted it over on Nexus! Where can I promote it on this server 😅
🤔 hmmmm sooo.... about that "make villagers only like items tagged A AND B, not either or" thing
since i can't just do something like that in vanilla with coming up with combinations for every outcome
what will i need to do in order to Make a Mod that does that?
i assume you already know C# is involved
Would it be possible to reverse it? Like, (A AND B) = NOT (NOT A OR NOT B)
yeah, i do
c# is probably infinitely easier than doing the "list every combo" route, and it can be used in more cases
how can i make mods guys?
!startmodding
Making mods can be broadly divided into two categories:
- Content packs are formatted text files, and don't need any programming knowledge. They can add/edit NPCs, maps, new items, shops, and more. To get started, see the list of framework mods, the wiki tutorial for Content Patcher, and there might be relevant guides on the tutorial wiki.
- C# mods use programming code to change fundamental game mechanics. See getting started with C# modding.
Usually it’s easier to start with making content packs, since you don't need to learn programming.
c#
you can do a lot of mods without writing any C# (see first bullet point)
i want to make a hotkey to add 1 skill level
that would be a pretty good first mod if you want to learn C# modding
adding hotkeys is usually C# territory but i wouldn't be surprised if spacecore or betas or some other big glue mod had some level of hotkey support for content mods
can yall teaach me
We can provide advice/guidance, access to resources, and feedback. But if you want someone to take you step by step how to make a mod you'll probably need to head to the commissions page on the wiki to find someone (mostly people who are members of this server, not randoms) you can pay to teach you that way.
replacement tablet is on its way 
and so is school break, so yay 24/7 modding is in my future!
I'll use my powers of knowing brands and wildly predict it's a Huion in attempt to be accidentally correct. 
Damn. Worth a try!
oh yeah, I forgot about that, my bad
Can somebody look at this manifest real quick and see if I put the false dependency in correctly? Would be greatly appreciated!
Oh wait. I think I need to put false in quotations
!json please
JSON is a standard format for machine-readable text files that's used by Stardew Valley mods.
If you need help with a JSON file, you can upload it to smapi.io/json to see automatic validation and share the link here.
When making mods, it's recommended to edit your files in a text editor with JSON support, such as VS Code, Notepad++, or Sublime Text. These programs will check for syntax errors.
for your own sake and the sake of our eyes
Hahaha I'm so sorry
My internet is out, so getting things from the computer to my phone is not an option at the moment. I will try again in the morning.
Shouldn't be a space in IsRequired
Or UniqueID
Looks okay other than that. Is this someone else's manifest you're editing?
yeah, who would define a data model with spaces in the keys (👀 )
@vernal crest It is. I'm trying to get Firefly Torches to load after my UI. The two of them together makes only the flame visible
All good then, just wanted to make sure you weren't accidentally taking orangeblossom's username lol
Haha no no, I am an artist myself and wouldn't want to do that to someone 🫶🏻
May I recommend you save yourself some future heartache and look into better text editors than Notepad?
Any recommendations?
I think I might have notepad plus plus, but it's very confusing 
Windows 10, crazy outdated hardware, pretty much nothing on it except for steam, stardew Valley, and graveyard keeper haha
!software
Here's a list of software for pixel art and JSON text editors we recommend: https://gist.github.com/ishanjalan/c8efb21afa21f74a052293176db107f7
For making SMAPI (C#) mods, see the Requirements section here for which IDE to install https://stardewvalleywiki.com/Modding:Modder_Guide/Get_Started#Get_started.
I always recommend Visual Studio Code (use the link rather than googling, it's easy to accidentally download Visual Studio 22 instead which is a different thing). It's not as lightweight as N++ or Sublime but I think it's more beginner friendly and has more built-in tools to help you keep on track with syntax and formatting than the other two.
Ty for rec
(Also don't forget the comma after "Goshcakes.customMenuEtc")
hellooo uhh how difficult would it be to make a mod that enables junimo huts on the ginger island farm? tryna find one but I can't :(
I'm assuming it might need C#...
https://www.nexusmods.com/stardewvalley/mods/20600 already done
AAA ty :)
i'm tempted
they show up in my console but it might not be the same for everyone ......
hehe
i think this is accurate marketing
now i wanna do that-
how could you sabotage my formality like this /s
it's probably bad practice 😭 it's probably fine for something like portraits but elsewhere you wouldn't want the player forgetting what the hell they've put in their game
...i mean my mod's current id is theyrejustcuteokay sooooo
..prolly gonna change it later but still-
In Depth Taxes Mod | awww the scrunkly 🥰🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺
first rule of modding is have fun
i mean i made this line change and I do intend to keep it-
"TriedToMarryButKrobus": "You can't propose to someone while living with a housemate. Besides, why would you? Krobus is obviously superior to any of the romanceable characters like cmonnnn.. (You could also download a poly mod, free love is pretty good!) - {{ModId}} creator <",
i don't think any mod has a wholly serious tone lol
the vanilla game has the dialogue key "TriedToMarryButKrobus", which is straight-up hilarious /lh
how would one add a context tags to entries in Data/Objects after the game added the automatically generated ones? Like category_<category> and stuff
is editing Data/Objects on assetRequested late enough?
I KNOW it's great lol
the autogenerated ones are added to the object instances long after their data is read
they're not part of data
what's your use case? are you trying to change the category context tag of an item without actually changing the category?
damn it
adding context tags based on what is already on the item
like category_vegetable AND color_green
but on a large scale
well nothing stopping you from adding those tags to data directly too
I still don't quite get it sorry 😅 color_green is not an autogenerated tag
oh wait I get it
I think
i think this may be related to "make villagers like item that has both context tags" thing
yes
well if you're working in C# you can just check "Category Vegetable" instead of "have category_vegetable"
yeah
pretty much every autogenerated tag is based on data in the first place
I know that, but the goal is to make a CP framework where people give a logic combination of context tags
Well u can do that with gsq right
maybe you can just hardcode those cases
hell no
What if u make a gift taste system that check gsq
Instead of the vanilla gift taste stuff
well uuuuhhhhh postfix _PopulateContextTags
it was discussed a few days ago, the conclusion was to add the combined context tags to the items instead of changing how gift tastes works so that this could be used for anything based on context tags, including anytime GSQs are used
yeah, that would be the idea.
damn, I was looking forward to making a mod without harmony...
Well i disagree with this conclusion 
GSQ can just do 2 comma separated has content tag
I don't think there's that many places that only support a ctag
check the conversation about it: #making-mods-general message
Yeah I can see the opposing argument but I think it's better for more things to just support GSQ item condition
Because it's the more powerful system and has more applications beyond just this
this is only for gift tastes right
perhaps it can still be without harmony if you hook up day start (to 'fix' every object) and inventory changed (to 'fix' new objects entering farmer inventory)
(terrible idea perf wise so don't do it)
I could make it so that the character gets a shrimp allergy during heart event 8 and now hate shrimp
:(
Something like this wouldn't be checking ctags at all
I think this is actually a two cakes situation
A mod to generate context tags from other context tags and another to create GSQ gift tastes
hmmm, actually, postfixing Item._PopulateContextTags would allow GSQ as well...
oh well, 1 a.m. so future me problem (I'm gonna forget)
Is there a tutorial on how to make spouse room redesign mods 🥲 programming is one of my weak points, so I need a tutorial to help me understand it. I don't even know where to look to find the vanilla spouse rooms in the game files
To add: I just want to change Krobus' to match my Krobus portrait mod, and I also want it to accomodate the free love players
I'd advise you to find a mod that basically does what you want, and see how they did it :)
But it's not hard, you can do it with content patcher and just modify the spouse room map (I don't know where to find these specific assets however; have you unpacked the game files to see where they are?)
!unpack
Follow this guide to unpack the game's content files in order to see and explore how the game data is structured.
It's helpful when making your own mods, or just to learn about how the game works!
After you've unpacked the content files, you'll be able to find the spouse rooms in Maps\spouseRooms.tmx. What you'd want is to have your own map patch over the Krobus section of that map.
that makes sense! i thought that command was only for loading positions from the map. thank you!
hmmm doing profiling on my testing instance and it seems like this sucker is responsible for the majority of hhd's menu load time
maybe lazy-loading at integration is a thing I can do
hey hey! i’m Kry (or Krystin / YourHonorTheyNeededToSuffer). self-taught coder + writer + chaos gremlin. i’ve been deep in fandom coding hell for years — built a 25k-line discord bot (ArchiveMate) by myself, run a chaotic writing/book club server, and dm a custom D&D campaign i coded systems for.
i’m learning sprite + pixel work right now because i’ve officially lost my mind and decided to make a Stardew Valley × My Hero Academia expansion called Stardust Institute. think: cozy farm mornings, hero college afternoons, and villain encounters at night.
twelve romanceable students (aged-up class 1-A), five teachers, four roaming villains, full SDV romance/event system. quirks become buffs + gear (no crazy engines, just smapi/json assets), the farmer stays quirkless for story reasons.
nothing’s built yet — i’m still in the concept + planning + “learn every pixel art tutorial ever made” phase — but i’m serious about building it and hoping to meet folks who love coding, writing, or art for SDV and want to teach or collab
I am having a brainfart on what fuction to use,
to play a sound for only the players nearby the specific tile, I use...?
like, do I use
player.playnearbysoundlocal
player.playnearbysoundall
player.currentlocation.playsound(player, tile)

does anyone have a guide or mods to reference for custom monsters? i've never been able to figure out how to make one
because you can't really, outside of doing it with C#
but there are frameworks to reskin or make variant of existing monsters
well i intend to use c# if i ever figure out where to start😓
is there a way to offset only the hats instead of hats and hair on a fashion sense body?
you can go pretty far with just reskins (with custom stats, drops, locations) if you don't have complex custom behaviors in mind
monster that rushes you in melee? slimes/shadow guys/mummies/etc
flying monsters? bats/serpents
hiding monsters? rock crabs
ranged monsters? skeletons/mages
but yeah anything else is rolling your own Monster subclass
Hi guys, I want to make a mini personal mod that helps with logging data from the fishing minigame. Is there a way I can extract general data from it? Ie whether a fish is in the catch bar or not, how much xp has been gained from fishing and other pieces of data related to fishing. I am very new to modding as you can probably tell and I just started looking through the source code today
looking through the decompile is definitely the way to go! as for making a mod in general, we have some resources. you'll want the C# side of things
!startmodding
Making mods can be broadly divided into two categories:
- Content packs are formatted text files, and don't need any programming knowledge. They can add/edit NPCs, maps, new items, shops, and more. To get started, see the list of framework mods, the wiki tutorial for Content Patcher, and there might be relevant guides on the tutorial wiki.
- C# mods use programming code to change fundamental game mechanics. See getting started with C# modding.
Usually it’s easier to start with making content packs, since you don't need to learn programming.
Yea I've created a mini mod based off of the tutorial where it logs what buttons you pressed
But I want to familiarize myself with the attributes and figuring out how to get specific trigger events/data pieces from the game
great! unfortunately i'm a very beginner C# modder myself so i don't have any other advice, but yeah keep poking through the decompile
i believe SDV is event-based coding so in general you're going to want to check things based on that
!decompile and reading through the source is your best bet
If you want to make SMAPI mods with C#, one important resource is decompiling the game to read the game code. Here's how to do it: https://stardewvalleywiki.com/Modding:Modder_Guide/Get_Started#How_do_I_decompile_the_game_code.3F
you should decompile it yourself, that may be out of date
i see
in this case you want to look at the code for FishingRod the tool and BobberBar the menu
Yea, I know where that is. It is in the menu folder
that's also piracy and illegal
(what the repo owner did not you)
I also relied on a random public decompile originally (didn't know better), but it's pretty easy to do the steps, and won't be outdated/etc that way
(tbh same lmao)
Before I go on my break in a day or two, I am adding some letters!!
a lot 😭
: D
Hello guys, I'm working on my very first c# mod (I am completely new to c#). But when I try to test it, I get a message (on the SMAPI console window) saying it's DLL doesn't exist. I'm guessing the path to the DLL isn't set correctly. How do I properly set the path to the DLL?
I'm using Visual Studio 2022 btw
!startmodding
Making mods can be broadly divided into two categories:
- Content packs are formatted text files, and don't need any programming knowledge. They can add/edit NPCs, maps, new items, shops, and more. To get started, see the list of framework mods, the wiki tutorial for Content Patcher, and there might be relevant guides on the tutorial wiki.
- C# mods use programming code to change fundamental game mechanics. See getting started with C# modding.
Usually it’s easier to start with making content packs, since you don't need to learn programming.
Have you followed the getting started guide?
yes
How did you compile your project?
Question re: i18n translation patches. Are translations still subject to the original mod author's permissions if the only file with the translation is the translated i18n json file?
translations are considered a derivative work and subject to the original authors copyright and permissions
most mod authors however would be happy to have it translated
but it cant hurt to ask
nexus sides with original author if they issue take down
Thanks, that's what I thought! I'm fine with anyone doing it but the translators are accepting Donation Points which I don't allow through my permissions.
You can report that if you want
oh if its your mod you can decide whatever you want basically
like chu says nexus sides with the author if the author makes a case and will go beyond just like, "is this technically legal" to decide it
Is also fine to just dm translator if u dont wanna escalate yet
Sometimes ppl just aren't aware of perms nuance
I pressed "Build Solution," if that's what you mean. I just did that part again to be sure I didn't miss anything, and now I'm getting this error: "[mod build package] Failed trying to deploy the mod.
System.IO.IOException: The process cannot access the file 'C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Mods\TMmeca\manifest.json' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.FileInfo.CopyTo(String destFileName, Boolean overwrite)
at StardewModdingAPI.ModBuildConfig.DeployModTask.CreateModFolder(IDictionary`2 modPackages, String outputPath)
at StardewModdingAPI.ModBuildConfig.DeployModTask.Execute()" I'm not sure if I just missed the error before or if it wasn't showing up earlier, probably (actually, definitely) the former. That said, I have no idea what other process might be using the file.
My only real issue with translations is I've no idea if they're any good or just machine translated drek.
I mostly just ignore them.
are you having an instance of stardew open?
nope
looks like it's not just you LOL
according to 1 poster, simply closing and restarting is enough to fix it
those arent emojis
ik, just same vibe lol
Try restarting VS, i been told that sometimes it holds onto files too hard
@uncut viper: add a note to the BETAS docs about clearing before regenerating (18h ago)
Welp, I tried those solutions, nothing worked (especially just restarting VS, that would’ve been too good to be true). I guess I’ll try again tomorrow. Still, I wanted to thank you for trying to help (and you too, chu√e)
If all else fails I might consider restarting the computer
Just to reallllllly kill any processes
okay i am cooking rn and this is sort of a triumph but i did an oopsie lol
i hope it will be for general use eventually! right now i'm being my usual self about it
i'm sure this is something simple like i fucked up the parameters on the spritebatch or whatever but i haven't figured it out yet
this.Monitor.Log($"Current Active Menu: {type is StardewValley.Menus.BobberBar}", LogLevel.Debug);
i've confirmed that the type is BobberBar, yet for some reason the type is not picking it up. Does anyone here know why?
Show all code plz
private void OnButtonPressed(object? sender, ButtonPressedEventArgs e)
{
if (!Context.IsWorldReady)
return;
this.Monitor.Log($"{Game1.player.Name} pressed {e.Button}.", LogLevel.Debug);
var menuType = Game1.activeClickableMenu;
if (menuType != null)
{
Type type = menuType.GetType();
this.Monitor.Log($"Current Active Menu: {type is StardewValley.Menus.BobberBar}", LogLevel.Debug);
if (type is StardewValley.Menus.BobberBar)
{
this.Monitor.Log("Fishing", LogLevel.Debug);
}
}
// this.Monitor.Log($"Current Active Menu: {Game1.activeClickableMenu.GetType()}", LogLevel.Debug);
}
you want to use is on the object instance itself, not on its type
if (Game1.activeClickableMenu is StardewValley.Menus.BobberBar)
does anyone know a way for me to patch export (or otherwise dump out) the texture part of a SpriteFont? in this case (see above screenshot) i am working with Fonts/SpriteFont1, but when i export it i only get the .json and it is the .png i am more interested in at this time
if (Game1.activeClickableMenu is StardewValley.Menus.BobberBar bobberBar) to also cast the object to a properly typed variable so you can do stuff on it
thank you for the tip!
Texture2D.toPng or smth
Although it's interesting
Is that one assetname with two parts or smth that's fun
i'm fairly sure the xnb for a spritefont has the texture atlas baked in, so yes i think so
xnbhack i think knows enough about it to dump the png along with the json
can you just tell content patcher to use Texture2D as the type for the patch export
can you? i did not know about this
you can also specify exact types like patch export assetname Full.Type.Name.Texture2D or whatever
huh. TIL
Yeah. Images and maps get a little shorthand though
just image ius better tho
anyway, no, spritefont does not work with type image
[21:35:50 ERROR Content Patcher] Couldn't load asset 'Fonts/SpriteFont1' using a likely type (tried: Microsoft.Xna.Framework.Graphics.Texture2D). Try either specifying the type, or waiting until the game loads it before exporting it. See the SMAPI log for details.
[21:35:50 TRACE Content Patcher] Failed to load using type 'Microsoft.Xna.Framework.Graphics.Texture2D': System.InvalidCastException: Unable to cast object of type 'Microsoft.Xna.Framework.Graphics.SpriteFont' to type 'Microsoft.Xna.Framework.Graphics.Texture2D'.```
Roll your own i guess
Can cp even editimage sprite fonts i have no clue
i don't think so, but also the three main ones are loaded into the game before CP is even online, so no
Anyone with know how understand why the position of the bobber is calculated as this?
this.bobberBarPos = 568 - this.bobberBarHeight;
why 568?
Magic.
:|
because stardew ui uses a lot of exact pixel coordinates
hmm
568 was also possibly a const that got inlined
It do be like that unfortunately
thanks
Do you have specific need here?
yeah, public const int bobberBarTrackHeight = 568
Im seeing if there is a way to check if a fish is in the bobber bar
I did ask Pathos for EditMusic 
Oh like if a fish is inside the actual detection bar?
yes
im checking bobber pos and unreelsound
to see if i can find it
Maybe u can look at fish bot
!decompile
If you want to make SMAPI mods with C#, one important resource is decompiling the game to read the game code. Here's how to do it: https://stardewvalleywiki.com/Modding:Modder_Guide/Get_Started#How_do_I_decompile_the_game_code.3F
Would look at bobberbar.update
yea i was kinda hoping not to lol 😂
This is a fairly recent fishing bot mod
damn
this looks like what Im thinking of doing
creating a model that would learn how to fish
!twocakes
If you discover that someone has made or is making a mod with a similar concept to yours, don't stress! Our community promotes the idea of "two cakes", where two versions of the same idea can peacefully co-exist. Your mod will have your own unique stamp on it that makes it special.
Although if u meant model as in ai agent, I'd say that's way overkill for a one input minigame lol
Might be
Fishbot is just heuristics afaik
Like "given my perfect knowledge of where things be at on the bar, should I click this frame?"
for now my focus is trying to see how i can get data from the fishing itself and put it in a model that will give a list of inputs
to try and "catch"
and then later see if i can expand it
hey it was something simple: i am a dunce and forgot to clear the texture to transparent before drawing to it.
revoke my modding license please /j
wait was i supposed to apply for a license
quick junimos remove the cheeto dust /lh
I mean the purpose of this mod is to see if i can do RL on the thing
yea sure, fishbot is MIT so it's ok to use code there with due credit
since the part u want is "get perfect knowledge of where things be at on the bar"
or at least relative knowledge
bobberInBar is the variable
seconding reading the update function, it's a bit long but every bit of info you want is set in there
if you install a mod midsave you still get all the skill level recipes unlocked for that mod, right? I feel like I'm imagining that there was a problem there
yes
guys lets make add skill level hotkey mod
that's in CJB Cheats
like press it in ur keyboard and like spam it
You have already been offered resources for this. At this point it looks like you just want someone else to make it for you.
!startmodding follow the link and read the tutorial
Making mods can be broadly divided into two categories:
- Content packs are formatted text files, and don't need any programming knowledge. They can add/edit NPCs, maps, new items, shops, and more. To get started, see the list of framework mods, the wiki tutorial for Content Patcher, and there might be relevant guides on the tutorial wiki.
- C# mods use programming code to change fundamental game mechanics. See getting started with C# modding.
Usually it’s easier to start with making content packs, since you don't need to learn programming.
"getting started with C# modding"
ok
So energy tonic only restores energy. How does it... do that? because I looked at it and I dunno, it just has edibility like anything else
hardcoded
of course
though spacecore allows you to unhardcode it (EatenHealthRestoredOverride/EatenStaminaRestoredOverride)
okay i fixed one error to get another this time it should be easy to fix
is this correct cs string currentUser = Environment.UserName; string[] files = Directory.GetFiles($@"C:\Users\{currentUser}\StardewValleyPyMods\*.py");
the error says its incorrect but the directory exists
i figured it out chatgpt fixed my error and yes
its not programming for me its just fixing errors
i mean do you know what you actually want to make 
is there a point to "fixing errors"
well you will probably learn better by not taking chatgpt hallucinations 
We have seen far more ChatGPT gibberish than useable code from folks who have come in after letting ChatGPT write or edit their code, so it is definitely ill-advised.
once had to argue with someone who insisted a program had an entire function that it did not because ChatGPT told them it did
ctrl shift f crying in the corner
okay i try scope.setVariable("ctx", Context); but it errors then i try passing typeof(Context) but the issue with that is i dont have access to IsWorldReady
where in StardewValley is Context
I think we can help you much better if you actually had a concrete feature in mind
(and werent using Python, something no one here does for stardew modding)
To answer this immediate question Context is a static class provided by SMAPI
I have no idea how you'd access any of this in
so uh ask when sinz's around i guess
It's really not that hard to learn a second programming language if you already know the first
https://smapi.io/json/content-patcher/9ea84d9def944972930befd8dab401f8 back to trying to get characters to spawn at my festival--i added the event command loadActors Set-Up, then after getting an error, added an empty layer called Set-Up to my map, but still no NPCs. i tried changing the key set-up to be capitalized, but that throws an error too. anyone got an idea what's wrong? if i can't get this to work then i'll try adding NPC tiles on the map file even though it's not recommended on the wiki
the way RSV does it is by performing text operations on their own event, similar to how you might add NPCs to a vanilla festival. i guess i could try that too, before trying the map tile thing
yeah, this worked for some reason?? i don't know why text operations would work when straight up defining it in my file didn't, but maybe i can make a note of that on the wiki or something
the games functionality is never going to rely on something being edited specifically with content patcher like that, so if doing so changed it, then something else was resulting in the error
patch exporting both methods might help understanding what went wrong?
https://smapi.io/json/none/79c2efb129f84e6eb7f7518e398917d9 the patch i added is at the bottom; the only difference i can see is that i used a dynamic token FestivalYear to cover y1 and y2
new patch export: https://smapi.io/json/none/4c669426f5924bcf962c0c5cae6d94c3
original patch export: https://smapi.io/json/none/28be56f24fe84d50a778d4afe13600d6
the new one does not have the _y1
which i'm confused about, because i thought it was recommended to use y1
vanilla does it by omitting the year variant and then adding a separate one for y2
so set-up + set-up_additionalCharacters and set-up_y2 + set-up_additionalCharacters_y2
Hi!! I'm super new to modding and I'm trying to edit a greenhouse mod so that I'm able to place wall furniture. What I've gathered is that I have to change the location type to decoratable. Is that possible? Is it super complicated?
interesting, okay
i dont know much about festivals
i got it working
I can't say off the top of my head whether that will be enough to place wall furniture or doing that will stop the greenhouse working properly, but changing the location type is pretty easy. You need an EditData patch with a Target of Data/Buildings and you should be able to use Fields to change just the value of the BuildingType field. You can use the example for editing the MossSoup description and just change the Target, the key (from MossSoup to Greenhouse), and the field (from Description to BuildingType). EDIT: This should be Type in Data/Locations, not BuildingType in Data/Buildings
I want to patch Item._PopulateContextTags but I'd like it to postfix any override rather than only the base method. For example, Object._PopulateContextTags calls base._PopulateContextTags on its first line, so I'm pretty sure a postfix on Item._PopulateContextTags would only run right after this call, and not at the end of Object._PopulateContextTags, is this correct?
I guess the workaround would be to patch all overrides, and for each one check if the __instance argument matches the type that the postfix is patching.
oh, well it seems that only Item and Object have this method anyway
Thanks so much, this helps a lot 
you should maybe look at the shed map files as well, if i remember correctly I saw they have specific tiledata along walls
so that may be related to designating stuff as walls
cus otherwise the game doesnt know whats a wall and whats some normal block
Yeah i saw that, gotta add WallIDs to the top row. I'm now trying to figure out how to change individual tile properties
thanks for your help!!
i'm not sure if i'd recommend changing the Greenhouse BuildingType to anything other than GreenhouseBuilding or something extending that type
oh the interior, rather
Dangit I gave them the wrong advice
if you want to make a building interior location decoratable you wouldn't change the BuildingType, since that's the 'exterior' of sorts you buy from Robin
the Greenhouse interior location type is set from Data/Locations in the CreateOnLoad group, which is conveniently null and entirely non-unique
So should Enni be editing Data/Buildings IndoorMapType, Data/Locations Type, or something else?
typically you wouldn't change a building's interior location type from Data/Locations, instead using IndoorMapType from the Data/Buildings entry, but the Greenhouse only ever uses a single instance
since it has a Data/Locations entry with a CreateOnLoad field, it (probably) won't use the IndoorMapType field and instead use the CreateOnLoad Type field
If I am following blueberry correctly, I pointed you to the wrong thing to edit, sorry. It looks like you'll need to Target Data/Locations and edit the Type field inside the CreateOnLoad field.
hmmm... I have an issue with generating context tags from context tags on items: I postfixed Item._GenerateContextTags, but this is only called if they are marked as "dirty" or if the item instance has _contextTags == null, so I think I would have to mark dirty any item spawned from save data...

Thank you @brave fable @vernal crest I'm in way over my head but I'll try to figure it out 
This is the Buildings wiki page and if you know of any existing greenhouse mod that has decoratable walls I think it would help to look at that as well.
I might just go back to the original idea to make GSQ gift tastes...
can someone direct me on a guide or good example when splitting a smapi code into multiple files about partial classes?
except for https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/partial-classes-and-methods
Why is that example not good? I had no idea what they were and that explained it perfectly
Is luauBest a conversation topic
Likely
Is not on wiki so i was unsure
May be added by a mod
@vernal crest i have been doing some cooking and i hope the results are delicious (please do not be offended by me using the bird's name incorrectly or being careless with macrons, it's only a model /lh)
very cool
i don't think i've explained it fully, but The Plan™ is that this is a framework so people can add whatever glyphs they need for their mods to use
and/or edit or replace vanilla glyphs
It's amazing!!!
Ichor can u put 𰻝𰻝面 into sdv pls
... is that biang biang mian? (i see only boxes)
Yes
Box box mian
This is awesome
... maybe. i think chinese subs out spritefont1 so it's probably somewhat technically compatible as-is
Smh font no support for real unicode glyph
right now i'm only targeting the spritefonts (spritefont1, smallfont, tinyfont) and the dialogue fonts (font_bold, font_colored) and the language-specific ones are not supported
Chinese is funny it has 2 fonts
The page has a png render
I don't think stardew has enough pixels to do that
(the language-specific fonts are a third cursed thing to have to support, so that's cool!)
But yes ur font lacks this glyph and that's why ichor's work is Important and Monumental
Yes plz fix discord
even properly rendered, it's basically a solid box
can't read that
I'd very much beg to differ on that one /silly
it's almost solid for me lol
damn, you got a really good resolution chu
Phone perhaps
I’ve been working on my retexturing skills while I’ve been on hiatus
hellooo is there a way to make VS code stop getting angry over comments?
The json parser stardew uses has support for comments, it's just a nonstandard feature
got it, alr
should I change the files back after or will it be fine?
It will be fine
tysm :))
Eee
Don't change your file names to .jsonc, that will not work in game. Set an association for .json to .jsonc in VSC settings instead.
I’m retexturing jojo items
oh? uhh how might I do that?
In Visual Studio Code, go to File -> Preferences -> Settings, then search for "associations", and in the "Associations" setting, click the Add Item button to add an item with key *.json and value jsonc (see image).
If you are making a content pack for Content Patcher, you should consider using its json schema so that VSCode can tell you if your patches are valid, you simply have to add
"$schema": "https://smapi.io/schemas/content-patcher.json"
at the start of your content.json file.
The $schema itself has ignore comment rules
I've tried using the schema but it's such a hassle adding it every time
So now some of my files have it and some don't
tysm! i'll do the schema thing, I don't have many files anyways
oh also, if I do wanna add mpre files in the future, is there a particular format i should do that in?
like a specific name I should apply before putting it in assets
or should specific files be put somewhre else?
Do you mean for your mod folder structure?
I’m making lace 💔💔
oof good luck
You can do whatever you want as long as it's not outside the folder that your content.json and manifest.json are in (sub folders like assets do not count as outside)
I don't put .json files into my assets folder, I put them in a data folder
How does one do the corner..
gotcha, so assets would generally be for pngs and such?
You don't technically need subfolders at all, though I don't recommend doing without them for any but the most basic mods
yeah, i just have too much code-
Argh the lace..
For me, yes.
hmm try doing like a checkerboard thing? theres also a specific mod art channel too
O thank you
alr, tysm aba 
No worries. If you want more ideas for folder setup it can be helpful to go looking through others' mods too but there's not a huge amount of variation
alr!!
what's up with all the blank.jsons?
you need to create the file
Know what
so easiest to fill it with an empty json
yup, just wondering why lol
I... would like some help with a mod changing only krobus' room... I have basically no programming knowledge and I don't know what to do now after making the art
I don't know where to go from here
Omg okay I deleted some code and it worked
So an asset in content is like sandwich
First u gotta Load the bread
Then various mods can EditData to add tomato cheese etc
mmmm sandwich
hmmm I wonder if machine augmentors just needs a recompile for the shop data changes
HELL YEAH my optimizations worked
for 12k furniture, processing went from ~12,000 ms to 40 ms
of course there's still the shop data bottleneck, but I have Plans for that too
what I did was pre-build an index for AT so that it wasn't doing horrible n^2 linq things
hellooo uh are there any specific schema things for i18ns to allow comments?
how many-
this is ony my main playthrough save, which is what I actually play on and also what I use for stress-testing mods
// should work for comments
at least that is what the schema says
i'm impressed- that's literally me with the sims lol, I had ~160gb of mods that I merged into ~100GB
oh it does, but VS gets angry lol
oh?
that's a differnt one one sec
it works tysmmm 
I love how in-depth you're going with your frog mod btw!
oh god I need to refactor all my linq things in my mod, I forgot to add that to my todo list 
I did some behemoth linq chains
does anyone know where the pasta primavera is... did we lose it...
is it a special food... im
if I want to make dialogue randomly show up under certain conditions using trigger actions to add conversation topics together with synced random doesnt work,
so would just appending my dialogue to generic dialogue when: certain condiions are met and update onlocation/ondaystart (to check again if the conditions are met) be the correct approach?
somewhat considering doing everything except optimisation, uploading to github and seeing if I can get you and sinz’s eyes to twitch enough that you end up doing it for me /j
something I've discovered recently in VS that's very helpful is the cpu flame graph
see? you’re perfect for the job
i'm a bit worried about the crunch time in my wip font mod but 1. there's probably still some savings to find and 2. spritefonts are pretty hostile to editing so i'm just glad it works at all /lh
haha I feel like mainly I (on the coding-side) I have just a messy job that is like 40% actual code and 60% fixes for the code
because I dont understand many things and I want to optimize it and to understand smapi/content patcher better!
I have a weird habit of always using arrays for my collections of items. I have a feeling it’s not the way to go though
what do you guys usually use? (for general array or list like structures obviously)
also I am procrastinating on something I have procrastinated way too long on and should be really working on but it is scaring me
I feel like List<T>s might be smarter than T[]s in most cases but who knows
literally what I'm doing rn-
for me my coding's 20% code, 70% vaguely code-shaped slop, and and 10% notes-
I am very happy I meet you so frequently, claude!
IK we're in the same boat haha
arrays must have a fixed size, and "resizing" an array is actually making a new one and copying the elements over, and most of my use cases involve dynamically building lists
I use arrays if I have a list of compile time constants
yeah, I know that part and then end up just using linq to get around it which… is on me 
most often a list or something else that inherits from IList, mostly for what Selph says
though usually if I have a list I still try and figure out if I can make it a dictionary instead if it gets too long or might be iterated a lot
I always resist the urge to make things IEnumerable<T> just to make it consistent with linq lmao
I do use hashsets and dicts whenever possible tbf
I dont use hashsets that often, mostly just for presence lookups
lists and dictionaries are more common for me, or IEnumerables if I need lazy execution or some kind of complex value generation/processing logic
how can i turn the stairs dark?
I try to use interfaces for whatever functionality I am actually using to make sure it's easy to change later, but I'm not as good about that as I should be :P
that looks like just lighting tbh
i think the only time I ever use just IEnumerable is when writing a transpiler
the whole house is dark, and then, the stairs T-T
i am using daisyniko earthy interiors and elegant interiors
I use it for the core flower logic in better beehouses
also, does anyone knows how to change the animation?
New quote added by atravita as #6680 (https://discordapp.com/channels/137344473976799233/156109690059751424/1426269036416733344)
It Depends
the stairs are handled by the interior recolor you use. elegant interiors has light colored stairs
If you want the real answer i usually will use spans when I can
oooh ok
thank you
open fridge is cursors2 btw
If not, the list vs array difference usually falls to whether or not active resizing is needed
thank u
the mod you're using for the kitchen is missing those tiles, so youll have to draw them yourself
Dotnet arrays suffer from a old Java inspired decision that gives spans an advantage
And I like how i can past both list and array content to spans lol
can you tell me where the stairs are?
above the golden statue next to the periodic table
Any Linux folks on-line? I'm stumped about how to get a debugger going. When I launch from Rider, I never see any signs of life from Stardew Valley. When I try attaching, it seems like the debugger isn't attaching. (No breakpoints work, the debug windows all say things like 'Waiting for target to get ready') Is there a FAQ somewhere?
is there a way to conditionally add an event command for if a user has a mod installed, without writing two separate patches, one with a When: HasMod? i can do two separate ones it's just annoying
There is a fun way but also like, which command are you thinking of?
(The quick explainer of the dumb way is you can do -- to comment out a command but tbh I think you're better served by looking into whether or not the game has conditionally for the command you want)
action in combination with a MMAP action
it's not necessary for the event, just adds butterflies. but i feel bad making people install a whole framework because i decided to play with critters lol
a dynamic token could probably do it? e.g. your_event/etc/etc/{{DynamicThing}}etc/etc
-> DynamicThing equals ModCommand/ if hasmod, or / if not
Oh, I was just gonna suggest a dynamic token that was empty if mmap was installed
ah smart!
not 100% sure how to do the slashes correctly with event syntax, but yeah
And -- (the event command comment syntax) if not
excellent
does commenting out an event command completely prevent it from being parsed, or just from being run?
I don't think it's parser at all
probably never sees it, at a glance here
protected void CheckForNextCommand(GameLocation location, GameTime time)
{
string[] args = ArgUtility.SplitBySpaceQuoteAware(this.eventCommands[Math.Min(this.eventCommands.Length - 1, this.CurrentCommand)]);
bool num = ArgUtility.Get(args, 0)?.StartsWith("--") ?? false;
is that called from within Event.ParseCommands()?
Because that gets called when an event is created to check the script
ig not, it looks like that's in Update which is called elsewhere
I'm not at my computer to check how the -- is handled during parsing
Neither am i
what if i defined it as / when no MMAP, and /action ActionString/ when MMAP?
and not putting the slashes in my event
But I don't recall seeing it when I was looking at the code the other day
I may have missed it though
just woke up and slowly reading through the 16 calls to ParseCommands, idk the flow of these in practice
But i thought it would skip past marking it as an action anyways
You could. Either works
I'm advocating for the -- because it keeps things together tbh
My assumption would've been it still checked if it had a command handler first
at any rate yeah, using a token to just have it do nothing if HasMod's false should be fine
(it may need / for one and action ActionString/ for the other to avoid a // situation)
I mostly assume that because why does the comment syntax exist otherwise
When would you want to comment a command instead of just removing it
Nah, that's for CA to do rapid development i think
(in vanilla)
i know that event commands can take ? for NPCs that the game isn't sure exists, but does that also apply to festival setup?
if you mean the "set-up" key event, it seems like those work, the game uses Kent? in set-up_y2 for the egg festival
and they seem like they share all the same parsing/command stuff
cool! it's not a game-breaking error when it tries to add them, but i know i would get bug reports about red in the log anyway so trying to minimize that
festivals are just sparkling events
aww man. "no NPC found with the name 'Kent?'"
let me see if i can add them another way maybe
yeah vanilla seems to only add actors through the map layer, but oddly enough only kent seems to have ? with his commands and leo doesn't. i wonder if it's hardcoded somehow
i guess i'll write more patches to append them in conditionally
Leo has hardcoded exceptions yes
loadActors simply will not load any NPC whose name is Leo unless the host has the leoMoved mail flag
it's odd that his advancedMove doesn't throw an error with him missing then
advancedMove just tries to grab the actor and if it cant find the actor it just does nothing
ah i see
relatedly, is there no migration guide for 1.6.15? i think festival shops may have changed since the festival wiki page was updated, but i can't find any info in 1.6 or 1.6.9
there is a section in the 1.6.9 page for 1.6.15, but between 1.6.9 and 1.6.15 is 95% just bug fixes
nothing about festivals changed
okay
maybe it was an even earlier change? idk
the wiki said festivals have a “shop” field but in the unpacked data it looks like they’re just extra entries in Data/Shops combined with a map tile action to open it like normal
you can do either or
Hm. Sunberry has a lot of tiems that are marked colelctable but not donatable
if you mean for the museum, you dont mark something as collectable. it just automatically goes on the collections tab regardless of donatability if its the right category, which is separate from museum eligiblity (and changed in 1.6.16 so that they wont show up at all in the collections tab if they arent donatable)
Love how most of my mod making time is troubleshooting code 💔
However I got the mod to work so I’ll prob release it tmrrw alongside a few smaller retexture mods
time spent not researching and planning for edge cases and conflicts is time you intend to spend troubleshooting 🙂↕️
i intend to spend a lot of time troubleshooting.
New quote added by atravita as #6682 (https://discordapp.com/channels/137344473976799233/156109690059751424/1426377343210885261)
does the track LavaMine randomly play one of x many soundtracks? i'm using soundboard but just noticed that it plays different songs
It does
https://docs.google.com/spreadsheets/d/1CpDrw23peQiq-C7F2FjYOMePaYe0Rc9BwQsj3h6sjyo/edit?gid=1007418291#gid=1007418291 According to this list, it cycles through songs
wow i literally never noticed! thank god i never used it for an event lol
time to find out which lava track i want
if you liked one of the tracks specifically you could probably re-use it for your own cue in Data/AudioChanges to guarantee you get the one you want
i dont think theres another way otherwise to ensure a specific track from an audio cue's list of possible tracks gets played
i think all 4(?) exist under other names as well
oh, even better then
👆
It's a relic from pre-1.6 when shops were all hardcoded.
is it in general recommended to use the 1.6 method of a custom shop + tile action for a custom festival shop, then?
yeah probably
just remember to change the currency on the shop
if you want to use festival currency anyway
which i dont remember/think you can even do with a custom festival? iunno
i think you should be able to, like how the fair switches to star tokens
although personally i'll just be sticking to good ol' G
lol i was gonna say, i feel like i've seen that somewhere
u could give player just items
hello pierre i would like to pay for this rarecrow in futan bears. how many does it cost
ah yes the classic reverse carnival game where you exchange cuddly prizes for money and tokens
(Friendly suggestion to give Pierre's shop his portrait and a line if you haven't already.)
already did! he wonders if the ghosts would be interested in his produce and also suggests the farmer buy saplings and plant a tree in remembrance
i do think i have to mark up his prices 4x though. imagine buying a sapling for 1000—sacrilege
Is there any way to make a trigger action that waits a specified number of days? Id like to have an event, which triggers mail to arrive, but id like the mail to arrive a few days after the event
That sounds like a job for conversation topics probably
You'll have to ask someone who actually does npc stuff how to use them though, I have no idea
i thought about that, but i think that would have to revolve around the convo topic expiring, and idk if that is possible
set a CT while in the event with an expiration date of however many days you want. then in the condition for the trigger action, make the condition when the CT is NOT active
it's not only possible, that's exactly how to do it!
how does it work?
are you familiar with trigger actions?
yes
are you asking for a different explanation than this, or are you asking about how the guts of the code that does it look?
You can use a stat (IncrementStat) if you want
It'd be a direct counter and you can control length
Needs more work tho
no worries, good luck
if you go the CT route then you must also make the condition rely on having seen the event, too, not just not having the CT, ofc
dont forget that part
yep, otherwise it would just trigger immediately
Makes sense. Where are convo-topics stored? Ive never added one with CP before
the same place mail flags are, on the farmer. which is to say, nowhere you really need to care about
They don't have content per se, they're more like timed flags
you just make them with the trigger action
IIRC the only way they affect dialogue is via preconditions
event preconditions? wdym
Oh right those are only for events
I forgot how dialogue keys work bc I never use them
Anyways. My point is that it's not like mail where you have data stored in an asset somewhere, it's just an internal game state flag
what's the best way to check for kent? does he have a specific flag, or is it like any time after spring 1 year 2, or something?
without a mod providing a custom token for it you'll never be able to perfectly account for any mods that might change his availability
but his default unlock condition is literally just "YEAR 2"
he uses the UnlockConditions of the NPc data
year 2 is good enough for me then
unless there's a way to check that his unlock conditions have been met, but i don't really care too much about that
@gaunt orbit: look into ammortization/chunking to reduce startup lag for hhd (2d ago)
you could actually probably check if the player has friendship with him at all
if you're checking in a spot that allows GSQs
this does still assume that if a mod changes his unlockcondition they still keep his intro event though
it's a When condition but i think you can convert any GSQ into a when?
no
never mind then lol
Esca's Modding Plugins allows using GSQs as Whens
you can use GSQs as trigger action conditions to set mail flags that can be used in Whens
but you cant use a GSQ in a When directly
i see
you may be thinking of the other way around, where you can use tokens in a GSQ if they resolve to true/false
oh that might be it yeah
would When Year 2 return false if it's year 3?
this sounds like a dumb question lol but i was wondering if year 2 just meant not year 1
like "When": { "Year": "2"? yeah thatd be false in any year past year 2
you can do that yup
excellent
thanks
(C#) how much do i need to reinvent the wheel if i want to evaluate the object a player is holding, remove one instance of that object from their inventory, then add a CT based on that item? i was looking at the list of events to see where i need to enter, and i didn't see anything that reminded me of things like tile actions. i assume i don't need to recreate tile actions, but in that case, where do i enter? is it on button pressed?
you probably dont want to use SMAPI events for this
oh okay
this is for a thing like the soup pot, right?
i would register my own tile action via GameLocation.RegisterTileAction()
awesome, i'll look at that
you'll need to provide it a function with the signature bool yourfunctionhere(GameLocation location, string[] args, Farmer player, Point tile)
but inside that function you can do whatever you want
is that something that's required by all tile actions?
yes
so in this case my entrance would be something like on save loaded, right? on save loaded, register my tile action, and then the game handles the timing of when i put carrot in soup?
or am i misunderstanding ModEntry
you can register it whenever
theres no reason not to register it in your Entry function
when a player right clicks a tile with an action tiledata on a map, the game will look to see if there is a registered tile action with the same name
if it exists it'll give that information to the function that was registered with that name
ModEntry gets called by SMAPI when mods are loaded, right? so if i registered it in ModEntry my tile action would exist in... the content pipeline? somewhere?
okay so it always exists but only gets checked when acted on
ModEntry gets constructed when SMAPI loads your assembly. Entry() gets called when SMAPI does its mod stuff in order
GameLocation, the class, already exists
its not in the content pipeline
its just a C# class that exists and it has a static function you can access
okay i think i get it. i'm not really storing the tile action data anywhere, just building a road to it for the game to travel down when it needs?
you're telling the game what function to use when someone adds in a TileData with an Action that matches the name you linked to that function
e.g. Action OpenShop Whatever blabla, thats an Action whose identifier is OpenShop so it would look to see if someone called GameLocation.RegisterTileAction("OpenShop", blabla)
and then it would use whatever function was assigned to that identifier
(thats not actually how it works for vanilla actions, but its analogous, so whatever)
that's okay lol
calling back to our conversation a few days ago, and looking at this, my function should, in addition to doing the things i need it to, return true if successful, because it's a bool?
so i could return false if farmer is holding a non-object
or is that not the intended use
i think that probably is up to personal style
i'm losing my mind. is this not 4 pairs of brackets? you can see i've gotten nowhere with this
you're defining a method inside of another method, which isn't allowed
if it was a mistake, just move the DidTileAction method outside of the Entry method, within your ModEntry class
if you wanted to create a local function instead, remove the private static keywords from the function declaration
ohhh yeah i did add private static after, so that's why it went nuts
i don't know which one i want tbh
if you don't know what a local function is, it's effectively the same as having a lambda or func/action, but with an identifier
just a reusable block of code that's only accessible from within the enclosing method or function (possibly unlike lambdas/funcs/actions which can be passed around, though i've never tried passing/returning a local function)
how about you write out what you intend to do with it 
i'm trying to register a tile action which 1) evaluates the item the farmer is holding 2) fails if the farmer is holding a non-object 3) removes one instance of held object from inventory 4) evaluates said held object and sets a CT
i'm trying really hard to be independent but i can't even find in the decompile how to get the held object 
i saw ActiveObject but got a ton of errors when i tried to use it
i'm sure i wasn't using it correctly
ah ofc heldObject is for objects, players use activeobject
runtime errors (from game/smapi) or compile errors (from your ide)?
my IDE
i've tried Game1.player.ActiveObject, player.ActiveObject, uhhh i think something else
can we see what your code was and what the errors were?
are screenshots or copy/paste better for C# code
screenshots are fine in this case
generally uploading to github is what I recommend tbh but this is a very short snippet
ah, no it's a programming concept
when you're comparing two things you need to use two equal signs, ==
oh my god i feel stupid
one equal sign is for assignment
i am lost in the SAUCE
no don't! this is how you learn things
i should've known that though
but for comparing to null in c# you can also do "is null" instead of "== null"
psychically, or because you learned it once a while back and your memory is supposed to be perfect? 
stop being nice or i'll cry on you
as ever you've a few options for registering tile actions, here's an example of a few different ways
public static void RegisterTileActions()
{
bool doSomething(GameLocation location, string[] args, Farmer player, Point tile)
{
return player.ActiveObject is Wallpaper wp && wp.Edibility > 0;
}
GameLocation.RegisterTileAction("Func_TileAction", (location, args, player, tile) => doSomething(location, args, player, tile));
GameLocation.RegisterTileAction("LocalFunction_TileAction", doSomething);
GameLocation.RegisterTileAction("Method_TileAction", DoEverything);
}
private static bool DoEverything(GameLocation location, string[] args, Farmer player, Point tile)
{
return player.ActiveObject is Furniture f && f.IsFruitTreeSapling();
}
is that 3 ways?
Func uses a lambda pointing to a local function, LocalFunction uses the local function by its identifier, and Method uses a declared method on the enclosing class
yep, 3 ways 
you can also use ActiveObject is null and is not null if you prefer
without Game1.player?
no, you still need that, just pointing out the is and is not pattern
oh gotcha
if you were writing this from within Farmer then you could omit Game1.player provided you were certain that your code only affected the current player
but that's neither here nor there
you aren't in Farmer and you won't ever be ☀️
you may have noticed that I didn't tell you what is does mean when you asked if it's equivalent to ==. that's because uhhhhh 
(I'm kind of joking, is is usually used to compare types and for pattern matching. null is generally its own type so you can always do is null)
i feel like learning what is is is step one million of me learning this stuff lol
is is is is is...
programming is a skill, which means it's a combination of constantly learning various things like that and then practicing them until you remember a fraction of what you learned
there's also a secret fourth way i've taken a liking to```cs
public static class TileActions
{
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)]
private sealed class TileActionAttribute(string id) : Attribute
{
public readonly string Id = id;
}
public static void RegisterAll(string prefix)
{
foreach (var method in typeof(TileActions).GetMethods(BindingFlags.NonPublic | BindingFlags.Static))
{
if (method.GetCustomAttribute<TileActionAttribute>() is TileActionAttribute tileAction)
GameLocation.RegisterTileAction(key: $"{prefix}_{tileAction.Id}", action: method.CreateDelegate<Func<GameLocation, string[], Farmer, Point, bool>>());
}
}
[TileActionAttribute("Shop")]
private static bool Action_Shop(GameLocation location, string[] args, Farmer who, Point tile)
{
if (location is not null && location.getCharacterFromName("Shopkeeper"))
{
var dialogue = npc.TryGetDialogue("shop");
npc.setNewDialogue(dialogue, add: true, clearOnMovement: true);
Game1.drawDialogue(npc);
return true;
}
return false;
}
}
do you use a shared project blueberry
no, they make me ill
oh hey attributetargets is what keeps popping up when i try to get
me when I try to compile atrashared (atra is aware of my burning hatred for atrashared, dw)
at least it's possible to compile spacecore with less than 40 projects loaded 🌥️
even if i have to clone them all ☁️
handling remove-one-from-item-stack is a bit of a trick, but your task should be as simple as ```cs
// player is holding an Object or something that extends Object
if (Game1.player.ActiveObject is not null)
{
// handle your CT and such here while the object still exists (non-null)
// . . .
// reduce stack, removing object if fully consumed
Game1.player.ActiveObject = Game1.player.ActiveObject.ConsumeStack(1);
// rousing success
return true;
}
// deep shame
return false;
i was just about to try to translate that into english to see if i understood
how does an if statement perform an action?
I'm going to have to start using // deep shame myself
you mean the ConsumeStack bit?
the if-statement does nothing special, it's simply calling ConsumeStack per the () method invocation parentheses here we fill with our parameters, and then evaluating the result with the conditions provided
what if the player had 300 blueberries though? how would it be decreased to 299 blueberries
hi sorry for asking this, any recommended robin marriage mod for 1.6
without the parentheses, if (Game1.player.ActiveObject.ConsumeStack is null) wouldn't be legal C#, but if we were in typescript or something it would check whether that method exists on the object instance
ConsumeStack(int count) reduces the stack size by the given count, so 300 would indeed turn to 299
it would also give back the item with the updated stack size as the return value if the stack was greater than 0 or the item simply can't be stacked more than 1 anyway, in which case it would return null, per the documentation on that method on-hover
so an if statement condition can be anything that "evaluates to a boolean (true/false)". That's kind of a tricky concept itself, but it includes any comparison operators (==, !=, is, etc) and any methods that return bool.
Comparison operators can compare anything that has a value, so if a method returns something (so it isn't a void) you can call it inside a comparison
hi, #modded-stardew will give you recommendations (or a bot command with a list of recommendations) ☀️ we just make mods
you should ask in #modded-stardew but they can only give you sfw answers
dammit blueberry 
i think i'm just used to incredibly non-concise programming. like it's not intuitive to me to call methods in anything but their own line of code
there's value in doing it that way sometimes (as long as you store it in a variable) but c# has lots of fun ways to avoid needing to do that
a fair few of them involve the is keyword
our good friend
how come we have to set ActiveObject to null if ConsumeStack already took it away
i \❤️ is
ConsumeStack simply returned null, it can't somehow nullify the object itself
I assume it returns null if there's nothing left?
we need to tell whatever Inventory instance still holds a reference to that object to replace it with null instead
or in this case, Farmer.ActiveObject
so then did ConsumeStack already tell the inventory instance to decrease the display number from 300 to 299 by being called?
it simply returns null to tell us that yep, the item was consumed, there's nothing left, no matter what the Stack value may be, given that some items don't necessarily have a stack
we could be a little more concise by using Game1.player.ActiveObject = Game1.player.ActiveObject.ConsumeStack(1);
which would assign the same object instance if it wasn't fully consumed, or null if it was, correctly clearing the reference
so much for non-concise programming 
only in the sense of like i = i+1
i++ is about as concise as i ever got
three characters is very concise
i hope anyone who decompiles my mods goes "now what in the hell is going on"
as long as the intent is clear and the maintenance is easy you can format it however you prefer
my goal rn is "i understand what i'm doing"
preferably also make it run well, but that's harder to mess up than the other two
does c# do ++i? I never remember which languages support that
sure, c# does pre-increment and post-increment/decrement/excrement just fine
-# looking at you, python programmers
wilts
-# not all one liners are good actually
[json minifiers wilting]
including with a mix of tabs and spaces for precise indentation?
i cannot see the difference. they are invisible. i do not care 😌
unless someone submits a merge request with 1500 lines of whitespace changes around 15 individual lines of actual changes, including my entire modentry class
then i care a little bit
-# 
who and when
noted. i will keep mine below 1500
you speak from experience?
i do not name. i only shame. and merge 💖
cant help but notice you didnt say you review first
what's a review
noted.
i shall leave the CT stuff and figuring out what to do with my function in mod entry for another day. good night and thank you
I wanted an easy place to reference this stuff for making mods, and thought it could also help other people. also because cross mod stuff is always neat
https://github.com/Pet-Slime/Stardew-Valley-using-Spacecore-skills-in-content-patcher-guide/blob/main/README.md
I need to go through and add sword and sorcery skills still
Hi,
I'm trying to make a button that opens my mod's settings in gmcm, and I'm getting it.
But when I open it, the mod list menu is stuck, and there's no way to exit.
Any advice on how to do this without this happening?
Thanks
There is a bug currently with GMCM
I think you can enter debug tailor in the smapi console to close it
!gmcmsoftlock
GMCM currently has an issue in which it “soft locks” the game by preventing you from closing its menu. If this happened to you, go back to your SMAPI console, type debug tailor and press enter. This should free you without having to reset your day.
Ohh thanks, that is helpful
I thought it was my problem because I saw that mods like Better Crafting could do it without getting stuck.
Thank you so much for your quick response.
Oh, am I not supposed to code golf
string rawItem = File.ReadAllText(Path.Combine(SDVFilePath, "ExtractedData", "Objects.json"));
string rawCraft = File.ReadAllText(Path.Combine(SDVFilePath, "ExtractedData", "BigCraftables.json"));
string rawBoots = File.ReadAllText(Path.Combine(SDVFilePath, "ExtractedData", "Boots.json"));
string rawFloor = File.ReadAllText(Path.Combine(SDVFilePath, "ExtractedData", "Flooring.json"));
string rawFurn = File.ReadAllText(Path.Combine(SDVFilePath, "ExtractedData", "Furniture.json"));
string rawHats = File.ReadAllText(Path.Combine(SDVFilePath, "ExtractedData", "Hats.json"));
string rawMann = File.ReadAllText(Path.Combine(SDVFilePath, "ExtractedData", "Manneguins.json"));
string rawPants = File.ReadAllText(Path.Combine(SDVFilePath, "ExtractedData", "Pants.json"));
string rawShirts = File.ReadAllText(Path.Combine(SDVFilePath, "ExtractedData", "Shirts.json"));
string rawTools = File.ReadAllText(Path.Combine(SDVFilePath, "ExtractedData", "Tools.json"));
string rawTrinkets = File.ReadAllText(Path.Combine(SDVFilePath, "ExtractedData", "Trinket.json"));
string rawWall = File.ReadAllText(Path.Combine(SDVFilePath, "ExtractedData", "Wallpapers.json"));
string rawwWeap = File.ReadAllText(Path.Combine(SDVFilePath, "ExtractedData", "Weapons.json"));
var itempopulate = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawItem);
var craftpopulate = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawCraft);
var bootpopulate = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawBoots);
var floorpopulate = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawFloor);
``` is there not an easier way to do this xD
Is there a reason you're not using the content APIs and instead reading the files from the extracted files on the filesystem?
How would I go about adding i18n support to the variants created when using the Furniture Framework's "Display Name": "{{RectVariant}} item",?
because SDV isn't involved
Sorry I just realised this makes no sense without context:
I'm currently using the furniture framework mod to add some animated furniture, it provides the option to have a collection of furniture under one 'group' e.g. have two different cat statues that are different colours under the same section ("Display Name": "{{RectVariant}} Cat Statue",) but differentiate the name ( "Source Rect Offsets": {"White": {"X": 0, "Y": 0}, "Black": {"X": 0, "Y": 32}).
Here's the code:
// Sprite by SonreirAngel for Seasonal Japanese Buildings
"Display Name": "{{RectVariant}} Cat Statue",
"Description": "A statue to test Animations and Variants. Sprites by SonreirAngel",
"Rotations": 1,
"Collisions": {"Width": 1, "Height": 1},
"Placement Restriction": 2,
"Source Image": "assets/neko_statues.png",
"Source Rect": {"X": 0, "Y": 0, "Width": 16, "Height": 32}, // in pixels
"Source Rect Offsets": {
"White": {"X": 0, "Y": 0},
"Black": {"X": 0, "Y": 32}
},```
I would like to add support for i18n files but I'm unsure how I would tag the `{"White": {"X": 0, "Y": 0}, "Black": {"X": 0, "Y": 32}},` (white and black) in the i18n file. Does anyone know how I would do so?
@woeful lintel Let's get it straight from the horse's mouth
!embed
You can post images and embeds in most channels once you reach Cowpoke (level 5) on the server. You earn levels by sending messages, and will be notified by this bot when you've earned Cowpoke! You can send images in #images-and-memes at any level.
You can read more about the server channels in #welcome and roles in #roles, and check your current level with /lvl in #governors-mansion.
Currently, #stardew-spoilers and #town-square have embeds disabled for all levels.
You can embed code in Discord using a series of three ` :
```
Your code can go here
Even if not a haiku
Just an example
```
For syntax highlighting, add the language code on the same line as the first
``` (with no space, like ```json).
The usual codes are cs (C#) and json.
here you go
Then, i18n support is not released yet: it's in the 3.2.0 version, which is being tested. The good news is that you can try it to make it release faster!
Here's the build that you can download: https://github.com/Leroymilo/FurnitureFramework/releases/tag/3.2.0-test2
Oh that's great! I'm happy to test it for my mod :D thank you so much
and here's the example of how to use i18n: https://github.com/Leroymilo/FurnitureFramework/tree/3.2/doc/Templates/i18n Example
The short explanation for localized variant is that you want to make the variant token a part of the i18n key so that you can translate the variant key itself.
btw @iron stream, you should change the accolades into square brackets: [[ModID]] instead of {{ModID}} inside of FF's content files
Okay I'll change them to square brackets
btw, if you have any issue (difficulty or bug) when making Furniture Packs, you can come talk about it in https://discord.com/channels/137344473976799233/1340345659642875915, this way I won't miss your issue
made a list viewer so people can see all the stuff they have
(and yes, it accounts for modded stuff)
I'm pretty far from being a C# expert, but it feels like there could be a way to make whatever you're making depend on SV/SMAPI to be able to access the content loaders to avoid doing it "by hand"
i don't do it by hand
and SDV isn't involved
I have a mod that pulls the data for me for off the game use.. which is available for anyone and you just need to press CTRL+G to make that happen
And NPC Creator 4 will look for it automatically
the only work I put in to it was making sure all the data was sorted
so it's manually parsing content packs?
oh so it does rely on sdv
not the program
right but the data collection
it just acquire the lists I acquired from my companion mod
https://www.nexusmods.com/stardewvalley/mods/31676 i use this for all sorts of data collection
it pulls everything I need for me.. I can even acquire positions of my farmer to use in events
basically, I don't need to look up things... I have it all
that reminds me.. i need to update the githubs
fyi you can do that with debug ppp
and get a smapi output right?
that is not what I needed
i need them to create events
you can get it in the chatbox but yeah, I guess if you want it saved to a log file on its own it doesn't do that
I just find that when I'm already manually moving my farmer around it's just as easy to copy paste the coordinates ngl but we each have our processes
this is intergrated for NPC Creator 4
I am removing as much work as possible for people 😛
go to where you want to do an event.. stand in places, press CTRL+P in the areas you want people to go
btw, is there any chance you can add a comment to the top of the NPC creator 4 output content.json file saying "generated with NPC Creator 4"? just so if people need help we know where things came from
usually I have it put in the manifest.json
often people only share the content file when they ask us for help so it might be helpful to put it there too if that's possible
otherwise we spend time trying to figure out what people do or don't know and where info came from etc
sounds like a plan.. I will bake it in the content.json from now on
ty, sounds good 👍
hopefully, people won't need to ask for help DX
it's hard to figure out how to make things 100% foolproof
if you want to REALLY go the extra mile, a clickable section next to each feature with a link to the relevant main wiki docs so people can read further would be fantastic. That way, rather than only doing things for them, this can also be a learning tool
nice, sounds great!
let's see how the new coding interacts with my character data
do you think if i say caseys name enough times she'll appear
anyone see any problems with this NPC Data?
only one way to find out
try also mentioning vr
gosh i wish someone would make a vr mod for stardew valley that also supports localizedtext in context tag recipe ingredient fields
100% she'll make the best multiplayer mod for haunted chocolate
hmm. may have to shift up a gear and go to her thread
Hey you lovely people. I have a quick question. So in stardew you have the doors that only open when you have a certain heart level with the corresponding NPC. How can I apply this to my existing Custom NPCs? When I made the custom house there was a thing you could edit so that you could only enter the house with a certain heart level, but since there are 3 npcs in one place I don't want the player to have to figure out which npc unlocks the house. So I just wanted to put the doors behind heart levels. Is that doable without any C++?
for one, the language is C# not C++ but secondly, you just need to put Action Door <NPC's Internal Name> to make a door work
that isnt the same as for the front door of the house though, so like... do you want both interior doors and the front door to be locked behind npc friendship?
Okay, well I apologize for not having the right language handy. I keep forgetting what games/ mods use C++ and C# (like outside of stardew too of course)
Oh, no no. The front door should be open for everyone during a certain timeframe (Already got that working). Now I just want the interior room doors to be locked behind npc friendship
Is that doable? And if so, do I do it in Tiled or in the JSON?
Can do that in tiled. I just said how, put that in the tiledata
So like this? This is what I had before, but can I change the heart level that's required or is that hard coded?
I think you can change it by just putting how many friendship points you need, but don't quote me on that. Also are you sure that's your NPCs internal name?
The internal name is from {{ModId}}_<npc name> right?
Yes, you'll need to write out your modid though since you can't just put tokens in thetr
In the tiledata
Hi, this is my first time creating a mod. The mod is for Leah Expansion, im currently testing on the configuration, for user to choose "Overwrite - Change all dialog to new dialog", or "Enable - which the system will randomly choose from the list of dialog"
Im currently stuck at the randomizing the Introduction (when we talk to Leah for the first time), did I do it the wrong way?
Hey Guy´s, im absolutely new to making mods and im trying to make a new NPC for my Wife but i got problems with installing it and maybe someone can help me :)?
i installed the Mod manually cause nexus instalment wont work and it doesnt tells me what the problem is. So the problem is that my Game works without any error warnings with all my 120 mods, but as soon as i install my NPC i gget CP errors and nothing works anymore
Remove the duplicate content patcher


