🟩Modes
✔
Last updated
✔
Last updated
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.
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.
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.
All the Modes are set on the Mode Layer on the Animal Animator Controller:
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.
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:
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
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
Some Mode Animations can loop to themselves, The condition Transition is ModeStatus = -1:
For exiting a mode animation you will need 2 Exit Transition (Interrupt) and (Default Exit)
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
Has Exit Time = false and the Condition is ModeStatus = -2 (This is the Old way)
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.
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
There are 4 ways to activate a 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.
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:
You can use all Mode Methods inside the Animal Controller. Check them out here
All modes can be played if the character enters a zone.
All modes can be played if the character uses a reaction.
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:
So setting Start with Mode = 4014 on the Golems will play the Born Animations on Start
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.
Enable/Disable the Mode
Store the Input needed to Activate the Mode. It matches the Input from the Malbers/MInput component
If a Mode with lower priority is playing, it will interrupt it and play this mode instead.
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.
Allows turning the animal while is in the Mode
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.
These are snipped of code that can be used to change the behavior of a mode
Audio Source to play all the mode sounds
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.
When a mode animation finishes playing, the Active Index will change to this value.
If enabled, when Exiting the Mode the Active Index will reset to the Default Index value
Invoked when the Animal enters a Mode
Invoked when the Animal exits a Mode
Invoked when the active ability changes
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.
Enable/Disable the Ability
Unique Input specifically for this ability
Local mode modifier to add to the ability. E.g. you can add directional damage abilities that play unique animations here
Multiplier added to the additive position when the animation is playing. You can increase or remove completely the RootMotion and Additive Position values.
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.
Can ignore gravity. Useful if the mode is playing in the air and you dont need gravity affecting the animation.
Whilst playing the ability, this will stop any other states attempting to play on top of the mode until it's finished
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().
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.
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.
Modes can transitions from other abilities inside the same mode.
E.g Sit can transition to Lie to Sleep:
Allows you to copy the limits to all other abilities if required.
Which audio clip should be played when the ability is played?
What source should the clip be played from?
Should there be a delay when playing the clip? If not, set to 0 by default.
A toggle to allow you to stop the audio on ability end. By default this is set to ON
Invokes when this specific ability starts
Invokes when this specific ability exits
Inside the Animator State Machine, all the internal conditions will use the formula: