StardewModders / mod-ideas

Submit ideas for mods to create, or find your next mod project!
89 stars 5 forks source link

NPC Custom Animations #1167

Open itsbenter opened 7 months ago

itsbenter commented 7 months ago

Allow NPC use non-default sprite for animation in their schedule (like Willy fishing and Clint hammering).

This mod could read data added by Content Patcher, similar to how it is done by NPC Map Locations. A thought on a possible way to arrange the Content Patcher side of things.

{
    "Action": "EditData",
    "Target": "Mods/NPCCustomAnimations",
    "Entries": {
        "ItsBenterJack": { //NPC Internal Name
            "ItsBenterJack_ChopWood": { //Unique string ID, 
                "AnimationName": "ItsBenterJack_ChopWood", //Animation as listed in Data/animationDescriptions
                "SpriteDimensionX": "32", //For simplicity has to be in multiples of 16
                "SpriteDimensionY": "32", //For simplicity has to be in multiples of 16
            },
             "ItsBenterJack_Fishing": { //Unique string ID, 
                "AnimationName": "ItsBenterJack_Fishing", //Animation as listed in Data/animationDescriptions
                "SpriteDimensionX": "16", //For simplicity has to be in multiples of 16
                "SpriteDimensionY": "32", //For simplicity has to be in multiples of 16
            },
        }
    }
}

This NPC, ItsBenterJack has two animations. ItsBenterJack_ChopWood uses 32x32 pixels and ItsBenterJack_Fishing uses 16x32 pixels. Content pack creator has to set the characters sprites to accommodate the dimension of animation they want to use.

Harmony is probably necessary. It seems there is a need to reset back the animation. This should be helpful as a start to see what's necessary when it's done purely on C#.