๐ŸŸฉModes

โœ”

Overview

Modes are groups of Animations that can be played on top of the State animations. for example the animal can Attack while running, dodge while flying, get hit while falling, etc.

Adding the Mode to the Animal

To add a new Mode to the Animal you simply go to the animal, select the Mode Tab and hit the (+) button on the Mode List.

Abilities

These are the list of animations inside a mode, which are the actual animations to activate on the animal. A Mode is the group that puts together those animations.

Now that you have a mode added you need to add the Ability or Abilities that will play in that Mode. By default when you add a new Mode a new Ability will be added:

You should rename those abilities to the animations you want to play on the animator. The name does not need to match.

Animator

All the Modes are set on the Mode Layer on the Animal Animator Controller:

Animator Parameters

The Mode parameter play modes on the Animator Controller, along with the ModeStatus parameter.

The new Animal Controller from V3.3 onwards uses also the [ModeOn] Trigger Animator Parameter.

Enter Transition

To set properly the Mode Parameters for the Animator Controller the value combined on a single integer value.

E.g.: Mode [Action = 4] and Ability [Born = 14] combined is equal 4014 using this formula:

ModeIDโˆ—1000+AbilityModeID*1000 +Ability

Setting the Transition to an [Animator State Machine]

To set an Entering Transition condition for a mode and its animations, the Mode value needs to be set in the correct range for the mode you want. Eg Action:

Action Mode ID= 4. so all the Action Abilities Animations will be between 4000 and 5000.

OR

Inside the Animator State Machine, all the internal conditions will use the formula:Mode=ModeIDโˆ—1000+Ability.Mode =ModeID *1000+Ability.

Setting the Transition to an [Animator State]

If you want to add the Transition directly to an Animator State, the condition to play the Mode Abilities is the combined Mode-Ability formula.

OR

Loop Transition

Some Mode Animations can loop to themselves, The condition Transition is ModeStatus = -1:

Exit Transitions

For exiting a mode animation you will need 2 Exit Transition (Interrupt) and (Default Exit)

Interrupt Transition (New Version)

The new Interrupt Transition version uses the Mode as exit value.

Its just like the Enter Transition but the condition to exit is Not Equal.

Has Exit Time = false and the condition is Mode != ModeAbilityIndex

Interrupt Transition (Old Version)

  • Has Exit Time = false and the Condition is ModeStatus = -2 (This is the Old way)

Exit Transition (Finish Animation)

Exiting the Mode. Where Has Exit Time = true and there are no Conditions. Set your Exit time and Transition Duration values according to your needs.

Mode Behaviour

All the Animations need to have the Mode Behaviour attached. This allows the Animal Controller to know when a Mode Starts and Stops playing.

The Mode behavior must have the same Mode ID as its animations.

A Mode Ability can have multiple Animations:

For example, Sleep has Sleep Enter, Sleep, Sleep Exit. In this case, the Mode Behaviour is Set on the Enter Sleep with the Enter Mode = true, No Behaviour in Sleep, and the Exit Sleep with the Exit Mode = true.

Here's a tutorial on how to create complex modes: https://youtu.be/qtPKEzube1c

Activating a Mode

There are 4 ways to activate a mode.

By Input

All modes have an Input Parameter that you can connect to the Input Component.

Create an Input on the Malbers Input or MInput Component and use the same name as the Input Parameter.

So when you press the Input designated to a Mode. It will play a random Animation Ability from that mode.

If you want to play a specific Ability Inside a Mode. Each Ability has an Input Parameter that can be also connected to the Malbers Input Component:

By Code

You can use all Mode Methods inside the Animal Controller. Check them out here

By Zone

All modes can be played if the character enters a zone.

By Reaction

All modes can be played if the character uses a reaction.

Parameters

Start with Mode

Plays a Mode at Start.

You can set a ModeID to start with Mode and a Random animation of that mode or you can set a Mode and Ability combined to start with an specific animation on a mode

E.g.: Mode [Action = 4] and Ability [Born = 14] combined is equal 4014 using this formula:

ModeIDโˆ—1000+AbilityModeID*1000 +Ability

So setting Start with Mode = 4014 on the Golems will play the Born Animations on Start

Mode List

When selecting a mode from the list will show that mode's properties. On the Mode Row, you will see the Active value, ID, and Priority.

General Tab

Enable Toggle

Enable/Disable the Mode

Input

Store the Input needed to Activate the Mode. It matches the Input from the Malbers/MInput component

Ignore Lower

If a Mode with lower priority is playing, it will interrupt it and play this mode instead.

Has Cool Down

Elapsed time to be able to play the Mode Again. If it's set to 0, then the Mode cannot be interrupted until it finishes the Animation.

Allow Rotation

Allows turning the animal while is in the Mode

Allow Movement

Allows movement while the animal while is in the Mode when the mode is additive.

E.g. The horse can play the Damage Mode while running by moving only the head.

Modifier

These are snipped of code that can be used to change the behavior of a mode

Source

Audio Source to play all the mode sounds

Abilities Tab

Active Index

Current Active Ability Index of a mode. When is set to 0, it won't play any Ability. If is set to -99 it will play a random ability from the list.

Default Index

When a mode animation finishes playing, the Active Index will change to this value.

Reset to Default [R]

If enabled, when Exiting the Mode the Active Index will reset to the Default Index value

Events Tab

On Enter

Invoked when the Animal enters a Mode

On Exit

Invoked when the Animal exits a Mode

On Active Ability Index Changed

Invoked when the active ability changes

Abilities Override

You can override any Ability to get their own Status, Affect States, and On Enter / On Exit Events. Simply click on the ability to show further details at the bottom.

Ability Tab - General

Active

Enable/Disable the Ability

Input

Unique Input specifically for this ability

Modifier

Local mode modifier to add to the ability. E.g. you can add directional damage abilities that play unique animations here

Additive Position

Multiplier added to the additive position when the animation is playing. You can increase or remove completely the RootMotion and Additive Position values.

Ignore Grounded

Can ignore if the animal is grounded. Useful for modes that move on the Y Axis. E.g You can use it if you have attacks that will make the animal leave the ground.

Ignore Gravity

Can ignore gravity. Useful if the mode is playing in the air and you dont need gravity affecting the animation.

Persistent

Whilst playing the ability, this will stop any other states attempting to play on top of the mode until it's finished

Ability Tab - Status

Status

  • PlayOne Time: The mode will play until it finishes ability animation.

  • Charged or Hold Input Down: The mode will play until the Input is released, or the charge has finished.

    • Charge Time: Time needed to complete the charge. if is set to zero then the Charge feature will be ignored

    • Charge Value: Multiplier applied to the charge curve.

    • Charge Curve: Curve values applied to the charge value stored in 'ModePower'

    • Release: If the Charge time has passed, then the mode will finish.

  • Active by Time: The Mode will be playing for a given amount of seconds.

  • Toggle: The mode will play when the Input is Down, and it will stop playing when the Input is Down again

  • Forever: The mode will play forever. To stop it call Animal.ModeStop().

Ability Tab - Limits

Affect States

You can either Include or Exclude certain states that this ability is allowed to be played on. E.g. you can allow the character to perform a "Shake Hands" when on the Idle state or the Locomotion state etc.

If is set to Include: the Mode can be activated if the Animal is only on any of the states on the Affect State List.

If is set to Exclude: the Mode cannot be activated if the Animal is on any of the states on the Affect State List.

Affect Stances

You can either Include or Exclude certain stances that this ability is allowed to be played on.

E.g. You can exclude doing attacks if the Wounded stance is active.

Can Transition from Ability

Modes can transitions from other abilities inside the same mode.

E.g Sit can transition to Lie to Sleep:

Copy Limits

Allows you to copy the limits to all other abilities if required.

Ability Tab - Audio

Audio Clip

Which audio clip should be played when the ability is played?

Audio Source

What source should the clip be played from?

Clip Delay

Should there be a delay when playing the clip? If not, set to 0 by default.

Stop Audio

A toggle to allow you to stop the audio on ability end. By default this is set to ON

Ability Tab - Events

On Ability Enter

Invokes when this specific ability starts

On Ability Exit

Invokes when this specific ability exits

Last updated