|
|
[< Back to mechanic page](/Skills/Mechanics)
|
|
|
|
|
|
|
|
|
## Description
|
|
|
Play or stop an animation on a model.
|
|
|
|
|
|
|
|
|
## Attributes
|
|
|
| Attribute | Aliases | Description | Type | Default |
|
|
|
|-----------|---------------|------------------------------------------|---------|---------|
|
|
|
| modelid | m, mid, model | The model receiving a state change | String | |
|
|
|
| state | s | The animation being played | String | |
|
|
|
| remove | r | Is this mechanic used for removing state | Boolean | false |
|
|
|
|
|
|
#### When remove = false
|
|
|
|
|
|
| Attribute | Aliases | Description | Type | Default |
|
|
|
|-----------|---------|------------------------------------------------------------------------------------------------|-----------|---------|
|
|
|
| speed | sp | Speed multiplier of the state | Double | 1 |
|
|
|
| lerpin | li | Transition tick when the animation starts | Integer | 0 |
|
|
|
| lerpout | lo | Transition tick when the animation ends | Integer | 1 |
|
|
|
| force | f | Should the animation be played again even if it is already playing | Boolean | true |
|
|
|
| priority | p, pr | Set the priority of the animation.<br/>Only parsed when model is using Hybrid system | Integer | 1 |
|
|
|
| loop | l | Forced loop mode of the animation.<br>If not set, the mechanic use default animation loop mode | Loop Mode | |
|
|
|
| override | ov | Forced override mode of the animation.<br>If not set, the mechanic use default override mode | Boolean | |
|
|
|
|
|
|
#### When remove = true
|
|
|
|
|
|
| Attribute | Aliases | Description | Type | Default |
|
|
|
|------------|---------|--------------------------------------------------------------------------------------------------------|---------|---------|
|
|
|
| ignorelerp | i | Should the state be instantly removed without transition | Boolean | false |
|
|
|
| priority | p, pr | Target the animation of a particular priority<br/>Only parsed when model is using new animation system | Integer | 1 |
|
|
|
|
|
|
### Loop Attribute
|
|
|
|
|
|
This attribute type has 3 possible values, as described below:
|
|
|
|
|
|
| Value | Description |
|
|
|
|-------|--------------------------------------------------------------------------------------|
|
|
|
| ONCE | Cause the animation to only play once and exit the animation when it reaches the end |
|
|
|
| LOOP | Cause the animation to loop repeatedly until the animation is removed |
|
|
|
| HOLD | Cause the animation to hold on the last frame until the animation is removed |
|
|
|
|
|
|
|
|
|
## Examples
|
|
|
#### Playing an animation:
|
|
|
|
|
|
This will play an animation when the mob attacks.
|
|
|
The animation would take 3 ticks to transition in, and another 3 ticks to transition out.
|
|
|
|
|
|
```yaml
|
|
|
Skills:
|
|
|
# Play an attack animation that will only play once
|
|
|
- state{mid=kindletronjr;s=attack;li=3;lo=3} @self ~onAttack
|
|
|
```
|
|
|
|
|
|
> Note: In practice, this will only work if your animation has no wind up animation.
|
|
|
> If you want your animation to line up with your attack, you will have
|
|
|
> to [delay the attack](#syncing-animations-with-attacks).
|
|
|
---
|
|
|
|
|
|
#### Stopping an animation:
|
|
|
|
|
|
This stops an animation after a certain delay.
|
|
|
|
|
|
```yaml
|
|
|
Skills:
|
|
|
# Play a looping stun animation that won't stop automatically
|
|
|
- state{mid=kindletronjr;s=stunned;li=3;lo=3} @self
|
|
|
# Wait 4 seconds
|
|
|
- delay 80
|
|
|
# Remove the animation
|
|
|
- state{mid=kindletronjr;s=stunned;r=true} @self
|
|
|
```
|
|
|
|
|
|
---
|
|
|
|
|
|
#### Syncing animations with attacks:
|
|
|
|
|
|
As [described above](#playing-an-animation), if you play an attack animation with wind up using the attack trigger,
|
|
|
the animation would look delayed, i.e. "the damaging blow" of the animation is played after the target is damaged.
|
|
|
|
|
|
To fix this, we will have to:
|
|
|
|
|
|
* Cancel the attack event
|
|
|
* Play the animation
|
|
|
* Damage the target manually after a certain delay
|
|
|
|
|
|
```yaml
|
|
|
Skills:
|
|
|
- skill{s=[
|
|
|
- cancelevent
|
|
|
- skill{s=[
|
|
|
- state{s=attack} @self
|
|
|
- delay 5
|
|
|
- damage{a=2;type=ATTACK} @EIC{r=3;a=180;conditions=[ - isPlayer{} true ]}
|
|
|
];cooldown=1}
|
|
|
];sync=true} ~onAttack
|
|
|
```
|
|
|
|
|
|
---
|
|
|
|
|
|
#### Overlapping animations:
|
|
|
|
|
|
In some cases, you will want the model to play multiple animations at once. For example, a model holding up
|
|
|
its weapon while doing a charging animation.
|
|
|
|
|
|
By default, the Priority Animation System assign priority to each animation on model import.
|
|
|
Higher priority animations will automatically be applied later. For more information, check out
|
|
|
the [animation system guide](/Technical/Animation-Systems).
|
|
|
|
|
|
```yaml
|
|
|
Skills:
|
|
|
# Play the hold_axe animation, which has a lower priority
|
|
|
- state{mid=kindletronjr;s=hold_axe;li=3;lo=3} @self
|
|
|
# Play the charge animation, which has a higher priority
|
|
|
- state{mid=kindletronjr;s=charge;li=3;lo=3} @self
|
|
|
```
|
|
|
|
|
|
---
|
|
|
|
|
|
#### Overlapping animations using the Hybrid system:
|
|
|
|
|
|
The new Hybrid system no longer assign priority to each animation. Instead, priority is set
|
|
|
based on the `priority` attribute of this mechanic.
|
|
|
|
|
|
```yaml
|
|
|
Skills:
|
|
|
# Play the hold_axe animation, which we assign a lower priority
|
|
|
- state{mid=kindletronjr;s=hold_axe;li=3;lo=3;priority=1} @self
|
|
|
# Play the charge animation, which we assign a higher priority
|
|
|
- state{mid=kindletronjr;s=charge;li=3;lo=3;priority=2} @self
|
|
|
```
|
|
|
|
|
|
## Aliases
|
|
|
- [x] animation |
|
|
\ No newline at end of file |