Variant
In the base game certain companions such as the frog have different color variants. With this model, you can explicitly define a sprite sheet, texture size, and optionally a color for mask. The trinket colorizer can be used to reroll the trinket variable, but you can also add other machine rules or shop entries for purpose of obtaining trinket in a specific variant.
Variants can have alternate variants, which are automatically rechecked whenever the player changes locations, or when an ability has ProcAltVariant
set.
Sample
{
"Action": "EditData",
"Target": "mushymato.TrinketTinker/Tinker",
"TargetField": [
"{{ModId}}_Sample"
],
"Entries": {
"Variants": [
// This block is the top level Variant
{
"Texture": "<texture asset name>",
"TextureExtra": "<additional texture asset name>",
"ColorMask": "<hex color or monogame color name>",
"Width": <int width>,
"Height": <int height>,
"TextureScale": <int scale>,
"ShadowScale": <int sclae>,
"NPC": "{{ModId}}_SampleNPC",
"Name": "[LocalizedText Strings/NPCNames:{{ModId}}_SampleNPC]",
"Portrait": "Portrait/{{ModId}}_SampleNPC",
"ShowBreathing": true|false,
"LightSource": {
// This block is LightSourceData
"Radius": <float radius(size)>,
"Index": <int base game light map texture index>,
"Texture": "<light map texture>",
"Color": "<hex color or monogame color name>",
},
"TrinketSpriteIndex": <int sprite index for trinket item when in this variant>,
"TrinketNameArguments": [
"<trinket name substitution 1>",
"<trinket name substitution 2>",
//...
],
"AttachedTAS": [
"<tas id>",
//...
]
"AltVariants": {
// These blocks are AltVariant
"<alt variant key>": {
"Texture": "<texture asset name>",
"TextureExtra": "<additional texture asset name>",
"ColorMask": "<hex color or monogame color name>",
"Width": <int width>,
"Height": <int height>,
"TextureScale": <float scale>,
"ShadowScale": <float scale>,
"NPC": "{{ModId}}_SampleNPC",
"Name": "[LocalizedText Strings/NPCNames:{{ModId}}_SampleNPC]",
"Portrait": "Portrait/{{ModId}}_SampleNPC",
"ShowBreathing": true|false,
"Condition": "<game state query>",
"Priority": <int priority>
},
// more alt variants...
}
}
]
}
}
Shared Fields
These fields are valid for both variant and alt variant.
Property | Type | Default | Notes |
---|---|---|---|
Texture |
string | required | Asset target of the loaded texture, should be a sprite sheet and needs to contain the relevant directional animation frames for the motion. |
TextureExtra |
string | null | Texture holding additional sprites for use in AnimClip. This allows you to keep trinket specific sprites on a separate asset, but conversely you cannot put basic directional animation sprites on this sheet, only anim clips. |
ColorMask |
string | null | Color to apply on draw, for use with grayscale sprites. Aside from RGB and hex values, monogame accepts named colors and this mod accepts special value "Prismatic" for an animated color cycle. |
Width |
int | 16 | Width of 1 sprite on the sprite sheet. |
Height |
int | 16 | Height of 1 sprite on the sprite sheet. |
TextureScale |
float | 4 | Texture draw scale, default is 4 like most things in the game. |
ShadowScale |
float | 3 | Size of the shadow to draw, 0 to disable shadow. |
Portrait |
string | null | A portrait texture for the Chatter ability, required to display a portrait and a name. |
NPC |
string | null | An NPC name (key of Data/Characters ) to associate this variant with, used for the Chatter ability. |
Name |
string | null | A display name for the Chatter ability, used if there's no real NPC . |
ShowBreathing |
bool | null (true) | If the NPC name is set and they have Breather=true along with a sprite size less than 16x32, apply the NPC "breathing" effect on this trinket companion. |
Top Level Variant
The top level variant can have all shared fields, as well as:
Property | Type | Default | Notes |
---|---|---|---|
LightSource |
LightSourceData |
null | If set, display a light source. This light source is only visible to the owner. |
TrinketSpriteIndex |
int | -1 | If set, alters the trinket item's sprite index to this. This is used to give the trinket different icon depending on the variant. |
TrinketNameArguments |
List<string> | null | If set, use these strings as the argument to the item name. |
AttachedTAS |
List<string> | null | If set, show temporary animated sprites associated with this companion that follow them around. |
AltVariants |
Dictionary<string, AltVariantData> | null | A dictionary of alternate variants. |
Alt Variant Only
The alt variant in AltVariants
can have all shared fields, as well as:
Property | Type | Default | Notes |
---|---|---|---|
Condition |
string | "FALSE" |
A game state query used to check if this alt variant should be selected. If you want to have an alt variant exclusively activate through ability with ProcAltVariant , use "FALSE" . |
Priority |
int | 0 | Sort priority of this variant, higher number have their conditions checked first. |
Note that not all shared fields are required in alt variant, and any not set field will simply fall back to the value found in top level.
An example: Change the companion's appearance during winter.
// assuming "{{ModId}}/Companion" and "{{ModId}}/Companion_Winter" are loaded
"Variants": [
{
"Texture": "{{ModId}}/Companion",
"Width": 16,
"Height": 32,
"AltVariants": {
"WINTER": {
// Since Width and Height is not set,
// The alt variant inherits 16x36 from the base variant.
"Texture": "{{ModId}}/Companion_Winter",
"Condition": "SEASON Winter"
}
}
}
],
Abilities can explicitly set a specific variant, which bypasses Condition
. If you want to make a special variant that only activates by ability proc, set the Condition
to "FALSE"
to exclude it from standard checks.
LightSourceData
Property | Type | Default | Notes |
---|---|---|---|
Radius |
float | 2 | Size of light source. |
Index |
int | 1 | Base game light source texture index. |
Texture |
string | 1 | Custom light map, must be loaded into game content. |
Color |
string | null | Light color name, accepts same values as ColorMask . |
Notes
- Usually, there's no need to have the same width and height in all variants, or the same scale. What does matter is having the right number of sprites for all your animation. That said Width and Height do come up when using FrameOverrides on AnimClip, which is discussed on that page.