Coding Help Dynamic appearances (EditData action) changing custom NPC display name and spawn point

spice_cabinet

Greenhorn
Hello there!
I'm a relatively new modder, and I'm making a custom NPC. In a previous post, I was asking about how to get seasonal portraits to work. Good news: I figured it out! I am now using Dynamic Appearances instead of EditImage, which I believe is better for game performance, anyway. Bad news: some new problems have arisen.
My NPC Andy now has seasonal portraits and sprites that activate when they're supposed to, but his display name has changed from "Andy" to "spice_cabinet.Andy_Andy" which is "{{ModId}}_Andy" in the code. Additionally, his spawn point has moved from the Bus Stop (where I have him placed for testing purposes) to the middle of Town Square. This problems vanish when I remove the Appearance code, so I'm convinced that it's the thing that is causing issues. Here is the said code, added to his content.json file:

{
///Appearance Loads
"Action": "Load",
"Target": "Characters/{{ModId}}_Andy_Spring, Portraits/{{ModId}}_Andy_Spring, Characters/{{ModId}}_Andy_Summer, Portraits/{{ModId}}_Andy_Summer, Characters/{{ModId}}_Andy_Fall, Portraits/{{ModId}}_Andy_Fall, Characters/{{ModId}}_Andy_Winter, Portraits/{{ModId}}_Andy_Winter",
"FromFile": "assets/{{Target}}.png"
},
{
///Appearance Data
"Action": "EditData",
"Target": "Data/Characters",
"Entries": {
"{{ModId}}_Andy": {

"Appearance": [
{
"Id": "Spring",
"Season": "spring",
"Portrait": "Portraits/{{ModId}}_Andy_Spring",
"Sprite": "Characters/{{ModId}}_Andy_Spring",
"Precedence": -120
},
{
"Id": "Summer",
"Season": "summer",
"Portrait": "Portraits/{{ModId}}_Andy_Summer",
"Sprite": "Characters/{{ModId}}_Andy_Summer",
"Precedence": -120
},
{
"Id": "Fall",
"Season": "fall",
"Portrait": "Portraits/{{ModId}}_Andy_Fall",
"Sprite": "Characters/{{ModId}}_Andy_Fall",
"Precedence": -120
},
{
"Id": "Winter",
"Season": "winter",
"Portrait": "Portraits/{{ModId}}_Andy_Winter",
"Sprite": "Characters/{{ModId}}_Andy_Winter",
"Precedence": -120
}
]
}
}
}

My guess is that somehow, this code is either replacing or editing Andy's original Disposition, but I have no idea how to go about fixing that. I tried editing the Disposition and putting him in a different spot at the Bus Stop, but he still spawns in Town Square.
To fix the display name issue, I attempted to remove "{{ModId}}_" from the top of the "Entries" section. This fixed his name, but caused the seasonal portraits to stop working. His spawn point also changed from Town Square to hovering over Pelican Town's playground, but then also sometimes the Bus Stop, where I put him in his Disposition. I tried removing "{{ModId}}_" from every other instance in the Appearance sections of the code, but this caused SMAPI to look for the files in Stardew's Content folder, instead of the Mods folder.
There's another smaller issue caused by that: I have to name all the PNGs (portraits and sprites) "{{ModId}}_Andy_{{season}}" (i.e. "spice_cabinet.Andy_Andy_Spring.PNG") to get the code to work. I'm not sure if this is contributing to the issues or if it's just an annoyance, so I figured I'd include it here. To cover my bases, I have two copies of the PNGs in the same folder, one labeled "{{ModId}}_Andy_{{season}}" and another labeled "Andy_{{season}}" (i.e. "spice_cabinet.Andy_Andy_Fall.PNG" and "Andy_Fall.PNG") to make sure that I'm able to mess around with the naming conventions in the code without worrying that the file doesn't exist.
With the code as it is above, I get no error messages from SMAPI. I am using Format 2.4.0 for Content Patcher. I've included the Disposition code below if that helps anyone.

{
///Disposition
"Action": "EditData",
"Target": "Data/Characters",
"Entries": {
"{{ModId}}_Andy": {
"DisplayName": "Andy",
"BirthSeason": "Summer",
"BirthDay": "7",
"HomeRegion": "Town",
"Gender": "Male",
"Age": "Adult",
"Manner": "Polite",
"SocialAnxiety": "Shy",
"Optimism": "Positive",
"CanBeRomanced": true,
"Home": [
{
"Id": "Default",
"Location": "BusStop",
"Tile": {
"X": 20,
"Y": 5
},
"Direction": "Down"
}
]
}
}
}

To recap, here are my questions:
- Why is he spawning in Town Square, and how do I fix that?
- Why did his display name change, what do I do to fix that?

Once again, thank you for any help you can give me!! I really appreciate it.
 

solarbronze

Greenhorn
I am looking for the same answer for how to make an NPC spawn in a different place each morning so I'm commenting to get notified of an answer. Best of luck with the mod!
 
Top