Basic Abilities

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.

  1. Search “Ability” in the Core Content.
  2. Drag & Drop the Ability object on the Equipment name in the Hierarchy (not in the Client Context).
  3. Rename the Ability to Punch.
  4. Change the Action Name property on the Punch ability to Shoot.
  5. Press Play and equip the Equipment.
  6. Press Left Click to play the “Slash Left” animation with a 5 seconds cooldown (default parameters).
unhand_slash_left animation

Ability Display

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:

  1. Search “Ability” in the Core Content.
  2. Drag & Drop the Abilities Display object in your scene (can be placed outside of the equipment).
  3. Delete one of the Ability Display Panels inside the Abilities Display object in the Hierarchy (Deinstance object when asked).
  4. 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.

Ability Display properties

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.

Ability Display Client Context in Hierarchy

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.

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

Ability Properties

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.

3 Comments
Collapse Comments

There is a problem with this part of the course. It needs to be updated to reflect how it works now.
Ability Core Object needs to have “Attack” typed into the Action Name property.
Ability Display is called Abilities Display and no longer seems to work the way it is explained.

I cannot do more for this course until these problems are fixed.

CommanderFoo (Administrator) July 25, 2022 at 5:59 am

Thanks, we will take a look at this as soon as possible.

this course seems to be outdated

Leave a Comment

Scroll to Top