---
description: ✔
---

# Modes

## <img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-Lznk57n45x4ZSDXdYRB%2F-LznkgOcVOr66y6E5DdS%2Fimage.png?alt=media&#x26;token=84700b3a-cfac-42b1-8ad6-052a1ab50e8f" alt="" data-size="line"> Check all Mode methods [here](../m-p-animal#mode-methods)

## 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.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fg1qwsIpwItFR7UkG3b8C%2Fimage.png?alt=media&#x26;token=7f56fb3a-52f1-40ee-beba-165540418379" alt="" width="563"><figcaption></figcaption></figure>

## **Adding the Mode to the Animal**

To add a new Mode, select the Mode Tab and hit the (+) button on the Mode List, and add an ID value

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-MjoxsSpHiW1ELyDpoEh%2F-MjoyAV4y4KKMzWSWI2J%2FW0rVmpg3iB.gif?alt=media\&token=3341b5db-ae44-49a0-8567-aeb048689691)

***

## **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. E.g You can have a Mode called **Magic Spells,** and all the abilities will be the different spells the character can do: Fireball, ice shards, etc.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F4rtJrlafPsxEQTlw43cp%2Fimage.png?alt=media&#x26;token=c7203780-c4ae-4d03-aa62-f8ed364b4b88" alt="" width="551"><figcaption></figcaption></figure>

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

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FHwvavHd6g1JEVDjz3d68%2Fimage.png?alt=media\&token=b32525ab-7efe-461f-b235-f436c5d31d58)

## Animator

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

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M4-yn_Tv6ypwAaIQE3R%2F-M4034rExVoera1OAXbW%2Fimage.png?alt=media\&token=7f1e83af-c377-4cc8-b219-a0f152700b60)

### Animator Parameters

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

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FiOzdS3SHLysp18dsgF2F%2Fimage.png?alt=media\&token=e51c0553-f6a9-4f8f-be94-0df0da9a89b9)

{% hint style="success" %}
The new Animal Controller from V3.3 onwards uses also the **\[ModeOn]** Trigger Animator Parameter.
{% endhint %}

## 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 +Ability$$&#x20;

### 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:

{% hint style="info" %}
Action Mode ID= 4. so all the Action Abilities Animations will be between 4000 and 5000.                                                                                                  &#x20;
{% endhint %}

![Use the \[ModeOn\] Trigger Parameter (If you are using the newer version of the Animator)](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FyMWnWAwRbgIE0AsvnGMx%2Fimage.png?alt=media\&token=68689bcc-3497-41cc-a23f-caa2e23e0847)

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

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F5fEQGQpMC1IdvVKAOCy5%2FUnity_e05A2ctVJ7.gif?alt=media\&token=321a56f5-5ffc-4b7e-9efe-4adf14472b8d)

### 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.    &#x20;

![Use the \[ModeOn\] Trigger Parameter (If you are using the newer version of the Animator)](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fum6vCNoJ08yyo55pXjUP%2Fimage.png?alt=media\&token=a4151d49-40a4-4f3d-8bab-63ef9084a15f)

## Loop Transition

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

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-MWV6P8RgJ6P7vyLUkzP%2F-MWVUSiQ5JCWg9z2S2Wf%2Fimage.png?alt=media\&token=b306af3b-924d-4928-9412-1dd06f4a09f8)

## Exit Transitions

For exiting a mode animation you will need 2 Exit Transition (**Interrupt)**  and (**Default Exit**)&#x20;

### 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.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fh4oCSNLXQYKnwK4qWBkL%2FUnity_e5CMmIPYIh.gif?alt=media&#x26;token=bdc541d7-a7fc-4d97-a216-80820aac9547" alt=""><figcaption></figcaption></figure>

**Has Exit Time = false** and the condition is  **Mode != ModeAbilityIndex**&#x20;

### Interrupt Transition (Old Version)

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

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F29kNr9sHHw8ZeYgzxnkS%2Fimage.png?alt=media\&token=2e1e1f3c-f609-46ee-8fea-8cb8acf63878)

### Exit Transition (Finish Animation)

&#x20; 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.

![Set your Exit time ](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M40LrebyFaBi3fG0SJq%2F-M40N3RyJ2lb1AjolyOa%2FUnity_eS5336Ph5T.png?alt=media\&token=09ab5a09-b2ac-495a-864c-06c9b6b5d534)

## 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.&#x20;

Check more info here:

{% content-ref url="modes/mode-behavior" %}
[mode-behavior](modes/mode-behavior)
{% endcontent-ref %}

## Activating a Mode

There are 4 ways to activate a mode.

### By Input (Mode)

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.&#x20;

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FYbmlm0t4D8uiUeNTZC6x%2Fimage.png?alt=media\&token=571cbb6a-2ebe-4a72-bc2a-3fa3eb1d8dac)

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

### By Input (Ability)

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:

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FNYFy1a4J1y1Tr2j85GPl%2FUnity_YHdOpZhLlX.gif?alt=media&#x26;token=f6d4d06b-349c-4531-956f-b0538f519e6e" alt="" width="474"><figcaption></figcaption></figure>

### By Code

You can use all Mode Methods inside the Animal Controller. Check them out [<mark style="background-color:yellow;">**here**</mark>](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/m-p-animal#mode-methods)

### By Zone

All modes can be played if the character enters a [**zone**](../../secondary-components/zones)**.**

### By Reaction

All modes can be played if the character uses a [**reaction**](../reactions)**.**

## Parameters

### Start with Mode

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M409GRiPBQHZELY7myb%2F-M409UqJC8iHiyg70htL%2Fimage.png?alt=media\&token=b2249f9f-d5fd-4eab-8533-faaf442fb214)

Plays a Mode at Start.

{% hint style="info" %}
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 a specific animation on a mode
{% endhint %}

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

$$ModeID*1000 +Ability$$&#x20;

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

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M4-du18wJ0GezjtpPAR%2F-M4-viRBf0hhNLYt-UI0%2FeH5cMqhZ45.gif?alt=media\&token=7e5f2c6f-9102-4d30-a257-dac29c6a14eb)

### Mode List Element

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.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FUL2chhwkyA0Xo1xzUpvZ%2Fimage.png?alt=media&#x26;token=27c9680c-ae8c-4648-a31f-cb56023995ea" alt=""><figcaption></figcaption></figure>

## General Tab

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FxOWXbDfspussCJDRlhfB%2Fimage.png?alt=media&#x26;token=61778956-5084-42fc-a0ef-dfeba73f5ab1" alt=""><figcaption></figcaption></figure>

### Enable Toggle

Enable/Disable the Mode

### Input

Store the Input needed to Activate the Mode. It matches the Input from the [Malbers/MInput ](../malbers-input)component&#x20;

### Ignore Lower

If a Mode with **lower** priority is playing, it will interrupt it and play this mode instead.&#x20;

### 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.&#x20;

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

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fac1kls7MINrPQNRrEbov%2Fimage.png?alt=media&#x26;token=4be26d6c-b12d-43a8-a310-e069e4fdd100" alt=""><figcaption></figcaption></figure>

### 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

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FzKWyD0olg0od7OKFKqjp%2Fimage.png?alt=media&#x26;token=ab80f111-a77d-43e3-b34a-abef3c41fa0c" alt=""><figcaption></figcaption></figure>

### &#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FhcyfZgCdEhkatK1jX7JW%2Fimage.png?alt=media&#x26;token=573d8032-7e9d-4477-8656-5cec34790cfb" alt=""><figcaption></figcaption></figure>

## Events Tab

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FzNQqqln0NkzwhjL7KvPK%2Fimage.png?alt=media&#x26;token=0f52b970-ee00-4eec-ab4f-4757ce17326a" alt=""><figcaption></figcaption></figure>

### 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

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Ffp3FuXg7VAGUdgHlEnFt%2Fimage.png?alt=media&#x26;token=cdd2cd71-a383-456c-8bf0-fe66765f13d6" alt=""><figcaption></figcaption></figure>

## Abilities Override

You can override any Ability to get their own [**Status**](#status)**,** [**Affect States**](#affect)**,** and [**On Enter**](#on-enter) **/** [**On Exit** ](#on-exit)Events. Simply click on the ability to show further details at the bottom.&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FncmPuygiQDogFhEt4uFM%2Fimage.png?alt=media&#x26;token=de0fa297-1ab1-4417-b9bf-ba2c37566447" alt=""><figcaption></figcaption></figure>

## 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 is 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

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F1V2kVb56bHPvlmEDvv2J%2Fimage.png?alt=media&#x26;token=49826a8d-9f0a-4d37-9f1e-8fa003db14f3" alt=""><figcaption></figcaption></figure>

* **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.

    <figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FER45YHPDrdu3HiqbV5zI%2Fimage.png?alt=media&#x26;token=78f5a914-b898-44ba-9284-d4e643b9ddf2" alt=""><figcaption></figcaption></figure>

    * **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.

    <figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FO3OAJo7zQxfT7r3EcZRB%2Fimage.png?alt=media&#x26;token=92dec790-5fe0-41f7-a66b-6d36128bb421" alt=""><figcaption></figcaption></figure>
* **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&#x20;

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.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F4k7CaQHW3AqFLwRx2IxX%2Fimage.png?alt=media&#x26;token=ad962183-47ac-4f26-a7a1-e13fb60d7147" alt=""><figcaption></figcaption></figure>

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. &#x20;

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

### Affect Stances &#x20;

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

E.g. You can exclude doing attacks if the Wounded stance is active.&#x20;

### &#x20;Can Transition from Ability

Modes can transitions from other abilities inside the same mode.&#x20;

E.g Sit can transition to Lie to Sleep:

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FBNneZlEhXbg6JjMGmiqU%2Fimage.png?alt=media&#x26;token=4f10df7b-35b7-471a-a3c8-0133a6d59cc2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FLuT1od70ptL2yfKOzwEU%2FUnity_YuVs3Y3WH7.gif?alt=media&#x26;token=3036d9c6-e304-412f-82a7-8bb2897e10c7" alt=""><figcaption></figcaption></figure>



### Copy Limits

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



## Ability Tab - Audio

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FVca3pOcW3VPI8Rbm1OLz%2Fimage.png?alt=media&#x26;token=fd8eef31-0915-4843-abd3-3efa2f1801f2" alt=""><figcaption></figcaption></figure>

### 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

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fn32itSliizYWzhutAIQD%2Fimage.png?alt=media&#x26;token=b508ba74-99b2-41f1-a5a1-7a5e652b6277" alt=""><figcaption></figcaption></figure>

### On Ability Enter

Invokes when this specific ability starts

### On Ability Exit

Invokes when this specific ability exits











