Custom Crowd Animations - elfuun1/FlowerDanceFix GitHub Wiki
Flower Dance Fix can insert custom animations into the flower dance event commands. These custom animations are performed by the NPCs spectating the dance. Datable NPCs that can be selected for the dance, but are not selected to dance, are capable of performing animations during the dance like any other NPC.
Main Event (FDF) Event Code Breakdown
- pause 500/playMusic none/pause 500/globalFade/viewport -1000 -1000/loadActors MainEvent/warp farmer1 5 21/warp farmer2 11 21/warp farmer3 23 21/warp farmer4 12 21/faceDirection farmer1 2/faceDirection farmer3 2/faceDirection farmer4 2/faceDirection farmer 2
- Generated Warp Block
- Generated Show-Frame Block
- /viewport 14 25 clamp true/pause 2000/playMusic FlowerDance/pause 600
- Generated Animation Block 1
- /pause 9600
- Generated Animation Block 2
- Generated Male-Line Position Offset Block
- Generated Animation Block 3
- /pause 7600
- Generated Stop-Animation Block
- /pause 3000/globalFade/viewport -1000 -1000/message "That was fun! Time to go home..."/waitForOtherPlayers festivalEnd/end
Event code can be inserted by content pack at the bolded points- Generated Warp Block, Generated Show-Frame Block, Generated Animation Block 1, Generated Animation Block 2, Generated Animation Block 3, and Generated Stop-Animation Block.
Event code can be inserted by content pack at the bolded "blocks". These "blocks" contain FDF-generated event code programming the the following actions:
- Generated Warp Block - warps NPCs into different locations than originally programmed by their Setup Main Event positions. Is used to warp selected NPCs to the dance lines. Can be used to warp spectating NPCs around the perimeter of the dance to position them for custom animations. This occurs after the fade to black after talking to Lewis to begin the dance, but before the dance stage comes back into view.
- Generated Show-Frame Block - sets NPCs to display a specific static frame. Can be from the original vanilla spritesheet, or a custom FDF spritesheet. Dancers in the female dance line stand up straight with their arms at their side (Vanilla frame 40 / FDF frame 0). Dancers in the male dance line stand up straight with their arms at their side (Vanilla frame 44 / FDF frame 8). All audience members stay in the position and facing the direction assigned in their Setup Main Event entry. This occurs after the fade to black after talking to Lewis to begin the dance, but before the dance stage comes back into view.
- Generated Animation Block 1 - NPCs in the female dance line bob and swish their skirts in time to the music (Vanilla frames 43 41 43 42 / FDF frames 3 1 3 2). NPCs in the male dance line bob up and down in time to the music (Vanilla frames 44 45 / FDF frames 8 9). The audience does nothing. Custom animation for the audience can be inserted here, including custom animations for unselected datable NPCs, which will be over-written if the NPC is selected to dance.
- Generated Animation Block 2 - NPCs in the female dance line walk in-place in time to the music (Vanilla frames 44 45 / FDF frames 4 5). NPCs in the male dance line walk towards the female dance line in time to the music (Vanilla frames 46 47 / FDF frames 10 11). The audience does nothing. Custom animation for the audience can be inserted here, including custom animations for unselected datable NPCs, which will be over-written if the NPC is selected to dance.
- Generated Animation Block 3 - NPCs in the female dance wave their arms in the air in time to the music (Vanilla frames 46 47 / FDF frames 6 7). NPCs in the male dance line bob up and down in time to the music (Vanilla frames 44 45 / FDF frames 8 9). The audience does nothing. Custom animation for the audience can be inserted here, including custom animations for unselected datable NPCs, which will be over-written if the NPC is selected to dance.
- Generated Stop-Animation Block - All NPCs stop animating and display a specific static frame. Dancers in the female dance line stand up straight with their arms in the air (Vanilla frame 46 / FDF frame 6). Dancers in the male dance line stand up straight with their arms at their side (Vanilla frame 40 / FDF frame 8). Custom animation for the audience can stopped here and show a specific frame, including custom animations for unselected datable NPCs, which will be over-written if the NPC is selected to dance.
Creating Crowd Animations
Animations are read by FDF from the animations.json
file provided by modpacks, which determine the different components for the animation sequences performed by the NPCs. This json file can contain multiple animations sequences. Each animation sequence uses the following properties:
Property | Input Type | Description |
---|---|---|
NPC |
string | Name of the NPC being animated. |
Title |
string | Title of the animation sequence. Used in config files. |
Warp |
WIP | |
ShowFrame |
int | Static frame shown during the event fade-in, before music starts. |
AnimationBlock1 |
First animation that plays during the flower dance. | |
AnimationBlock2 |
Second animation that plays during the flower dance. | |
AnimationBlock3 |
Third animation that plays during the flower dance. | |
StopAnimationFrame |
int | Static frame shown after the flower dance finishes, until the event fade-out |
The various animation blocks have additional properties:
Property | Input Type | Description |
---|---|---|
AnimationFrames |
int[] | An array of the animation frames in order. |
Duration |
int | The duration of the animation, in ticks. |
Loop |
bool | Causes the animation to loop at the end of it's duration. |
Flip |
bool | Causes the frames to be mirrored along the vertical axis. |
Example Animation.json
This is a sample animation sequence bundled with FDF that causes Jas and Vincent to dance with each other in the audience of the flower dance.
[
{
"NPC": "Jas",
"Title": "Dance with Vincent",
"ShowFrame": 0,
"AnimationBlock1": {
"AnimationFrames": [3, 1, 3, 2],
"Duration": "",
"Loop": true,
"Flip": false
},
"AnimationBlock2": {
"AnimationFrames": [6, 7],
"Duration": "",
"Loop": true,
"Flip": false
},
"AnimationBlock3": {
"AnimationFrames": [3, 1, 3, 2],
"Duration": "",
"Loop": true,
"Flip": false
},
"StopAnimationFrame": 0
},
{
"NPC": "Vincent",
"Title": "Dance with Jas",
"ShowFrame": 0,
"AnimationBlock1": {
"AnimationFrames": [0, 1],
"Duration": "",
"Loop": true,
"Flip": false
},
"AnimationBlock2": {
"AnimationFrames": [2, 3],
"Duration": "",
"Loop": true,
"Flip": false
},
"AnimationBlock3": {
"AnimationFrames": [0, 1],
"Duration": "",
"Loop": true,
"Flip": false
},
"StopAnimationFrame": 0
}
]