Animating Moves - Thutmose/Pokecube GitHub Wiki
How to help me animate moves.
Preamble:
Pokecube has a system for adding preset move animations to each move, by default, most moves have no animation at all. If animations are not hardcoded for moves, they can be added by the moves.json used to load in the moves themselves. The new move animation system allows assigining multiple presets to the same move, and have them run in a specified order, for specified lengths of time. These animations can be definined in a seperate animations.json, which can then be merged into the moves.json, and updated in game via a command. This allows users to help with the animation process, by making this animations.json, and then sending it in for addition to the default moves.json.
Basic Setup:
- Place animations.json (found here) in config/pokecube/database.
- Run Minecraft.
- Once in world, you can edit the animations in animations.json (instructions below) and then run the command: "/pokecube reloadAnimations moves animations" and it will reload them, this command can by auto completed by typing /pokecube re and then pressing tab, I will refer to this entire command as the Reload Command
- Tell a pokemob to use the move you edited, and see if the animation is what you want.
- Repeat for as many moves as you want to animate.
Editing the json with AnimationEditor
Getting started
Follow the above instructions, then place AnimationEditor.jar into config/pokecube/database, then run it.
This should result in a gui like the following:
- The Apply button will save the animations.json, after pressing it, issue the Reload Command ingame, and the changes should be applied.
- The Add button will add a new animation component to the currently selected move.
- The Remove button will remove the currently selected animation component from the selected move.
The two dropdown lists following are as follows:
- The Selected move - This is the move being edited.
- The Selected animation component - These are stored in a random order, their execution is based on start and duration.
After clicking add, or if you select a move which already has animation components, the gui will look like this:
The following options are then available:
- Preset - this is a list of presets, they are discussed more in detail below, this is a drop-down list of options.
- Duration - how many ticks this component runs.
- Start Tick - when this component starts ticking.
- Particle - the particle type spawned, this is a drop-down list of options.
- Colour - colour of the particle (if applicable, not all can be coloured), this is another drop-down list.
- Density - corresponds to number of particles, actual functionality varies with preset.
- Scale - corresponds to size of particle spread, functionality varies with preset.
- Reverse - determines direction the particles are applied, functionality varies with preset.
- Particle Lifetime - how many ticks the particles last for.
- Absolute - corresponds to particle spread, when they are applied to a target, if this is blank or "false", it scales with target size, "true" and it does not scale with target size.
- Functions - advanced options for the preset, functionality varies with preset.
- End - if this is "true" then the move effects (damage, terrain, etc) will be applied when this component finishes running.
Preset-specific functionality of options (by preset)
thunder
The none of the options besides Start Tick and End will apply to the thunder animation. it spawns a lightning bolt at the target destination, and will result in the move applying onEntityStruckByLightning (ie pigs -> pigmen, charge creepers, etc)
throw
Throw is only affected by Colour and Scale.
pont/pons
These two are affected by Scale, Colour, Density, Particle and Particle Lifetime.
- Scale affects how much spread out around the affected area the particles are.
- Density values less than 1 will result in smaller numbers of particles, greater than 1 have no effect.
flow
flow is affected by Scale, Density, Functions, Particle, Particle Lifetime and Colour.
- Scale affects how large the spread of particles gets at the destination.
- Density can vary above 0, and will increase the number of particles in the flow accordingly, if this is too large, it will cause low fps.
- Function should take an numeric value from 0 to 360, and when given a value, will make the spread Flat, but rotated by the value.
beam
beam is affected by Particle, Particle Life and Colour.
powder
powder is affected by Scale, Density, Particle, Particle Life and Colour.
- Scale affects how wide spread the particles are. it can have any numeric value above 0.
- Density affects how many particles are spawned in the powder, it can also have any value above 0, but should not be made too large, else it will cause low fps.
cylFunc
cylFunc is affected by Density, Functions, Particle, Particle Life and Colour.
- Density values below 1 will reduce the number of particles spawned, above 1 will currently have no effect.
- Functions is the primary use of this preset.
Functions.
cylFunc takes a set of two parametric, cylindrical coordinate expressions for the function, there the parameter is the distance along from the source to the target. they are to be seperated by a ,
and should take z
as their only variable. The first expression is used for the radial component, and the second is used for the angular component. An example of a valid function would be: (z^2-z)*2,z*6.3
which results in the following:
sphFunc
sphFunc is affected by Density, Scale, Absolute, Reverse, Functions, Particle, Particle Life and Colour.
- Density values below 1 will increase the number of particles, Density should probably not be set lower than about 0.01 or so.
- Reverse, if "true", will make the origin of the below functions be on the user, otherwise it will be on the target.
- Scale can be used to augment the below functions and simply spread out the particles more.
- Functions is the primary use of this preset.
Functions.
sphFunc takes a set of 3 parametric, spherical coordinate expressions, using t
for time as the parameter. The time is the number of ticks given, with a sub increment based on the value of Density, which is why lower values of Density result in more particles. These expressions should be in the following order: radius, phi, theta, where those values represent the standard values used in Physics for spherical coordinates. Here is an example of a valid function: 2*rand(),rand()*6.3,(0.5-rand())*(3.2)
This results in particles appearing at a random radius, with any random value of theta, and any random value of phi, and any random value of theta, phi ranges from 0 to 2pi, theta ranges from 0 to pi, but also works from -pi/2 to pi/2, and r can have any value.
cartFunc
cartFunc is functionally very similar to sphFunc, however the parametric expressions instead represent x, y and z coordinates, all of the options have the same effect on cartFunc as they have on sphFunc.
Manually editing the json.
Animation Presets and Formatting.
Basic formatting
Here is a sample animation, it is for absorb, and it makes some particles appear on the target (about 5 of them)
{
"name": "chargebeam",
"animations": [
{
"preset": "beam",
"duration": "5",
"starttick": "0"
}
]
}
"name" is the same name which occurs in the moves.json, it is the move name, lowercased with all special characters and spaces removed. "animations" is a list of animations to run for this move.
The animation consists of 3 parts, a "preset", a "duration" and a "starttick". The "duration" is how many ticks the animation will run for, and "starttick" is how many ticks after the move is used, that the animation will start running.
"preset" is what defines what the animation will actually do. The following are valid options:
- pont - a few particles spawn around the target.
- pons - a few particles spawn around the user.
- flow - particles randomly dispersed fly towards the target
- beam - beam of particles sent towards the target.
- powder - wider spread of more particles around the target.
- throw - a large particle is thrown at the target.
- thunder - lightning effect hits the target.
These then have sub options available to change their properties. Here is an example:
{
"name": "bubblebeam",
"animations": [
{
"preset": "beam:pbubble:d0.5",
"duration": "5",
"starttick": "0"
}
]
}
after the initial particle type, extra options are seperated by ':' and start with a specific character based on what they are for. The following are the standard characters used, note that not all animations will use them all:
- p - particle type, value options are any vanilla particle name, "misc", "aurora", "powder", "leaf".
- d - determines the number of particles made, functionality differs for the presets.
- w - determines the general spread or size of the particles, functionality differs for the presets.
- f - determines if the particle spread is 2d or not, currently only supported for "flow".
- r - determines direction particles go, currently not implemented.
- c - the colour of the particles, use the number corresponding to a damage value of dye for this.
Having multiple animations for a move:
Here is an example of a move with multiple animations assigned to it:
{
"name": "icebeam",
"animations": [
{
"preset": "beam",
"duration": "5",
"starttick": "0"
},
{
"preset": "thunder",
"duration": "0",
"starttick": "5"
}
]
}
This results in the following:
The first preset is "beam", and it is set for duration of 5, and start of 0. This means it runs for about 0.25 seconds as a beam, the fact that no colour is assigned makes it use the colour appropriate to the type of the move (ice type in this case)
The second preset is "thunder", it is set for duration of 0 (only makes 1 thunderbolt) and start of 5. the start of 5 makes it run right as the beam is finishing. Note that the move effect is applied at the end of the animation, so if you make the animations too long, targets might be able to get out of the way before they are affected.
Here is an example of changing to a different particle for the beam:
{
"name": "icebeam",
"animations": [
{
"preset": "beam:psweepAttack",
"duration": "5",
"starttick": "0"
},
{
"preset": "thunder",
"duration": "0",
"starttick": "5"
}
]
}
It results in this: