#making-mods-general

1 messages · Page 320 of 1

lucid iron
#

!json

ocean sailBOT
#

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.

vernal crest
lucid iron
#

Use one of these programs

vernal crest
#

If it doesn't have "Code" in the name, it's not the right program.

lucid mulch
#

Purple one for c#, blue one for everything else

#

(though it's green not blue for me due to insider/beta builds)

karmic gust
ocean sailBOT
#

Log Info: SMAPI 4.1.10 with SDV 1.6.15 build 24356 on Unix 6.5.0.23, with 5 C# mods and 1 content packs.
Suggested fixes: One or more mods are out of date, consider updating them, SMAPI is out of date, consider updating it

vernal crest
#

I can't remember if it has to be the tileset name or the tilesheet name, so if one of them doesn't work try the other one.

#

Tileset names can vary by map, so you'd need to open the map file to double check what its tilesets are called.

karmic gust
#

that's what I tried first (just townInterior without maps:) and it had the same error

vernal crest
#

Okay yeah AnimalShop calls the townInterior tilesheet 1 so try "SetTilesheet": "1",

karmic gust
#

okay, thank you! so it's looking for the tileset, not tilesheet?

#

just asking for clarification on my part for the future!

vernal crest
#

If the 1 works, yes

#

I've got it both ways in my files and I can't remember which one worked and which gave me the error haha

#

But I just saw I have another instance of it that has "SetTilesheet": "indoor", and there's no tilesheet called indoor so it must be the tileset name, yeah.

karmic gust
#

aha! it worked. thank you for the help!

vernal crest
#

Yay! No problem. It's very confusing that sometimes the game checks tilesheet and sometimes tileset name lol

candid socket
#

hey, i don't want to be a nuisance but i really want to create a mod for my npc and i don't know anything about programming any advice on how to start friends?

vernal crest
ocean sailBOT
#

Making mods can be broadly divided into two categories:

Usually it’s easier to start with making content packs, since you don't need to learn programming.

vernal crest
#

!npc

ocean sailBOT
#
Creating a Custom NPC

Keep in mind that making NPCs is a complex process that requires learning many different aspects of Stardew modding.
Here are a few links that can help get you started on all that you need to know:

candid socket
#

thank you!

frosty hull
#

@analog flower hello brother, i have question about your mod Sunberry Village

rich seal
#

Question regarding configs. I've got it set in my mod so that all of my custom coop animals can be configured to be enabled or disabled. With the custom Fish Smoker recipes from earlier, I want to set a config option so that I can enable/disable all the recipes added this way. I've already got functioning configs for other things, so I do know how to make them, but I haven't yet figured out where to place the "When": {"Allow Custom Recipes": "true"} lines so that it works as intended. @drowsy pewter

drowsy pewter
#

The When condition goes into the same "level" of the brackets as your Action line

#

It can't go anywhere else

rich seal
#

Oh, gotcha. I feel dumb now lol

drowsy pewter
#

No worries, I used to get that confused all the time too lol

rich seal
#

Log kept saying the json was invalid, and I knew it was related to the "when" lines. Works now, thanks again!

drowsy pewter
#

No prob

#

I'm heading off now though, so if you have more questions someone else will have to chime in!

rich seal
#

I'm still on a kick for adding new smoked items, but I need to get back to what I was originally planning to do today; fish ponds. I want to put a vanilla item into a fish pond that is currently NOT able to be placed in them, such as a Common Mushroom, and have it produce appropriately named roe, such as "Common Mushroom Roe". I looked at "Data/FishPondData.json" in order to try understanding how ponds are set up, and I THOUGHT it would be as easy as copying one of them, but I've consistently been unable to get that to work. As I pretty much don't know what I'm doing, can someone help guide me through the process of making a custom fish pond entry?

thin lake
#

Do I need to download the xnbhack to unpack the game files?

gaunt orbit
#

static field initializers are run before any class members are accessed, but there's no guarantee about exactly when they're called

vernal crest
rich seal
#

Sure, give me a minute. Want it via DM or here?

lucid iron
#

So u should be able to do id_o_mosssoup

frosty hull
vernal crest
rich seal
#

Where do I find the context tags for individual items?

vernal crest
#

In their data/objects entry

lucid iron
#

id_o_blah is an autogenerated tag

#

The best way is to spawn item in game, hold it, and debug listtags

#

This will show all the tags present

rich seal
#

I'll try the tags first before posting files. I assume I type that in the smapi console? Or ingame?

vernal crest
#

Console, yeah

rich seal
#

kk

gaunt orbit
# frosty hull as i know, the static field it's will called before static construct when we ac...

it will be called at latest when the class is accessed for the first time, but the documentation is very specific that there are no other guarantees about when or if the CLR will run static construction. (ie. it may run earlier, or may run even if the class is not accessed)

technically this is bad practice since Game1.content might be null when it's called, since we have no guarantee of when exactly it might be called.

#

usually what you want to do is a lazy loading property pattern, where you only call the loading code when the specific property is accessed

frosty hull
#

ah i think so too

rich seal
#

Smapi tells me that debug is an unknown command. Can't seem to get tags that way.

gaunt orbit
#

if you're using vortex, don't. otherwise, just reinstall smapi to get it back

rich seal
#

Strange. I just installed Smapi fresh last week.

#

I'll go reinstall again anyway

gaunt orbit
vernal crest
#

They are making a mod

frosty hull
lucid iron
#

It might be fine rn due to the special handling for Texture2D

gaunt orbit
vernal crest
lucid iron
frosty hull
#

android sir

gaunt orbit
frosty hull
#

it's issue on android sir 🥲

lucid iron
gaunt orbit
#

ah wait I see, isMarriedOrRoomates, yes, because it's being bound to a null player object

frosty hull
#

yes correct, Game1.player it's object

lucid iron
#

I was asking for curiosity for why it is borked but only on phone

gaunt orbit
#

sorry, the way you write is really hard to understand

lucid iron
#

Cus this part seems like something that would be broken on both android and PC

gaunt orbit
#

probably just what I was saying about CLR guanrantees

#

desktop CLR probably just calls it at a different time than mobile CLR

lucid iron
#

Fun LilyDerp

frosty hull
lucid iron
#

Does it yggy

gaunt orbit
#

shouldn't android be running on net 6 as well?

lucid iron
#

Isn't monogame locked to net 6

frosty hull
#

it should but Monogame android it force using .net 8

lucid iron
#

Do they have sekrit net 8 monogame fork or something

rich seal
#

Alright, I got the developer stuff working. I had the non-dev Smapi installed lol. So, I ran debug listtags on the first item I had (humorously, it was Trash). It shows me id_(o)168. So, under "RequiredTags", I would place that Id?

lucid iron
#

Anyways you might consider sending in a PR

vernal crest
lucid iron
#

That way people won't have to go out of way to get android version and can just use same one

#

Personally i would put CardPool in a Lazy and call it a day Dokkan

calm nebula
#

I pinged Sophie over in smc

lucid iron
#

Lazy<List<TarotCard>> cardPool = new(MakeCardPool);
List<TarotCard> CardPool => cardPool.Value;

calm nebula
#

It's fragile either way

lucid iron
#

Something along these lines

vernal crest
lucid iron
rich seal
#

Alright. Trying that now. Didn't think I'd be throwing trash in for testing, but here's hoping that's all I was missing lol

frosty hull
calm nebula
#

Chue, there isn't an asset prop issue here because of how texture 2d is handled

gaunt orbit
frosty hull
#

yes correct

calm nebula
frosty hull
#

and same Game1.player in static field CardPool

gaunt orbit
#

it needs to be deferred to make sure that doesn't happen

lucid iron
#

Since we don't care about handling invalidation Lazy should cover all your needs here

#

Ultimately tho it should be fine to fix in general build, no need to do android specific fork

frosty hull
#

this code:
internal static Texture2D TarotBuffIcons = Game1.content.Load<Texture2D>($"SunberryTeam.SBV/Tarot/BuffIcons");

it's will bug because you have't register event for custom asset loading

gaunt orbit
#

well again, it comes down to CLR black-box stuff. It's a good idea to change it anyways in case future versions of .net desktop behave differently

frosty hull
#

so we should assign "TarotBuffIcons"
TarotBuffIcons = Game1.content.Load<Texture2D>($"SunberryTeam.SBV/Tarot/BuffIcons")
After this code
Globals.EventHelper.Content.AssetRequested += Tarot_AssetRequested;

gaunt orbit
#

it might still work sometimes but it's better to be certain

calm nebula
lucid iron
#

Tbh i assumed there was some automagic event hook thing but i guess not kyuuchan_run

gaunt orbit
#

... stop giving me ideas for overengineering mod stuff chu

lucid iron
#

Wdym wren soph literally has this in calcifer

#

That's why i thought she did it here monS

gaunt orbit
#

brb writing a sourcegen package that wires up event handlers based on the event parameter /jk

lucid iron
#

I keep going "i should include asset requested in my template" and then i dont do it & continues to copy paste it every time

gaunt orbit
#

it is so easy to get nerd-sniped while modding

uncut viper
#

.. or just EventArgs i guess

#

i have done this

gaunt orbit
#

what I mean is determining which event to hook it to based on the event type in the handler parameters

#

so you don't have to specify it

uncut viper
#

yeah i know. i was saying just use one big function with EventArgs e and hook it to all of them

#

switch statement inside checking what type it actually is

calm nebula
#

God no button plz

uncut viper
lucid iron
#

Ah you just mark the class as a whole with [UseWrenMagics]

uncut viper
#

(i havent done THAT at least, just using EventArgs to reuse one specific function in one specific circumstance)

uncut viper
#

it is! thank you

tiny zealot
gaunt orbit
#

I am reminded of something I did for my WIP building mod though- I used Emit to auto-generate a switch block so I could use a single ForEachBuilding instead of a separate one for every building type that needed it

uncut viper
#

i have no idea how python works, and yoba willing i never will

gaunt orbit
#

(well I guess it's technically an if-else chain. and using expression trees would probably be better but they're so hideously verbose.)

tiny zealot
#

(i have no idea what python is like inside these days, and i don't care to find out, but i heard from a trusted friend some time ago that the main thing in python is an ouroboros-level world-spanning god function with a huge switch on what the statement is)

ebon thistle
#

has anyone tried making the farmhouse texture taller? is that a thing I can do? Im trying to find resources related to changing the buildings texture sizes but I might be going about it wrong

ebon thistle
#

Im sorry if this is a stupid question, I was just wondering if anyone knew or had resources

#

I will look into this, thank you!

gaunt orbit
#

hey, no worries, that's what we're here for!

tiny zealot
#

i doubt you can change the size of the textures the game expects without some C# (framework or bespoke)

#

but i know basically nothing about buildings, so don't trust me

gaunt orbit
#

the farmhouse is just a building, though, all you have to do is change the graphical data on it

#

the sourcerects and drawlayers and whatnot

ebon thistle
#

I was planning on keeping the same structure/layout too, just wanted it to be a bit taller so I can give it a big tower

rich seal
ocean sailBOT
vernal crest
ocean sailBOT
#

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.

vernal crest
#

Also does this mean your fish pond entry still isn't working?

gaunt orbit
rich seal
#

Yeah, the entry isn't working. At the end of the smapi log, it's shooting out errors related to that.

ebon thistle
rich seal
vernal crest
#

All of those warnings mean your formatting is wrong

uncut viper
#

if i had to guess it seems like you mightve put your data at the wrong level and directly inside Entries?

#

instead of inside an entry inside Entries

vernal crest
#

I think you probably need brackets around the entry

#

Yeah

rich seal
#

Can you show exactly where or tell me which lines I need to place the brackets? I thought it was already in brackets.

vernal crest
#

See the one on line 2 in my screenshot? You're missing that set.

uncut viper
#
"Entries": {
        "Id": "Trash",
        "RequiredTags": [
          "id_(o)168"
        ],

should be something like this:

"Entries": {
  "{{ModId}}_Trash": {
    "Id": "{{ModId}}_Trash",
    "RequiredTags": [
      "id_(o)168"
    ],
    ...
#

not directly inside Entries

#

line 73

vernal crest
#

Yeah I realised I should go find an actual example from another mod and just saw it needs the ID as the key.

#

I still have trouble figuring that out just from reading the wiki pages.

rich seal
#

Yeah I didn't even see I needed the modid part. I guess I should have guessed that since the last help I had gave me that exact thing for the recipes below it lol

uncut viper
#

(you technically dont need it (unless theres already one with the same id in vanilla) but its very very recommended. the thing you were importantly missing is the braces like Aba says)

rich seal
#

Well I copypasted what was shown, so here's hoping it works now. Testing real fast.

vernal crest
#

Nah I also missed that it needed a key.

rich seal
#

I am not smart when it comes to coding, but it looks like I already have what it says I should have?

vernal crest
#

You've got a closing curly brace on line 114 with no comma after it

rich seal
#

... I'm starting to hate commas lol

#

Added a comma, checked again, and still shows the same error

vernal crest
#

Are you using the error checking capabilities of your text editor?

#

And is it exactly the same error with exactly the same place referenced?

rich seal
#

Probably not. I'm using Notepad ++, and it's showing me where brackets closed

vernal crest
#

You can use the JSON Viewer plugin to run an error checking process that will tell you that you have errors in your syntax

#

Or switch to VSC to have automatic error notification

rich seal
#

Before I do that, I noticed that line 70's bracket closes EVERYTHING below it, not just my fish pond entry

uncut viper
#

yeah when still gettin the hang of json id highly recommend visual studio code

tawny ore
#

if you use an editor like VSCode, it will tell you exactly where things are wrong

uncut viper
#

line 70 in the last json you sent is correct, its an opening brace

#

oh unless you mean the like. when you close the section

rich seal
#

Yeah, but in Notepad ++, when I click the orange + or -, it should contract everything in those brackets. It contracts everything, including the entries after it relating to recipes.

#

yeah that

uncut viper
#

thats- yeah

#

i realized immediately after my bad SDVpuffersquee

rich seal
#

all good. I'm as good at coding as a toddler, so you're fine lol

#

Yeah I was straight up missing a closing bracket

#

that would explain it

#

validator now says it's fine, so here's hoping

#

Well, no json errors, so that's a good thing. Still can't place an item in the fish pond though.

vernal crest
#

Just checking, you're trying to put trash in, right? Not anything else?

rich seal
#

Correct. The goal is to put a non-standard vanilla item (in this case, Trash) into the vanilla Fish Pond, with the goal of said item producing roe.

#

Or well, any item. Just putting something that isn't a fish in the pond is the goal.

vernal crest
#

Was id_(o)168 the only context tag that the trash had?

#

Also it might be worth copying an entry from FishPondData and changing only the ID and context tags so you can be sure it's not an issue with any of your other fields.

rich seal
#

The only other tags it had were "color_black" and "trash_item". As for copying an entry, that's what I did. I copied Coral's entry, but I'll try another entry.

vernal crest
#

Coral? Does that even produce roe?

rich seal
#

Coral doesn't produce roe, no. The produce field can be editied so it does, but in vanilla, it only produces random junk.

#

I had to find the ID for roe for my attempt

vernal crest
#

Try copying from a normal fish.

#

And try using "trash_item" instead?

#

I'm just guessing at things to try

#

Oh and once you've done that, try using the console command patch export Data/FishPondData to make sure that your edit is actually being applied properly in the game.

rich seal
#

trash_item is used by all the various trash items, including driftwood and broken cd. I'll give that a try though.

lucid iron
#

Using the id based context taf is correct i feel

#

But i forget if the auto rule for roe covers non fish

#

You might need a explicit FLAVORED_ITEM

rich seal
#

No luck still. No JSON errors, but the game just tells me that "Fish can be placed into this pond" like normal. Running the patch export gave me this, which shows the edit is going through.

vernal crest
#

Json website please!

rich seal
vernal crest
#

I have reached the limits of what I can suggest, sorry.

blissful panther
#
"RequiredTags": [
  "id_(o)168"
],

Is this right?

#

The wiki suggests it should be id_o_168?

brittle pasture
#

both forms exist

blissful panther
#

Welp. That's what I was unsure of!

rich seal
#

I'll take a potshot and try with the extra underscore. Can't hurt.

blissful panther
#

Oh wait, yeah, I didn't even notice the second underscore being missing.

vernal crest
#

There is no second underscore in that context tag format

brittle pasture
rich seal
#

Well that would explain a lot

#

So I've basically just been trying to push a square through a triangle hole huh lol

brittle pasture
#

you can change trash's category to fish, but that may or may not cause some other side effects

blissful panther
#

Doesn't mean it won't be possible at all, though... could maybe make a simple trash cleaner machine that take in trash and spits out a, I don't know, cleaned trash item with the correct category to go in the pond.

rich seal
#

That would be a wonderful addition, but that's way beyond what I can do lol. Though, changing the category sounds fine if I use it on items that don't have any real uses I'd assume. Can't hurt to try and see what breaks lol. How would I go about changing an item's category?

brittle pasture
#

edit the category field in Data/Objects

#

you may or may not need to spawn new items? I forgot if category is one of those things that are saved

rich seal
#

Can I get an example of how I'd edit the category? I don't know how to do that. Still learning.

#

And thankfully Trash is easy to find, so if it does need a new one, that's easy enough to find.

brittle pasture
#

also that may cause trash to spawn the fishing minigame when caught SDVpufferlurk

rich seal
#

I would honestly love that, as dumb as that is

brittle pasture
#

I don't have an example on hand, but you Target Data/Objects, use Fields instead of Entries, and set the Category field to something else inside the entry

#

[[Modding:Objects]] and unpack Data/Objects if you haven't already

rich seal
#

I had it unpacked already, so I'm good there. Looking at the Objects file, I just noticed that Trash is considered a fish already lol. "Type": "Fish"

#

I'm probably doing this wrong just like everything else I've tried. I've set an "Action": "EditData", a "Target": "Data/Objects", and I specified Trash ("168"). I wrote "Category": -4, closed all brackets, validated the json and found no errors, then booted the game. Smapi tells me "one of Entries, Fields, MoveEntries, or TextOperations must be specified for an 'EditData' change."
https://smapi.io/json/none/fb96c54a8e5f438ea3c85b3575b15a0f (line 70 is where it's at)

brittle pasture
#

You're missing a Fields block around your change

#

wrap the "168": {} block

rich seal
#

My stupid is showing. How do I wrap it correctly?

brittle pasture
#

you see how in your other entries you have "Entries":, and then the actual changes inside

#

do that

#

however in this case you want Fields instead of Entries

#

Fields is the same as Entries, but it adds "leave the existing fields the same"

#

sorry on phone so I can't type out an example

rich seal
#

All good. So, Just change Entries to Fields, and pray it worked?

#

ahahaha It worked. Forgot I had the item spawner on to test, and when I searched "Trash", the roe and such was right there lol.

#

Thanks for all the help. Feels good to see progress on something that, while entirely pointless and stupid, still helped me understand the concept.

#

Though, now trash is categorized as a fish. I wonder if it procs the minigame... EDIT: Nope. Still instant catch. Oh well, that's a change for another day.

#

Looks like I can't use Sea Urchin's category of -23. Can't place it in the pond with that category, despite sea urchin working just fine.

brittle pasture
#

sea urchins and corals have hardcoded exceptions specifically for them

manic shoal
#

Is there a way to make an option that is used in general but overridden if there's a more "specific" version available? Is it just about the order you place them in the Content.json?
I'm making a CP pack for Fashion Sense outfits and I'd like to make it so, if there is a Storm or GreenRain outfit created then that outfit is used during storms or green rain, but if there isn't a specific outfit for those it defaults to the Rain outfit during storms and green rain.

tiny zealot
#

yes. if you don't specify patch priorities in content patcher, then the order they appear in your content.json is the order they are applied

#

if you are using includes, then the content of an include replaces that patch in the spot it was in

manic shoal
#

Awesome, thanks!

whole raptor
#

Huh... that's annoying SDVpufferthinkblob

rich seal
#

What kind of parents name their child (LocalizedText Strings/NPCNames:Lance)? People these days

tiny zealot
#

something something bobby tables

whole raptor
#

I wish Tokenizable String wiki had a section on where they actually work..

uncut viper
#

if something on the wiki (e.g. mail data) does not specifically mention tokenizable strings, it will not be parsed

whole raptor
#

Tbh I don't see anything about tokenizable strings on event and dialogue pages either SDVpufferthink And at least for events they definitely work
Or I'm blind

uncut viper
#

Buff data
Crafting Recipe data
Dialogue
Event Commands/Scripts
Farm animal data
Building data
Some aspects of location data (e.g. displaynames)
Crop data
Map actions
Minecart data
Movie concessions and movie data
Object/BC/Mannequin/Trinket/Furniture/Clothing/Tool/Weapon data
Wedding data
Jukebox data
Shop data messages
World map data
Fruit tree data
Festival data
Powers data
Monster slayer quest data
Incoming phone call data

#

a very very rough glance of all the places that parse tokenizable strings

#

i didnt feel like looking through each of the 70 functions that call ParseText to see exactly which fields in these things support tokenizable strings, but they'll probably be the obvious things (i.e. displaynames or other text that the user sees)

calm nebula
#

Pathos plz

#

Mail olz

uncut viper
#

Mail has a conflicting syntax with the [letterbg] stuff

calm nebula
#

Dialogue has a conflicting syntax with the [35 345 we3] stuff

lucid iron
#

%LocalizedText key%% ofc

rich seal
#

So, I found one of those unintended side effects of changing items into other IDs. I know what I'm feeding Pierre from now on in year 2 on every run...SDVkrobusgiggle

serene moat
#

Anyone who knows how long it takes for Nexus to show a new uploaded file?

rigid oriole
#

anywhere from a few minutes to like 15-20 minutes

#

if you log out you might see it

uncut viper
# calm nebula Dialogue has a conflicting syntax with the [35 345 we3] stuff

incidentally, after glancing at how it differentiates, it seems like theres a very very minor bug related to that too. Dialogue.isItemGrabDialogue() simply checks if there's a [ in the dialogue but the part that actually checks that when talking to them just uses bespoke code in the middle of Dialogue.prepareCurrentDialogueForDisplay() that actually checks if its a valid item ID first before attempting to create it. it doesnt use isItemGrabDialogue(), probably because that one doesnt do any sort of validation.

however, NPC.marriageDuties does use isItemGrabDialogue to see if your spouse is going to give you breakfast in the morning in order to put them in the kitchen, regardless of whether or not its a valid item or just a stray [ or simply a tokenizable string token that didnt get parsed, meaning your spouse will always be in the kitchen if your marriage dialogue uses failed tokens (or a stray [ for whatever reason)
this concludes today's random marriage duty code fun fact 🌠

serene moat
rigid oriole
#

(of course you can't download it to check it if you're logged out but it might show up at least)

old edge
#

just finished my latest quest puzzle for my mod. It was an entire month of work.

#

had to come and vent

#

never got my green rain summoning logic to only last one day though. Where have all the C# peopple gone.

rich seal
#

Trying to figure it out by reading the machines json, but I'm at a loss. Does anyone have an example of a content patcher recipe for the keg and/or preserves jar that makes wine, juice, jelly, or pickles out of it?

lucid iron
#

You don't have to make your own rule if your item has the right context tags

rich seal
#

So I could add context tags to an item that's not normally placeable in those, and it'd work?

whole raptor
lucid iron
#

Iirc keg specifically have keg_wine rule for this

whole raptor
#

Although... why am I even making the name customizable... I don't need it SDVpuffersquint

lucid iron
#

These are special context tags for the flavored juice wine pickle jelly

#

If your output is a custom item then you need to add the rule normally

rich seal
#

So theoretically, if I put "ContextTags": [ "keg_juice" ] into the fields of an edited vanilla item, that should mean I can make juice?

lucid iron
#

You need to append tag not replace

#

Need TargetFields yes

old edge
#

hmm just had an idea for a puzzle. A new lava map I am working on any suggestions.

rich seal
#

How do you set up an append? For example, using trash (the thing I keep using for testing, just like myself). I recently just edited it to be a fish to be put in fish ponds, so would this append need to be in the same section as the change I already made, or an entirely new section?

lucid iron
drowsy minnow
#

im finally finishing the last design for what im working on and then i just gotta transfer and begin attempting to code for the first time

hallow prism
#

i'm not sure what is the purpose of appending here

old edge
# old edge

I think instead of puzzle I will begin creating my first boss enemy logic.

uncut viper
brittle pasture
#

it has to be done like that otherwise you'd overwrite the entire contexttags field

rich seal
#

Gotcha. I'll try that real quick then

#

Yep, that worked first try. Thanks!

#

(I would not drink that, for the record)

#

I assume I can't randomize which one is picked if, for example, I wanted the same item to provide juice OR wine?

whole raptor
lucid iron
#

Have 2 outputs where the first is RANDOM 0.5

rich seal
#

What would the code for that look like? I've not done any recipes that have outputs yet, so I'm unfamiliar with it.

lucid iron
#

It would be too long for me to type on a phone lol

#

But take a look at bone mill

brittle pasture
#

you dont need random 0.5 since machine output defaults to "pick random" instead of "pick first"

#

You'll need some TargetField drilling if you're adding rules to an existing machine

#

add an entry to OutputRules, define the Triggers (input) and the OutputItem (list of outputs)

rich seal
#

I don't even know how to start the recipe in general. Looking at how the bone mill works has just confused me.

lucid iron
#

Take it slowly n don't overwhelm yourself

brittle pasture
#

one of these days I'll write that machine tutorial (that's secretly a TargetField tutorial)

rich seal
#

Yeah I'm trying to take it slow, but every time I look at something new, it's like I'm on a tricycle entering the interstate lol

#

I'm sitting here with my training wheels on, and being told to race in Formula 1 😛

brittle pasture
#

you've been doing lots of the CP basics so far (editing an asset to add a new entry, or edit an existing entry). machine data is just one more asset, all you need is learn what each field does
maybe this is helpful advice maybe not lol

rich seal
#

I'm still at the stage where I'm just looking at other mods and trying to copy what they do when it's simple lol. Actually writing this stuff out is like a jump from the kiddie pool to an olympic pool, at least to me. Hard to learn this stuff with a short attention span.

#

That whole fish pond thing felt like landing on the moon to me. Now I'm trying to land on Neptune or something with machines lol

brittle pasture
#

how much have you read the CP docs? copying is a good approach, but I feel like at this point it's helpful to have an understanding of what CP does in general

harsh sail
#

hi, new here! I have a question if it's not too much to ask :)

uncut viper
#

!ask

ocean sailBOT
#

Ask your question or describe your issue here, and someone will help if they can!

rich seal
#

I've seen the link to it. That's about it unfortunately.

uncut viper
#

(/lh)

brittle pasture
#

once you know how CP works you can edit any asset in the game

harsh sail
#

ive actually scoured so hard lol, the wiki, the bot, everything

#

i'm new to modding and ive spent days reading and watching the videos on C# coding on the wiki so this is my last resort

brittle pasture
#

what do you want to make

harsh sail
#

believe me I would not interact with humans if i had to 😅

uncut viper
#

luckily the humans here are very friendly and like to help

harsh sail
#

Oh I'm making an NPC mod. Ive actually got a lot down but I'm stumped on one thing. I want my NPC to be able to have children, but the only two lines of code ive found for it are this:

#

I wanted to be sure because testing it in game might be really hard due to the 5% ask rate

brittle pasture
#

those are fields in the NPC's data, which I presume you're editing

whole raptor
#

All NPCs want children by default, so you don't really need anything

harsh sail
whole raptor
#

SpouseWantsChildren is always true unless stated otherwise

harsh sail
#

so basically, other than that, If I don't mess with anything else I can also code children for them? (entirely separate thing I am also working on)

uncut viper
#

you mentioned C# coding and im not sure if you know that you can make an NPC entirely with Content Patcher, but if you're doing C# for learning sake or maybe bc the NPC is just one part of it, you can also decompile the game and look up fields like that and often times they will have comments attached to explain them

#

it can help wit hthe certainty. if the comments exist (for data assets like that, its usually the case)

#

/// <summary>A game state query which indicates whether the spouse will ask to have children. Defaults to true.</summary>
this is the comment for SpouseWantsChildren for example

harsh sail
#

it's what the wiki told me to do!

brittle pasture
#

!npc

ocean sailBOT
#
Creating a Custom NPC

Keep in mind that making NPCs is a complex process that requires learning many different aspects of Stardew modding.
Here are a few links that can help get you started on all that you need to know:

uncut viper
#

the wiki doesnt really recommend any specific path to doing something unless its the entire point of a page (i.e. C# API stuff) as far as i know

brittle pasture
#

the wiki has links to both C# and content modding

uncut viper
#

it does generally try to be method agnostic though and not mention CP specifically not bc you shouldnt but bc its just a general wiki and not a Content Patcher wiki

harsh sail
#

it says NPC's will no longer use dispositions, but I've been checking other NPC mods I have (to compare) and their folders are all called dispositions?

#

and work?

uncut viper
#

if its a pre-1.6 mod, then content patcher migrates them automatically

#

if its a post-1.6 mod, they probably just named it Disposition but actually are using the new format internally

#

thw name of the file or folder matters not at all

uncut viper
#

specifically, NPCs no longer use a data asset called Data/NPCDispositions

#

all character data is now in a much more user friendly Data/Characters

#

which is what that page is warning about

harsh sail
#

got it

#

thank you so so much for the help

uncut viper
harsh sail
#

it was extremely informative

#

💜

uncut viper
#

rest assured i was not exaggerating or bein sarcastic when i said people here are very friendly and like helping, its a very very chill community here

#

looots of beginners pop in all the time

#

so if you ever have any other questions or uncertainties feel free to just chime in whenever o7

harsh sail
#

I understand, I just don't want to be someone who uses people just for their coding knowledge. I feel like people should be paid for their time to do that.

uncut viper
#

many people in here who offer help are actually paid for that but volunteer their time here anyway for fun

harsh sail
#

I've actually always wanted to code, but never found the willpower to do it. (I took some class in middle school and was quickly burned out) This is a mod I really want and looked like maybe a good starting place.

uncut viper
#

if it helps, if you feel like you've been making good C# progress, i definitely encourage you to continue! most NPCs are made mostly with Content Patcher even by people who know C#, but there are still limits to Content Patcher's usefulness and if you ever wanna do something rather customized for your NPC specifically, C# will be needed to supplement the CP part

#

you can leave the bulk of the work to Content Patcher where it's easy to just write jsons and do the fancy custom stuff in a C# component loaded at the same time

#

so itd be useful knowledge to have (and ofc goes beyond stardew too)

lucid iron
#

A big 1.6 improvement is easier content and code (c#) integration

manic shoal
#

Is there an equivalent for "HasFile:{{FromFile}}": true, that would work with OutfitID (for Fashion Sense Outfits)? Here is part of the code I'm working with:

       {
            "LogName": "Portrait Seasonal Weather",
            "Action": "EditData",
            "Target": "nihilistzsche.FashionSenseOutfits/Outfits",
            "Fields": { "RequestedOutfit": {
                    "OutfitID": "{{Season}}_Rain_{{IndoorVariant}}"
                }
            },
            "Update": "OnDayStart,OnLocationChange",
            "When": {
                "Weather":"rain, storm, GreenRain"
            }
        }, 

I want the code to only go through when the OutfitID exists, like I can do for files using HasFile. (And when the weather is storm, rain, or green rain, of course, but that's already there and working)

lucid iron
#

Because this is integration with fashion sense internals, only fashion sense can provide a token for you to do this

calm nebula
#

Technically fashion sense outfits could too

manic shoal
#

Okay, thanks!

harsh sail
#

So I figured I could just copy the code used in another file and edit the language to suit my needs, but it's telling me that multiple copies of the file are trying to be loaded, even though I edited the language?

calm nebula
#

Language?

harsh sail
#

Im not sure how to make a json file without copying and pasting on my windows computer

#

yeah, like instead of using "Name1" I insert "Name2"

lucid iron
#

!startmodding

ocean sailBOT
#

Making mods can be broadly divided into two categories:

Usually it’s easier to start with making content packs, since you don't need to learn programming.

lucid iron
#

Have you looked at the content patcher tutorial?

harsh sail
lucid iron
#

It's a wiki page, linked in the command above

harsh sail
#

I think that was mentioned above, I'll seek it out, thank you.

lucid iron
#

We don't recommend any video tutorials here, they tend to be outdated

#

Plus you can't copy paste

harsh sail
#

right so in every link it leads me to, it tells me to create a .json file

#

I have no idea how

#

when I choose text file and try to name it .json, nothing happens

iron ridge
#

have file name extensions visible under the view option, then you can actually rename it to a json

harsh sail
#

i see!! Thank you!!

harsh sail
#

it is now saying my manifest isn't valid when I followed the exact format shown on the wiki

#

I even validated it on a website meant to validate .json

#

it says everything is alright

#

I used this format, and changed everything to match.

#

except update keys, since I'm not uploading it (It said it wasn't necessary)

brittle pasture
#

!json post what you have?

ocean sailBOT
#

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.

uncut viper
#

(or post a log also at smapi.io, which will also probably indicate the error)

manic shoal
#

I'm proud of myself for managing to figure out what was going wrong with my FSO mod- outfits only changed when the seasons changed. But I don't understand why it's doing that... SDVpufferwaaah

    "Format": "2.0.0",
    
    //DYNAMIC TOKENS

    "DynamicTokens": [
        {
            "Name": "IndoorVariant",
            "Value": "Indoor"
        },
        {
            "Name": "IndoorVariant",
            "Value": "Outdoor",
            "When": {
                "IsOutdoors": "true"
            }
        }
],
    
    //Changes
    "Changes": [
        {
            "LogName": "Portrait Seasonal",
            "Action": "EditData",
            "Target": "nihilistzsche.FashionSenseOutfits/Outfits",
            "Fields": { "RequestedOutfit": {
                    "OutfitID": "{{Season}}_default"
                }
            },
            "Update": "OnDayStart,OnLocationChange,OnTimeChange",
            "When": {
                "Season": "{{Season}}"
            }
        }
    ]
}```
I think it must be something to do with the When section but I'm not sure *why*! Shouldn't that just make sure that the Spring_Default outfit only gets used in Spring and so on? That worked just fine when I made my Wizard replacement.
harsh sail
#

i tried choosing file too

#

nothing

#

does it think the file is empty for some reason?

#

i think it thinks the file is completely empty but i cant for the life of me figure out why

manic shoal
#

Do you have the file open in a text editor of some sort? Were you copy-pasting by clicking on the file itself or copy-pasting the text from your editor to the website?

#

(Also, might be a dumb question but are you 100% sure you saved your file after making edits?)

uncut viper
#

when its Spring you're asking it if the Season is Spring and if so, apply the patch

#

when it becomes summer, you then ask it if Summer is equal to Summer

#

and so on

harsh sail
whole raptor
#

Also I'm pretty sure Season doesn't change when every 10 minutes or on location change (no need for 'Update')

uncut viper
#

with mods, its theoretically possible

manic shoal
uncut viper
#

but i would still say its unecessary

#

the season in the OutfitId is always going to be updated every season too

#

important to remember that with When conditions, the outer braces are removed, but it is still a token

manic shoal
eager lake
#

Anyone know how to properly make an XNB mod in 1.6?

uncut viper
#

please do not

#

unless you are switch modding

#

but if you really must then i dont believe its any different than xnb modding pre-1.6

eager lake
uncut viper
#

in that case you have my sympathies

lucid iron
#

i dont think it changed much

#

you just need to pack it back to xnb with xnbcli

eager lake
#

Can't seem to get any of the tools to work with FarmAnimals.xnb

calm nebula
#

You can't

#

There isn't a tool that will pack the complex data types

harsh sail
eager lake
harsh sail
#

it works now! says its loading in.

drowsy minnow
#

heeeyyyy...could someone help me with the json file stuff to make a seasonal retexture for sprinklers if its possible cause ive tried with what i could research but im struggling..SDVpuffercry

drowsy minnow
uncut viper
#

in this case, all you've forgotten is a } that goes between line 7 and 8 here. you opened your patch with a { on line 4, so there must be a matching } to close it after the patch

#

(very common mistake for people new to json, so not a dumb mistake at all!)

#

(also not too uncmmon for people who arent new to json)

drowsy minnow
#

ohh ok! i didnt know that since i was copying the examples directly off the content patcher guider :]

uncut viper
#

probably just accidentally forgot to highlight the last line of an example, if i had to guess. or just deleted a bit too much

#

but placing that brace/bracket/whatever you wanna call it should let the patch run and load your asset every season to edit on top of springobjects

#

assuming you have a spring_Sprinkler.png, summer_Sprinkler.png, etc inside the Assets folder

umbral plume
#

i want to go about making animated portraits, but i want to use the cute seasonal sprites by poltergiester. They said in posts to dm them on discord by contacting them, so if i wanna ask permission to use their designs, do i just...add them as a friend? Or is there like a server I should connect to them through....?

#

why do i seem to always unalive this server when i enter lmao

uncut viper
#

in my case its bc i was checking the mod page and the permissions section and poltergeister's profile say you can use their designs without needing to contact them so long as you follow their permissions (no AI, credit them, no paywalls)

umbral plume
uncut viper
#

however bear in mind that not every asset in Seasonal Cute is drawn by Poltergeister, but the credits section lists who made what

#

if it was not made by Poltergeist then you should look there to ask permission from whoever created it

#

(though if you do actually mean just the sprites and no portraits then those apparently were all made by poltergeister, so you're fine there)

umbral plume
#

yeah, i saw that, i dont even know for sure if this want to make is going to like become anything, but just in case i magically end up following through on a project for once in my life i wanted to know...im not using their sprites directly either, just like the outfits

uncut viper
#

<not a lawyer> thats probably fine then </not a lawyer>

umbral plume
#

lmao when in doubt i put "credit to __ __ for ____" in big bold letters at the top of page and hope thats good enough not to get sued

uncut viper
#

when it comes to independent creators and not huge megacorps i would change that to "when in doubt dont do it"
but i dont personally have doubt here

umbral plume
#

I'd be a lot more concerned if i was copying or using them directly like pixel for pixel

#

besides, like i said, idk if itll even get done enough or be good enough to get posted so i might not even need to worry

tacit sparrow
#

You should always get permission first even if the mod says it allows you to use their assets without permission. I had read permissions before and was fine to use some assets, then was requested to remove my mod afterwards, and the permission of the original mod was updated afterwards.

rough lintel
#

hey, any mappers know how the summit gets its parallax background, and how someone would do that for a map? nothing special shows up in Tiled for loading that background, so i'm curious now

brittle pasture
#

hardcoded, however we have our savior in the form of MMAP

rough lintel
#

so i guess it has to be painted on manually then

uncut viper
#

well without MMAP it wont be parallax

drowsy minnow
#

i ran into another issue this time with image sizing
it originally said that it was to big and that cp only extends downwards or something i dont remember what it said exactly..?? so i decided to do the x y widtch height dimensions in the content json just like how i saw someone else do it and now..its kinda invisible(if needed i can provide the dimensions i wrote aswell as provide the image itself im using)

rough lintel
#

it doesnt have to be parallax, i just. wanted the background, really

#

wanted to know how it was loaded* correction

rigid oriole
#

@outer glacier

cinder talon
#

what does resetVariable do?

brave fable
uncut viper
#

islandnorth?

brave fable
#

silence

#

as for how it's loaded, the assets are pretty much all available already in Cursors and Clouds iirc, just it's assembled like papercraft at runtime

calm nebula
#

Like the rest of the game

brave fable
#

say that's a good point though、i think the two are still hardcoded since the summit was added, but with a flag or two for summit adjustments in the same class?

#

really need to check the code out when im home

vapid oak
#

(ty for reports!)

rough lintel
#

in Background.cs there's a public Background(Summit location) method and then theres a generic one

#

hm hm.

#

DrawParallaxHorizon is in the IslandLocation.cs though

#

but yeah. very much hardcoded nodnod

brave fable
#

iirc that's for the sea drawing behaviour, while the summit uses mountains

rough lintel
#

ahhh

manic shoal
#

Does anyone know of any way I could check whether an OutfitID from Fashion Sense Outfits exists?
I can target the "nihilistzsche.FashionSenseOutfits/Outfits" endpoint to make the farmer wear an outfit. And I can use the {{nihilistzsche.FashionSenseOutfits/CurrentOutfit}} token to check which outfit is currently equipped. But I really need some sort of way to check, for example, whether "Spring_Rain" is an outfit that exists and I can't figure out how to do that.

#

(And there's the github link, since I just discovered via getting timed out that embedded links aren't allowed, lol.)

tiny zealot
#

masked links are allowed at a higher level than cowpoke, but i forget which one

#

anyway, if you're using Content Patcher, i don't think there's a way to do this unless fashion sense outfits provides a token you can check (i am guessing it does not do this)

#

for example, if it had a token called {{nihilistzsche.FashionSenseOutfits/AllOutfits}}, you could check if an outfit existed by using |contains

#

if you are in C#, you can load the asset and check its contents directly. but CP does not expose this sort of feature, i believe

manic shoal
#

Thanks! I had a feeling that would be the case since someone said the same thing to a kinda similar question I had earlier. But I had to ask just in case. I appreciate your help.

lean verge
#

how do i get these photos not to be so blurry when i send myself the unpacked file :(?

manic shoal
#

It could be the image viewer you're using. A lot of them use interpolation to smooth things out when you zoom in, but it makes pixel art look blurry.

brave fable
#

'send yourself'? how are you trying to currently?

lean verge
#

from pc to my phone so i can use it as a reference in procreate

brave fable
#

make sure you email as an attachment, rather than embedding inline, since gmail (if you use it) may compress the image if it's in the email itself

#

i assume you're saving it as PNG?

lean verge
brave fable
#

the best solution ofc would be to tether your phone and pc via usb and drop the image on manually

#

that way you're not using any online hosting service that might compress the image when saving it on their end

#

but also as million+1 said your phone viewer might also just be upscaling it weird in the preview

manic shoal
#

If you're on android you could download Pixel Image Viewer from the app store and see if it looks the way it's supposed to when you open the image with that.

#

I have an idea that might be brilliant or might be terrible! I recalled someone using Fashion Sense Outfit's ability to share outfits between saves in order to export a bunch at once because it does that by creating a .json with all the information about the outfits. I found that json and, sure enough, it has the names of the outfits in there.
I still need to figure out how I can search that json for the names as part of my code. And requiring all the outfits to be shared between saves is a real janky workaround. But I still find it preferable to listing literally every possible outfit one by one in my content file so that it properly switches between them.

uncut viper
#

you cannot search that json for names with Content Patcher

manic shoal
#

NOooooooo SDVpufferwaaah

#

Why must reality vex me so!

#

But I guess that answers whether it's a brilliant or terrible idea, lol

patent lanceBOT
drowsy minnow
#

AAAAAAAAA

#

IT WORKED IM SO HAPPYYYYYY

twin wadi
#

how do i unpack other mod files? i want to see sve's files for inspo

manic shoal
#

Spaces after commas don't affect lists of tokens, right? "wedding, dance of the moonlight jellies, egg festival" would work just as well as "wedding,dance of the moonlight jellies,egg festival"

whole raptor
#

But also I wouldn't say SVE is the best place to get inspiration from code wise 😅

twin wadi
#

just like how custom npcs are made and stuff

uncut viper
#

if you want to know how NPCs are made I'd even less recommend sve

#

it doesn't follow some best practices because it was made before they were best practices

crude plank
#

also SVE has a lot of other stuff besides NPCs, maybe looking at a standalone NPC would be a better example

ivory plume
winter dust
#

@ivory plume do I have to list JsonAssets as a dependency of my mod to use MigrateIds if I'm migrating from JsonAssets items to CP?

ivory plume
#

Nope.

winter dust
#
[Content Patcher] Ignored (CP) Walk to the Desert Redux > EditData Data/ObjectInformation: Entries > '{{spacechase0.JsonAssets/ObjectId:Old Coin}}' key is invalid: '{{spacechase0.JsonAssets/ObjectId:Old Coin}}' can't be used because it's provided by Json Assets (ID: spacechase0.JsonAssets), but (CP) Walk to the Desert Redux doesn't list it as a dependency and the patch doesn't have an immutable HasMod condition for that mod.
#

Someone reported this to me.

ivory plume
#

It looks like you're still using Json Assets in your content pack? You'd normally convert the items to Content Patcher, use standard item IDs, and the only reference to the old Json Assets IDs would be in the MigrateIds trigger action to map them to the new item IDs.

winter dust
#

Which is why that version has MigrateIds in it.

ivory plume
#

The error says there's an EditData patch editing Data/ObjectInformation (the pre-1.6 asset name) which has a key named {{spacechase0.JsonAssets/ObjectId:Old Coin}}.

winter dust
ivory plume
#

Looks like they have an old version of the mod then?

twin wadi
winter dust
#

They would have to be using 1.3.3, because 1.3.2 was still using JA afaik.

ivory plume
#

I'm not familiar with the mod, but all I know is that whatever version they have is still editing Data/ObjectInformation with Json Assets tokens.

winter dust
#

Oh yeah, VSCode still doesn't like the way this is done apparently.

#

I have "$schema": "https://smapi.io/schemas/content-patcher.json", defined at the top of my content.json file.

ivory plume
#

Technically single-quoted strings aren't valid in JSON, but SMAPI and Content Patcher use a less strict parser that allows them. (The schema only controls the field structure, not the allowed JSON syntax.)

woeful lintel
ivory plume
#

(Or use single quotes if you don't mind VS Code yelling at you.)

winter dust
#

Can you colour honey yet?

#

Or is it all the same colour.

lucid mulch
#

you can colour any item if you put in the work for it

brittle pasture
#

there's at least 2 mods that do it

winter dust
#

This would be perfect if they were worth $1 each.

#

I have no buffs currently on my player.

#

I'm not sure why its doing this.

brittle pasture
#

your ExtraHarvestChance is 1

lucid mulch
#

and HarvestMaxIncreasePerFarmingLevel being 5 is a large number

winter dust
#

I didn't even notice that.

#

Well, I used the values Tarniyar used back when she maintained it.

#

I guess I'll need to fiddle with them.

brittle pasture
winter dust
#

I know what they mean, I just forgot that they were there.

lucid mulch
#

Harvest(Min/Max)Stack is before the extra harvest / max increase per level applies

winter dust
#

Hadn't edited this file in a few months.

#

Okay cool, I only get one at a time, except a very rare chance that they multiply for skills.

manic shoal
#

I did the thing! I got my Fashion Sense Outfit mod working for seasons, weather, and festivals and I did NOT end up resorting to listing every single option as its own entry in the content.json! I needed to take a step back, think a little harder about my combination of tokens and "when" conditions, and continue to test it out like 1000 times. (Thank goodness for CJB cheats!)

gloomy hemlock
#

This isn't a question but.... I've been fighting this code for hours... Only to realize ELLIOTT IS ELLIOTT. Not Elliot. I hate dyslexia so much 😭😭 My soul just left my body like 6 times over

#

I never in my life have been so mad, joyous, and despairing to have something work...

winter dust
#

To sell crafting recipes, are they just called as Objects (O)? And I'm assuming the names of the CraftingRecipe or CookingRecipe doesn't matter?

lucid mulch
#

there is a IsRecipe: bool field for the shop entry

winter dust
#

When did they add that? I don't see that in the documentation on the wiki.

lucid mulch
#

1.6 at least, and I can't even remember what 1.5 looked like anymore

ivory plume
patent veldt
#

How do you get a frying pan for loveofcooking?

brittle pasture
patent veldt
#

Oh sorry about that

#

Thanks!

ornate locust
#

I had it in a mod title and everything SDVpufferwaaah

gloomy hemlock
ornate locust
#

Elliot is a valid spelling so it throws people right off

#

one of those Katherine/Catherine kind of things

hard fern
#

😔 i pride myself on remembering the spelling of his name the first time

ornate locust
#

though Elliot is one of those name pits where there's Elliot, Eliott, Elliott, Eliot, and even Elyot

#

I wondered what the most common spelling was and fell into a real Google hole

hard fern
#

Speaking of Catherine

#

No actually i don't have anything to add

#

😭

wind basalt
#

Hey anyone here familiar with making mods? (jsonassets or c# doesn't matter), i really need someone to help me on something :((

#

I would really love it if anyone could just give me a guideline on how to use jsonassets, i can't find a single tutorial, and the wiki seems outdated somehow?

#

I just want to add boots

#

and I want it to be at the adventurer's guild

#

anyone knows how to do that?

whole raptor
#

JA wiki seems outdated, because JA is outdated

iron ridge
#

you shouldn't really be using json assets anymore

round timber
#

youll want to be using Content Patcher instead

vernal crest
wind basalt
vernal crest
#

It won't give you a step by step guide for the specifics of boots and shops - I don't think we have any - but you should be able to look at a mod that adds boots via CP to the game to see an example of that, and any mod that adds items to a shop via CP will give you an example of how to add things to shops.

wind basalt
#

what abt the ag?

whole raptor
#

Adventurer's Guild? That's the shop part linked above

vernal crest
#

Yeah, it's just one of the shops.

wind basalt
round timber
#

JA is not part of the equation here, its a legacy framework that is only used by mods that havent been updated to Content Patcher

vernal crest
# wind basalt i thought that was the JA link

I did not give you any links relating to JA at all. I did not at any point suggest you use JA. Sorry for not being more clear about that! Everything that I have said to you and linked for you is for doing this in CP.

wind basalt
#

hey so this is a bit confusing

#

anyone knows how i can make it like a specific price

#

i want it to buy 5000g, and have +8 immunity +8 defense

uncut viper
#

if you set a specific Price in the Data/Shops entry, it'll overwrite the base calculated price

#

the price in the weapon data will affect how much it can be resold for though by the player, if that matters to you

#

er, boots data

#

not weapon

wind basalt
vernal crest
wind basalt
#

i'm still pretty confused on how to edit the ag to contain that item

#

but i'll try

vernal crest
wind basalt
#

yeah that's what i am doing

#

thanks for the help bro

vernal crest
wind basalt
frosty hull
#

@analog flower hello

#

@copper kestrel Hello World, do you have a plan fix bug mod Sunberry Village?

round timber
#

just fyi, it is helpful to describe the specific bugs you are having with the mod 🙂 saying that the mod is simply bugged in some way does not really help the devs in figuring out what they can do to help you.

proud wyvern
#

I believe this is about Android compat

#

Atra said something about contacting sophie last time, iirc

copper kestrel
frosty hull
#

thanks god🙏

calm violet
#

Hello everyone, is there a way to create a custom letter using Content Patcher?

I’d like to do it directly with Content Patcher without installing any additional mods, since I only need to add a single letter.

round timber
#

yep thats definitely possible

harsh bobcat
#

I want to replace a vanilla function with my own function (to be specific, LetterViewerMenu.HandleActionCommand with an optimized version). How would I best do this? I'm seeing stuff about harmony patches, but those seem to be a) prefix/postfix [where I'm adding things that's also running and not necessarily overwriting it {and even if I do I still can't return a string like it wants? I think?}] or b) direct IL instructions which seems way harder than necessary

#

(The goal is to make it so that way that section of code runs way faster, as while the current method is fine for normal usecases it has O(n^2) performance when it could be O(n) performance on a rewrite; and the things I'm doing involve giving it huge inputs. so I want to optimize it to allow me to do other cool stuff)

#

I could also replace the line of code which calls HandleActionCommand [it is only called in one place] with code that calls my custom function I suppose?

brittle pasture
#

you can do a skipping harmony prefix, it will run your code and skip the original
do run benchmarks and make sure your version is faster though, and your approach may have implications for mod compat, though I'm not sure if any mod on the market currently would be affected

#

(what are you trying to do?)

proud wyvern
#

A skipping prefix is definitely bad for mod compat

brittle pasture
#

(that needs that level of nesting in letters)

harsh bobcat
#

works vanilla, but I run into performance issues

#

my point is to make a mod which assists me in doing something that works in vanilla

brittle pasture
#

hmm, and how does the player play out those games via mail

#

maybe you can just define your own single action and run that instead

harsh bobcat
#

I want to work under vanilla restrictions - all I want is to be able to have the same thing that vanilla does run faster

lucid iron
#

If you are in C# anyways why not just make your own IClickableMenu that looks letter like

harsh bobcat
#

I enter code into the game by using the fact that mails include your name and your name can have executable code - if you're a girl and you name yourself the attached file, you can run connect 4. this specific code is actually for multiplayer connect 4.

note you must be in the chinese language to copy paste this

#

I'm dealing with mails that are hundred of thousand if not millions of characters long

#

The problem is that vanilla code runs
mail = mail.Substring(0, startItemIndex) + mail.Substring(startItemIndex + substring.Length);
which means for every command it performs string operations on its entirety

#

when I would much rather have a string builder approach of all the text that isn't in the mail

brittle pasture
#

SDVconcernedCA (affectionate)

lucid iron
#

Well i mean i don't think patching mail to make this work performantly is that bad cus you are just have fun™️

#

But doesn't it defeat purpose of this kind of thing?

harsh bobcat
#

And yeah this mod is primarily for my own messing around and having fun [and for anybody interested in the same thing], not for general consumption because of how incredibly niche the usecase is

lucid iron
#

skip prefix all you want then 3sSmolMiku

#

!harmony

ocean sailBOT
#

Harmony is a framework for patching .NET code, allowing you to take any portion of the game's logic and insert or substitute your own. This gives you more flexibility and control than SMAPI helpers and events, at the cost of being typically more complex and difficult to use safely and correctly, and more likely to break with a future update of the game and/or SMAPI.

If you are trying to do something that isn't possible or practical with SMAPI alone, then Harmony is usually the solution.

For more information, refer to the following:

harsh bobcat
#

But it needs to return a string

lucid iron
#

here's some guides for how2 harmony

harsh bobcat
#

Is this just "dig deeper into harmony"?

lucid iron
#

u can set ref string __result in a skip prefix yea

harsh bobcat
#

ah thank you then

uncut viper
#

your other idea of just replacing the method call would also work and is a similar level of effort as the skipping prefix

#

Harmony's got you covered

lucid iron
#

so what exactly is playing connect 4 here NotteThink

#

what does it look like in game?

harsh bobcat
lucid iron
#

who is giving the inputs tho

harsh bobcat
#

(I've played around with the reference items [and in this screenshot bears won a 4 in a row, this is an older version where the item changed instead of getting iridium quality]) you read a book to place a square in that column

#

so in that image you would read Book_Grass to place a junimo hat in column 6

#

can be played multiplayer between two people each controlling one color

uncut viper
#

i still have kind of no idea how it works and opening that file you sent is a bit dizzying, but this seems fucked up in the best way and I love it, please keep it up

lucid iron
#

fun times with book stat i see DokkanStare

#

is it girls only bc of the gendered switch blocks

harsh bobcat
#

(I recognize that I could be using If Any and commas more to remove some of the nulls and make this slightly more optimized but that's a future me thing)

lucid iron
#

i do wonder if your bottleneck is mail parsing vs just sheer amount of actions happening

harsh bobcat
#

I have snake, bubble sort, tic tac toe, and connect 4

harsh bobcat
#

Note that every command has two tasks:
The task it must do (consider this O(1))
Perform a string operation on a million character long string [or really O(n) long string]

#

When I implemented my own mail reading without the million character long string operation, it runs way faster [just as a standalone java thing]

lucid iron
#

oh i see my misunderstanding

#

each reading of mail is just to check board state?

#

not to actually start the game somehow

harsh bobcat
#

every time you read the mail the board state updates and shows you the board

#

yeah

#

I doubt I can post links/videos? But I can send a recording of my snake game, which has 20 second execution time that I cut out of the video

lucid iron
#

you are allowed embeds in this channel even if you aren't cyan yet

harsh bobcat
#

ignore the cringe alexa knows all please I haven't bothered rerecording it

harsh bobcat
lucid iron
#

this is amazingly cursed im glad you shared it with us

uncut viper
#

you are the spiders georg of when we tell people "the performance implications of what you're doing are negligible, you arent doing thousands of things needed to worry" (complimentary)

harsh bobcat
#

yeah no no gripes towards CA for making this code run in O(n^2) but I specifically need it to be O(n) lol

#

oh right I also need to optimize gender switch blocks I forgot

#

but also oh my lord it's so smooth and so good

#

so glad I decided to do this

meager portal
#

Anyone know where the texture of flute block is? I can't find it in Craftables.png or furniture.png SDVpufferflat

brittle pasture
#

maps/springobjects

#

it's one of those wacky placeable objects

meager portal
#

Many thanks!! Finally I find it

rich seal
#

Made a custom barn animal that's more or less a copy of a pig, and for some reason it has an emote bubble over its head that shows what it's going to dig up that day. Can't seem to figure out why it's showing this bubble, but I'd like to get rid of that. Can anyone help me turn off that bubble?
https://smapi.io/json/none/c2223e3913e74b66b86c98c75d343883

#

This is the bubble it's showing, for the record

harsh bobcat
#

Do you have a mod which does that for regular pigs?

rich seal
#

Nope. Normal pigs are unaffected. It's only my custom animal.

lucid iron
#

is it uiis2

#

it is not likely to be thing you are doing as a content mod

rich seal
#

I do have that. Let me turn it off and check.

#

I assume you mean UI Info Suite? Just checking

brittle pasture
#

UI Info Suite hardcodes the truffle check

#

instead of DigUp

#

(I should send a PR...)

rich seal
#

Oh, it sure did. Turned off uiis2, and the bubble's gone.

#

Well that's mildly inconvenient lol. I like uiis2, but that bubble is distracting as all hell. Oh well.

brittle pasture
#

(though given that UUIS2 is in the mids of the Great Rewrite maybe I should just ping them instead)

rich seal
#

Well poo, this whole time I was combing my mod's files trying to figure out what was causing it. Guess that's two hours wasted lol

harsh bobcat
#

Okay so I took snake (1.1 million characters before gendering, 1.6 million characters after gendering) and running it on vanilla it takes my machine about 100 seconds to run and on modded it takes 1 second to run

#

I think I like this 100x speed boost

lucid iron
#

@next plaza Hi casey you might recall this issue with spacecore equipmentmenu locking up the game if player opened it while inventory is full and had another item on their cursor (i.e. having item in cursor and then picking up another item on the floor)
I was thinking of opening a PR to help avoid this situation and the easiest change is to just set AllowExitWithHeldItem = true;, do you have any opinions about this?

karmic gust
#

Is it possible to add tile animation using EditMap? I'm trying to move Abigail's pet.

lucid iron
#

yes but you need a tmx

karmic gust
#

So that would mean editing the whole map rather than just a small patch?

lucid iron
#

no its a small tmx

karmic gust
#

Oh okay

karmic gust
#

I'll take a look, thank you!

valid folio
#

https://www.nexusmods.com/stardewvalley/mods/18177

Hi, I want to change the portrait of this mod using Portraiture, but it doesn’t apply the change. Is there anything I need to do besides the steps mentioned in Portraiture’s description?

Nexus Mods :: Stardew Valley

Turns the hat mouse from the far corner of Cindersap Forest into a real character named Lacey.

brittle pasture
#

your portrait is named wrong, or in the wrong place, or etc.

#

what did you do specifically?

valid folio
# brittle pasture what did you do specifically?
  1. I create the folder in Mods/Portraiture/Portraits

  2. I place the portrait inside that folder (in this case, named Hat Mouse Lacey).

  3. I rename the PNG to match the portrait I want to replace — in this case, it's portraits_nouveau_default.

  4. I start the game, and when the dialogue box appears, I press P to choose the portrait set and select Hat Mouse Lacey.

brittle pasture
#

Shouldnt you name the pngs after the npc's internal id

valid folio
round timber
#

it just so happens that the vanilla npcs have internal IDs that match their normal names

#

many custom NPCs do not

brittle pasture
#

also what a CP mod names its pngs have no bearing on what the pngs will be loaded into

valid folio
#

Are you referring to this kind of example, where the image names seem to include the mod’s ID in their name? This example is from a friend’s mod that uses Portraiture and lists Portraiture as a dependency in order to work.

brittle pasture
#

yes, though not every NPC mod follows the mod id convention

#

you need to see what Lacey's ID is in Data/Characters, and use that ID

valid folio
#

btw my firend´s mod is using Portraiture Plus, too

brittle pasture
#

Portraiture Plus adds some more variants/syntax (seasonal, etc.)

#

what I said still applies

valid folio
brittle pasture
#

yes, however next you need to see what {{Lacey}} resolves to, it should be in content.json

valid folio
#

I have no idea what I’m supposed to look for, haha. That’s the content.json.

brittle pasture
#

in the dynamic tokens field Lacey gets defined as {{ModId}}_Lacey

#

change {{ModId}} to the actual mod id and you should get the final value

valid folio
round timber
#

how do you make a GSQ check for the state of a dynamic token? like i want the condition to be active for whenever a token has a value of true

whole raptor
#

It's kinda funny seeing how SVE still uses such a roundabout way to use a temp item in an event... by changing the soda machine into it SDVpuffereyes

brittle pasture
valid folio
brittle pasture
#

what's your final png name

brittle pasture
#

yeah that should work

round timber
#

thank you!

brittle pasture
#

They do exactly what I described, so you probably made a typo in the png name

#

(also ew ai)

round timber
#

oh im going to have to remove that link then CGPufferEyes

#

@valid folio hello i deleted your message containing the link to that mod because it features AI. Please keep in mind we dont allow those in the server!

brittle pasture
valid folio
valid folio
whole raptor
# round timber cursed

Makes me want to really hop on Tia's suggestion and rip Lance from SVE (and rewrite the whole code) 😅

valid folio
round timber
#

there is something satisfying about optimizing code

whole raptor
#

Oh definitely

brittle pasture
#

ichortower.HatMouseLacey_Lacey.png

#

recall my post earlier
{{Lacey}} -> {{ModId}}_Lacey -> ichortower.HatMouseLacey_Lacey

valid folio
brittle pasture
#

by default it will use that same portrait for all 4 seasons

#

seasonal variations would use portraiture plus

valid folio
#

ok thanks

brisk wedge
#

Not my code, but does anyone know why the check here https://github.com/Videogamers0/SDV-CombineMachines/blob/5b9dffe2bb602297188f78eb85a00940f9323d23/CombineMachines/Patches/DrawPatches.cs#L119 isn't true for modded machines? Afaict the only things it really checks are that they're the same machine and GetMachineData() isn't null, which is true. Or is it that modded machines just won't hit this postfix in the first place?

GitHub

&quot;Combine Machines&quot; mod for Stardew Valley. Allows combining multiple copies of the same machine into a single copy with better processing power. https://www.nexusmods.com/stardewv...

lucid iron
brittle pasture
lucid iron
#

they hardcoded a list of em

brittle pasture
#

it'd need a rewrite to switch to proper item ids

#

and 1.6 machine data to support modded machines

#

I said this before but this is why I'm wary of 1.5 mod that got updated a little too quick for 1.6

brisk wedge
#

Stupid question, what is a parent sheet index? I thought it was basically just the position of the sprite in the png file the sprite comes from

#

which now that i think about more, my definition doesnt really make sense cuz youd probably need two numbers?

brittle pasture
#

yes, but custom objects can use their own sprite sheet now

#

so they can be index 0 in their own sheet, while be a different item from the item that uses index 0 in the vanilla sheet

#

item ids is now the canonical unique identifier for objects

brisk wedge
#

doesn't that mean the check is too broad? Like more things would return true than they should

lucid iron
#

the best way to check whether an item is a machine is to look at the keys of Data/Machines

#

previously in 1.5 all machines were hardcoded

brisk wedge
#

I thought that section where they hardcoded the machines was guarded by LEGACY_CODE? I guess I don't have a way to know if it was set in the version that was released

gloomy hemlock
#

Question! I'm trying to follow good coding habits and make sure to comment in certain areas. Is there any times I should avoid using comments I should watch out for? My understanding is they're ignored by the system, they're just for clarity of looking through your work

brittle pasture
#

that check can just be deleted

#

and migrate every other usages of ParentSheetIndex to item ids

uncut viper
#

dont do this:

x = x + 1 // Adds 1 to x
brittle pasture
#

a good rule is document "why", not "what"

#

if you find yourself needing to comment "what", that's a good sign to use more descriptive variable names

#

or less ternary operations

gloomy hemlock
brisk wedge
whole raptor
#

Just to be sure... tokens also handle multi line values, right? SDVpufferthinkblob

lucid iron
#

comments cant cause errors

uncut viper
#

important clarification: comments CAN cause errors, but not with SMAPI or the json parser it uses

#

dont put comments in json in use in non-stardew things unless you're sure they wont cause an error

#

bc comments are not typically allowed in json

brittle pasture
brisk wedge
gloomy hemlock
# uncut viper bc comments are not typically allowed in json

That makes sense why my Visual Code Studio is so mad at them existing. Thank you everyone for clarifying. I'm still very early in learning so I want to make sure I'm not creating further problems for myself. I was paranoid it was what caused my trigger actions to be wonky.

brittle pasture
#

maybe they compiled in legacy mode? I admit I've been doing all this on my phone lol

#

are you sure that check is the one that's tripped

#

if you already have the source downloaded you can try compiling it yourself with debug lines

uncut viper
gloomy hemlock
#

The ones in the trigger action section are redundant anyways. Now I just will keep them in the context json by the include action. Also appreciate the tip about why, not what. Will help trim the fat and keep them more useful.

uncut viper
#

you can do this by <insert process here. i dont know it. google probably does or someone else here>

lucid iron
#

!vscodejsonc

gloomy hemlock
lucid iron
#

!vscjsonc

ocean sailBOT
#
How to make VSCode not scream at json comments

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.

gloomy hemlock
#

Oh nice. I love that there's a command for that

valid folio
whole raptor
#

I never really understood what $schema actually does SDVpufferthinkblob

uncut viper
#

VSC has no idea what the structure of your json is supposed to look like bc how the hell does it know what Content Patcher expects you to write

#

the schema tells VSC what the hell content patcher expects you to write

#

e.g. it means VSC can now tell you "you cant put a FromFile on an EditData, silly"

#

(actually it might not be able to do that, but it can tell you that you cant put "Actions" instead of "Action". it MIGHT be able to do the above but idk i havent tested or ever used it)

lucid iron
#

it can tell u that yea

uncut viper
#

handy

#

i thought so but realized i couldnt confirm it myself so wanted to edit

lucid iron
#

but it doesnt know anything about the structure of what you are editing ofc

uncut viper
#

just need someone to write schemas for every single vanilla asset SDVpufferthumbsup

valid folio
#

Quick question; do you know of any tilesheets with a Halloween or horror style? Is there anything like that on Nexus for Stardew Valley?

whole raptor
#

I have most of the format templated into snippets, so I never really needed it I guess 😅

whole raptor
#

There's no other way to "fade in/out" an NPC aside from having 20 frames with descending opacity in the sheet, right? SDVpufferthinkblob

rough lintel
#

i dont think you need… 20, per se lol

#

but unfortunately yeah i think anything like that is limited to doing it yourself. no fancy event code for it

#

altho i kind of need that too now that i think about it 😐

whole raptor
#

Well.. yeah SDVpuffersquee But I'm either sticking to Lance's sheet or finding a way to don't use any additional frames 😅

rough lintel
#

could always just do a tempactor to not add to your own spritesheet ╮( ̄▽ ̄””)╭

whole raptor
#

I'm also curious why SVE used showFrame instead of animate SDVpufferthinkblob Unless it wasn't a thing before

rough lintel
#

no animate was def a thing

whole raptor
#

So it's another of Just SVE Things™

rich seal
#

If someone is able to, could you look over this code and tell me why it would return an ErrorItem instead of the intended result? I thought I was doing it right, but I've yet to get the intended result of "put herring in preserves jar, get Surstromming". https://smapi.io/json/none/4154f8f5ae9a44d6b4ecb2f94bb3cffd

uncut viper
#

is it just an error texture but with all the correct properties of your surstromming?

rich seal
#

It's a full blown error item. Can't use it for anything.

#

No properties at all, sadly

whole raptor
#

Oh, temporaryAnimatedSprite has a fade field SDVpuffereyes Would be nice if it was a temp sprite

rough lintel
#

fulfill your destiny

uncut viper
#

i dont know much about machines at all, but maybe try adding an (O) to the front of your ItemId in outputitem?

whole raptor
#

I'd definitely go that route if I made it from scratch (or made Lance a standalone NPC eventually), I don't care enough to change it for now SDVpuffersquee

rough lintel
#

OH youre cutting lance out from sve arent you

#

thats what this is

rich seal
whole raptor
#

No no no... (yet, maybe)

#

Just fixing the fade animation for Lannah (since the sheet is a bit different)

uncut viper
#

unfortunately then i cannot help with machines as they are like mystery black boxes to me still as ive never worked with em

rich seal
#

Yeah, they're a pain in the butt. Oh well. Back to bashing my head on the keyboard until it works/I give up lol

rigid musk
#

huh.. it's not outputting it if you put an O in front?

uncut viper
#

(make sure its an O and not a zero)

rigid musk
#

^

rich seal
#

O for object, yeah. That's what I did, but the result is still unfortunate.

rigid musk
rich seal
#

Error Item (Campaigner.surstromming) with the description ???

rigid musk
#

It might be a texture issue then

rich seal
#

I don't think it is. Last time I had a texture error with another item, the item was created just fine but with the red circle instead. I think the item itself is just broken somehow.

rigid musk
#

could you send a picture of what- thank you

rich seal
#

Yeah I just grabbed a screen after posting lol

rigid musk
#

can you confirm that the item itself exists in the game

#

(by spawning it in with cjb cheats or something )

#

cjb item spawner*

rich seal
#

It does not exist. I used the cjb item spawner to check.

rigid musk
#

ah then the problem is with the item itself let me look over that :)

rich seal
#

The thing is, it's a direct copy of another item I already made that works, which is confusing

ornate trellis
#

id start with maybe changing it to the artisan goods category? why is it an egg item rn O:

rich seal
ornate trellis
#

well, either way id change it since its not an egg lol

rich seal
#

I mean, it COULD be an egg. Surstromming is basically a chemical weapon irl 😛

#

But yeah, changed it and testing now

sterile epoch
#

I wish there was a mod menu on the console versions that games like fallout 4 or Farming simulator have, that'd be neat

ornate trellis
#

with that logic you say any egg is a biological weapon xD anyway, yeah

rich seal
#

Changing the category sadly did not fix it. Item doesn't exist still.

sterile epoch
rigid musk
#

how odd... it does work if i copy paste it into my mod (ignore the fact that its a celery, i just used my object sheet)

uncut viper
#

i did just notice that in the json you originally sent, your EditData for the machines is inside your other patch

#

instead of its own patch

next plaza
#

(Ping me for followup messages, since I'm not checking here much)

rich seal
#

I will be the first to admit that I am definitely not a coder lol. JSON verifier said it was fine, so I just went with it. How would I go about fixing the format?

rigid musk
#

oh that could do it yeah

uncut viper
#

each patch needs its own { } block

ornate trellis
#

oh yeah i am notoriously bad with putting the right amounts of brackets etc so i did not notice at al

uncut viper
#

what you have is valid json, but it is not valid data

#
{
  "Action": "EditData",
  "Target": "Data/Objects",
  ...
  ...
},

{
  "Action": "EditData",
  "Target": "Data/Machines",
  ...
  ...
}
#

like this

next plaza
#

(Or else it might be a bit before getting released)

uncut viper
whole raptor
#

Oh wow... I think I broke a record... I had a file that wasn't included in content.json at all in my mod for... 3 years and 3 months before noticing SDVpuffersquee

uncut viper
rigid musk
#

(although you should also have a 'changes' field up at the top iirc)

next plaza
rigid musk
#

((unless that is just a part of a bigger json you have))

rich seal
#

It's a separate file right now, mainly because my main content.json is so packed. I was planning to move things around later, but if it's easier to just dump it in my big file, I'll do that instead.

rigid musk
#

oh O:

#

should be something like this then

rich seal
#

Just tried that, and item still doesn't load in.

rigid musk
#

does anything show up in your SMAPI console?

#

any red that is

rich seal
#

Nope

#

not a single red line

uncut viper
#

is this file being correctly Included?

rich seal
#

I hesitate to say yes, considering I can't do something as simple as a new item at this point

uncut viper
#

where is your Include patch?

rich seal
#

All are in a separate json. Did I need one for this item and recipe?

uncut viper
#

no other json other than content.json is ever looked at

#

unless you tell CP to look at it specifically

rich seal
#

...That would probably explain it then

uncut viper
#

(well and besides manifest.json)

rigid musk
#

yeah..

serene moat
#

Anyone who can help me with this issue?
I just got this bug report:
"When you've married Levi and it is right before the Spirit's Eve festival when he is dressed up, when you hug him, he briefly switches back to his default clothing."

        {
            "LogName": "Spirit’s Eve sprites",
            "Action": "EditImage",
            "Target": "Characters/Levi",
            "FromFile": "assets/images/Sprites_Spiritseve.png",
            "When": {
                "DayEvent": "spirit's eve"
            },
            "Update": "OnLocationChange"
        },
        {
            "LogName": "Festival Portraits",
            "Action": "EditImage",
            "Target": "Portraits/Levi",
            "FromFile": "assets/images/Portraits_Spiritseve.png",
            "When": {
                "DayEvent": "spirit's eve"
            },
            "Update": "OnLocationChange"
        }
rigid musk
#

You should be using the appearance ... thing (cant think of the correct term here) for NPCs

#
                                "Id": "FlowerDance",
                                "Condition": "IS_EVENT festival_spring24, PLAYER_HAS_MAIL Any QiFlowerDancing Received",
                                "Indoors": true,
                                "Outdoors": true,
                                "Portrait": "Portraits/{{ModId}}_TheMrQi_FlowerDance",
                                "Sprite": "Characters/{{ModId}}_TheMrQi_FlowerDance",
                                "IsIslandAttire": false,
                                "Precedence": -100,
                                "Weight": 1
                              },
//
{
            "LogName": "Qi Sprite Flower Dance Male/Undefined",
            "Action": "Load",
            "Target": "Characters/{{ModId}}_TheMrQi_FlowerDance",
            "FromFile": "assets/images/QiFDSprite.png",
            "When": {
                "QiGender": "Male, Undefined",
                "HasReadLetter": "QiFlowerDancing",
                },
        },```
#

ignore the horrid formatting that discord did to that but

#

the first part is in the appearance section for the NPC and the second is actual asset loading thing... whatever (im really not good at terminology if that isnt obvious)

serene moat
#

I'll give it another go! First time I messed with Appearance it was a pain in the butt, thank you

rigid musk
#

It can be a bit confusing at first but it's not too terrible once you get the hang of it!

#

your condition would be "IS_EVENT festival_fall27" I think

serene moat
#

Are you using that for Seasonal sprites too?

rigid musk
#

I have it for his winter portraits yeah :D

#

(i didnt give him anything else, i dont feel like making the portraits for that since I would have to make like... six? of them?)

serene moat
#

Maybe it didn't work for me because I didn't write Weight

Thank you for showing me your code!

rigid musk
#

Of course! I'm happy to help

#

you also need the other parts of it wher eyou load the portraits/sprites

rich seal
#

So, I got it to work finally, but I didn't put it in my main file. Added an "Include" that references a "FromFile", which is what I did for a bunch of my other things. I couldn't get it to work in the main file, but it works now. Good enough for me, as I'm sick of looking at surstromming again lol

lucid iron
scarlet ether
#

SMAPI and JSON validator keep throwing me an error. IDK if I'm just too tired to think straight or what, but this is correct syntax, isn't it?

visual dirge
#

if a content patcher When condition makes an npc (temporarily) stop existing, will players lose all friendship with them?

rigid musk
#

Why temporarily stop existing?

lucid iron
#

No i think friendship persist in the save

rigid musk
#

if it's so they leave temporarily (like on a trip) you can do whatever they do with Elliott to make them vanish for a little while (or how June does it.. or Jasper)

visual dirge
lucid iron
#

One time Lily changed mr qi mod folder structure so he was uninstalled for like 4 days in gsme

rigid musk
#

If friendship persists in the save then it doesnt matter how long theyre gone

visual dirge
lucid iron
#

His hearts were there when i noticed so it should be fine

#

You can also rely on people not doing When to hide a npc most of the time cus there's UnlockConditions for that kind of usage

rigid musk
#

hm... I guess the gone from social page thing makes sense though you could use a token for that I think, and you can reset the friendship if its through an event or something with a GSQ or something similar

visual dirge
#

this should be a one-time thing (triggered by events) so i could also just change their id

lucid iron
#

What's the goal here blobcatgooglyblep

next plaza
rigid musk
#

If it's triggered via an event you could make the friendship reset to zero with the friendship event command, add in a conversation topic for however many days they'll be gone and use that to toggle their social page visibility with a dynamic token (I think)

visual dirge
lucid iron
#

You usually won't lose item because when you exit the menu (now that it is allowed) the equipmentmenu.helditem is either given back to inventory or dropped on the ground

#

Could drop it in water tho, which would be a little suck yes

uncut viper
#

you dont really want to make NPCs conditionally exist as it has potential for bad and weird multiplayer bugs

visual dirge
#

😢

#

thats what i was worried about

uncut viper
#

you hide them as necessary

#

you can hide them from the socialtab too with CharacterData.SocialTab