Abilities are CoreObjects that can be added to Players and guide the Player’s animation in sync with the Ability’s state machine. Abilities can be activated by association with an Action Binding. On the scripting part, their internal state machine flows through the phases: Ready, Cast, Execute, Recovery, and Cooldown. An Ability begins in the Ready state and transitions to Cast when its Binding (e.g. Left mouse click) is activated by the owning player. It then automatically flows from Cast to Execute, then Recovery and finally Cooldown. Advanced Abilities are going to be covered in the scripting module.
In this lesson, we are going to look at how you can equip abilities and what are the different properties of an Ability.
Equip an Ability with an Equipment
As seen in the previous lesson, an Equipment is an object that is attached to a player. You can also add Abilities in your Equipment to play animations when a player presses a key. Let’s add an Ability in the Equipment you made in the previous Hands-on.
Search “Ability” in the Core Content.
Drag & Drop the Ability object on the Equipment name in the Hierarchy (not in the Client Context).
Rename the Ability to Punch.
Change the Action Name property on the Punch ability to Shoot.
Press Play and equip the Equipment.
Press Left Click to play the “Slash Left” animation with a 5 seconds cooldown (default parameters).
Before diving deeper into the Ability properties, let’s show the Ability status on the interface. The object Ability Display adds a UI element showing the cooldown, the binding and an icon. To add the Ability Display:
Search “Ability” in the Core Content.
Drag & Drop the Abilities Display object in your scene (can be placed outside of the equipment).
Delete one of the Ability Display Panels inside the Abilities Display object in the Hierarchy (Deinstance object when asked).
For the Ability Display Panel an ActionName will need to be set. Select Shoot from the drop-down.
ShowAbilityName is a text under the icon that will how the action binding the player musy use to active this ability.
The last option HideWhenDisabled will hide the icon if the Ability is disabled from a script.
In the Client Context of the Ability Display, you will find the different UI elements that are fully customizable. To move the placement of the Ability Display on the screen, move the Panel Control. The Icon can also be changed by double-clicking on the Image.
Try it on Core! Change the Icon of the Ability Display for the “Military Ability Punch”, update the Color under the icon to White, and show the name of the ability.
An Ability has various properties to customize the binding, the animation, and the duration of each state. The list of all animations can be found here.
Under the Ability Properties, there are the 4 states of an Ability: Cast, Execute, Recovery, and Cooldown. This will be covered in more details in the scripting module but you can still change each duration in the properties. The Cooldown Duration might be something you want to update if you want the player to be able to play the animation more often.
Try it on Core! Change animation to “1hand_melee_slash_vertical” and update cooldown duration to 1 second.
In the next lesson, we are going to look at existing weapons that are using those abilities.
Strictly Necessary Cookies
Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.
If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.
3rd Party Cookies
This website uses Google Analytics to collect anonymous information such as the number of visitors to the site, and the most popular pages.
Keeping this cookie enabled helps us to improve our website.
Please enable Strictly Necessary Cookies first so that we can save your preferences!