Using the combatant link system to create an ability to protect allies.

Combatant links are used to let a combatant remember/store other combatants via a linked key (e.g. like a variable key). The stored combatants can be accessed via the selected data system (using a Select Combatant node). We’ll use this to create a new ability that is used to protect allies for a turn.

For this we’ll need to:

  • create 3 new events (2 battle events and 1 game event)
  • create a new ability
  • update the battle menu (adding the new ability as a special action)
  • let the player learn the ability

Let’s get to it!

Battle Event: Protect

First, we’ll set up the actual battle event that is used by the ability to cast protecting our ally.

Open the ORK Framework editor and navigate to Events. Click on New Battle Event to create a new battle event.

Event Settings

  • Calculation Needed
    Enable this setting.

Link Combatants

Add > Combatant > Combatant > Link Combatants

This node is used to store combatants on another combatant via a linked key.

We’ll use it here to let the user remember who he is protecting (needed for later clearing the protection in the next turn).

  • Change Type
    Select Set.
  • Value Type (Linked Key)
    Select Value.
  • Value (Linked Key)
    Set to protect.

The Combatant defines which combatant the others will be stored on.

  • Object
    Select Actor.
  • Actor
    Select User.

The Linked Combatant is the combatant that will be stored on the Combatant.

  • Object
    Select Actor.
  • Actor
    Select Target.

Link Combatants

Add > Combatant > Combatant > Link Combatants

We’ll use the 2nd Link Combatants node to let the target know it is protected by the user. This will be used by another event to change the target of attacks.

  • Change Type
    Select Set.
  • Value Type (Linked Key)
    Select Value.
  • Value (Linked Key)
    Set to protectedBy.

The Combatant defines which combatant the others will be stored on.

  • Object
    Select Actor.
  • Actor
    Select Target.

The Linked Combatant is the combatant that will be stored on the Combatant.

  • Object
    Select Actor.
  • Actor
    Select User.

The rest of the nodes are the same as for the Defend action (in the game tutorial series).

Change Camera Position

Add > Game Object > Camera > Change Camera Position

  • Camera Position
    Select Front View.
  • Object
    Select Actor.
  • Actor
    Select User.
  • Fade Position
    Disable this setting.

Combatant Animation

Add > Animation + Audio > Animation > Combatant Animation

  • Object
    Select Actor.
  • Actor
    Select User.
  • Stop
    Disable this setting.
  • Wait
    Disable this setting.
  • Animation Type
    Select Defend.

Wait

Add > Base > Wait

  • Time (s)
    Set to 1.

Initial Camera Position

Add > Game Object > Camera > Initial Camera Position

  • Fade Position
    Enable this setting.
  • Time (s)
    Set to 1.
  • Wait
    Enable this setting.
  • Interpolation
    Select Ease In Out Quad.

And that’s it for this battle event – click on Save Event and save it as protect in Assets/Events/Battle/Protect/.

Battle Event: Protect Target Switch

The next battle event handles changing the target in case it’s currently protected by someone. We’ll later use this to update the Attack and Mug Attack abilities.

Click on New Battle Event to create a new battle event.

Linked Combatant Count

Add > Combatant > Combatant > Linked Combatant Count

This node is used to check the number of stored combatants for a linked key on a combatant. We’ll use it to check if the target is protected by someone.

  • Value Type (Linked Key)
    Select Value.
  • Value (Linked Key)
    Set to protectedBy.

The Combatant defines who will be checked.

  • Object
    Select Actor.
  • Actor
    Select Target.

We’ll check if the count of stored combatants is greater than 0 (i.e. at least 1 is stored).

  • Check Type
    Select Is Greater.
  • Value Type (Check Value)
    Select Value.
  • Value (Check Value)
    Set to 0.

Select Combatant

Add > Event > Selected Data > Select Combatant

This node is connected to the Success slot of the Linked Combatant Count node.

We’ll use this node to store the combatant protecting the target as selected data. This allows us to use the combatant in the following node(s).

  • Value Type (Selected Key)
    Select Value.
  • Value (Selected Key)
    Set to newTarget.

The Combatant Settings define the combatant and which information on it will be used (e.g. the combatant itself, the last target of the combatant or a linked combatant).

  • Combatant Origin
    Select Linked.
  • Value Type (Linked Key)
    Select Value.
  • Value (Linked Key)
    Set to protectedBy.
  • Object
    Select Actor.
  • Actor
    Select Target.

Change Action Targets

Add > Battle > Action > Change Action Targets

This node is used to change the targets of a battle action – we’ll use it to set the combatant we just stored in selected data as the new target.

  • Change Type
    Select Set.
  • Object (Target Object)
    Select Selected Data.
  • Value Type (Selected Key)
    Select Value.
  • Value (Selected Key)
    Set to newTarget.

And that’s it for this battle event – click on Save Event and save it as protectTargetSwitch in Assets/Events/Battle/Protect/.

Game Event: Clear Protect

As our last new event, we’ll create a new game event that’ll be used as turn start event for combatants to clear the protection links at the start of a new turn. The event will remove the links when a combatant protecting another combatant starts a new turn – until then the combatant keeps protecting the ally.

Click on New Game Event to create a new game event.

Event Settings

We’ll need to add an event actor – for turn start events, the combatant that’s starting a new turn is provided as the Starting Object.

Event Actors

Click on Add Actor to add a new actor.

  • Type
    Select Starting Object.

Linked Combatant Count

Add > Combatant > Combatant > Linked Combatant Count

Like before, we’ll use this node to check if the combatant is protecting someone.

  • Value Type (Linked Key)
    Select Value.
  • Value (Linked Key)
    Set to protect.

The Combatant defines who will be checked.

  • Object
    Select Actor.
  • Actor
    Select the actor we created (0:).

We’ll check if the count of stored combatants is greater than 0 (i.e. at least 1 is stored).

  • Check Type
    Select Is Greater.
  • Value Type (Check Value)
    Select Value.
  • Value (Check Value)
    Set to 0.

Select Combatant

Add > Event > Selected Data > Select Combatant

This node is connected to the Success slot of the Linked Combatant Count node.

Again, we’ll use this node to store the combatant we’re protecting as selected data. We’ll need this to remove the link on it as well.

  • Value Type (Selected Key)
    Select Value.
  • Value (Selected Key)
    Set to other.

The Combatant Settings define the combatant and which information on it will be used (e.g. the combatant itself, the last target of the combatant or a linked combatant).

  • Combatant Origin
    Select Linked.
  • Value Type (Linked Key)
    Select Value.
  • Value (Linked Key)
    Set to protect.
  • Object
    Select Actor.
  • Actor
    Select the actor we created (0:).

Link Combatants

Add > Combatant > Combatant > Link Combatants

We’ll use the node to remove the link on the other combatant (we just stored as selected data).

  • Change Type
    Select Clear.
  • Value Type (Linked Key)
    Select Value.
  • Value (Linked Key)
    Set to protectedBy.

The Combatant defines which combatant will be cleared.

  • Object
    Select Selected Data.
  • Value Type (Selected Key)
    Select Value.
  • Value (Selected Key)
    Set to other.

Link Combatants

Add > Combatant > Combatant > Link Combatants

We’ll use the node to remove the link on the combatant (starting object actor).

  • Change Type
    Select Clear.
  • Value Type (Linked Key)
    Select Value.
  • Value (Linked Key)
    Set to protect.

The Combatant defines which combatant will be cleared.

  • Object
    Select Actor.
  • Actor
    Select the actor we created (0:).

And that’s it for this event – click on Save Event and save it as clearProtect in Assets/Events/Battle/Protect/.

Ability: Protect

Next, we’ll create a new ability that will be used to protect an ally. Navigate to Status > Abilities, add a new ability and change the following settings.

Content Information

  • Name
    Set to Protect.
  • Description
    Set to: Protects an ally.

Base Settings

  • Ability Type
    Select Support.
  • Hidden
    Enable
    this setting.
    The ability will be used as a ‘special’ command, like defend – this will hide the ability in menu screens and the regular ability battle menu.
  • Useable In
    Select Battle.

Target Settings

  • Target Type
    Select Ally.
  • Target Range
    Select Single.
  • Is Dead
    Select No.
  • Not On Self
    Enable this setting.
    No need to protect yourself.

Battle Animation

  • Animate Action
    Enable this setting.

Click on Add Animation to add an animation setting.

  • Battle Event
    Select protect.
  • Perform In
    Enable all except Field.

That’s it for our new ability.

Updating Attack and Mug Attack

For the protection to actually work, an action will need to switch the target using the battle event we created before. This is done by adding it as the first battle event used to animate an action. We’ll do this by updating the Attack and Mug Attack abilities, feel free to also add this for other abilities.

The setup is the same for both abilities.

Battle Animation

Copy the first battle event (Battle Event 0, using the runToTarget battle event) and edit the first one (i.e. Battle Event 0).

  • Battle Event
    Select protectTargetSwitch.
  • Perform In
    Enable all except Field.

That’s it for updating the abilities.

Updating Battle Settings: Turn Start Events

To remove the protection at the start of the user’s next turn, we’ll need to use the game event we created as turn start events for all combatants.

Navigate to Battle System > Battle Settings and change the following settings.

Default Events > Turn Start Events

  • Player/Ally/Enemy Event
    Select clearProtect.

That’s it for the battle settings.

Updating the Battle Menu

Next, we’ll add the Protect ability as a special action to the battle menu – although it’s a hidden ability, it’ll still be displayed if we add it as a single ability to the menu.

Navigate to Battle System > Battle Menus, select the Default Battle Menu and change the following settings.

Copy the Option 3 menu item (i.e. the Defend type) and edit the new copy (Option 4).

  • Type
    Select Ability.
  • Single Ability
    Enable this setting.
  • Ability
    Select Protect.

That’s it for the battle menu.

Learning a Group Ability

Finally, we’re letting our player learn the new ability, otherwise it wouldn’t be available to be used. However, we want the ability to be available to all members of our player’s group, so instead of learning it as an individual ability of a combatant, we’ll learn it as a group ability, i.e. it’s bound to the group and not a combatant.

Navigate to Combatants > Combatants, select Brown Pants and change the following settings.

Attacks & Abilities > Ability Development

Click on Add Ability to add a new ability to be learned (should be Learn Ability 6).

  • Learn at Level
    Set to 1.
  • Ability
    Select Protect.
  • Group Ability
    Enable this setting.

And that’s it – click on Save Settings and close the ORK Framework editor.

This is only one example for using the combatant link system, I’m sure you can come up with your own use cases and custom systems!