In this tutorial we’ll set up changing the player, improve the move AI and show exp gains and level up.
This tutorial is part 5 of a mini-series covering real time battles with tab targeting. You can find the start of this series here.
In this final part we’ll allow the player to switch the controlled combatant, improve the move AI to prevent enemies from bumping into the player and show the exp gains and level up of the player.
This tutorial is based on the ORK 4 Unity Quickstart 3D tutorials using gamepad controls (with combined inputs), cast times and spawning enemies, but can be used in any project.
Changing the Player #
The player is usually the leader of the battle group – i.e. the first combatant that joined, or when using a Group menu screen part, the combatant the player puts into the first position.
Beside using a group menu to manage who’s in the battle group and the controlled combatant, we an also use input keys to switch the player to another group member.
Open the ORK editor and navigate to Controls > Game Controls.
Base Settings > Group Member Keys #
We’ll use the Select Button of the gamepad to change between group members
- Input Key (Next Member Key)
Select: Select Button - Switch Player
Enable - Field
Disable - All Battle Systems
Disable
Click on Add Battle System.
- Battle System
Select: Real Time
Group Spawn and Game Over #
Navigate to Gameplay > Game Settings.
Player/Group Settings > Group Spawn Settings #
We’ll disable spawning the player group members.
You can ignore this part if you haven’t set up player group spawning.
- Spawn Group
Disable
Game Over Settings #
We’ll let the game end if the player dies during real time battle area fights.
- Auto Game Over
Enable - Battle Group Dead
Disable
This’ll cause game over when the leader (player) dies.
When disabled, the whole battle group has to be dead.
Save Changes #
And that’s it, don’t forget to save your changes by clicking on Save Settings at the bottom of the editor.
Testing #
That should do it – hit play and go have some fun fighting.
We can change the player and it’s game over if we die, all working as it should.
There are still 2 more things I’d like to improve:
- the move AI keeps bumping enemies into the player
- there is no exp or level up notification
Improving Move AI #
The hunting move AI is currently set up for just running into the player to start the battle. This isn’t really working well for our real time battles.
We can simply fix this by setting up a stop range in the move AI’s hunting settings.
Open the ORK editor, navigate to Combatants > Move AIs and select the Hunt move AI.
Hunting Settings > Stop Range #
When using a stop range it’s important to also set up a threshold for the range. Thresholds are used for smoother movement at the edge of the range.
E.g. we’ll set up a range of 1 with a threshold of 0.5
The enemy will stop at range – threshold, so at 0.5.
The enemy will resume movement when it’s more than range + threshold away, so at 1.5.
- Use Stop Range
Enable - Range
Select: Value > Value
Set the value to: 1 - Threshold
Select: Value > Value
Set the value to: 0.5
The move AI is also used to move into use range of actions, the stop range can make use of the use range for that. However, none of our use ranges are set up with thresholds, which makes it a bit hit and miss. E.g. in some cases this can lead to the enemy stopping barely out of range and not using the action.
Experience Flying Text #
The quickstart 3D tutorials already set up flying texts for HP, we’ll now add another one for the EXP the player receives.
Navigate to Status > Status Values and select the EXP status value.
Flying Text Settings #
We’ll display the EXP gains only for the player.
Click on Add Flying Text.
- Player
Enable - Ally, Enemy
Disable
Refresh #
We only display adding EXP (in a yellow text color), so Refresh is all we need to set up.
- Ignore 0 Refresh
Enable - Show Flying Text
Enable - Text (Content)
Set to: <color=#FFFF00FF><name> +<value></color>
Position Settings #
We’ll also mount the flying text to the combatant, i.e. it’ll move with the combatant instead of staying at the position in world space where it was first shown.
We override the default position settings of flying texts for this.
- Own Position Settings
Enable - Mount Text
Enable
New Loot Dialogue #
We’ll set up a new loot dialogue that only shows level ups. You can define multiple loot dialogues for different battle outcomes.
In our case, we’ll show it only for Immediate Collection and No Outcome, so the scenarios we have in real time battle areas.
Navigate to Menus > Loot Dialogues.
Loot Dialogue 0 #
We’ll first update the current loot dialogue to not display in our real time battle area cases.
- Immediate Collection
Disable - No Outcome
Disable
Loot Dialogue 1 #
Next, we set up our new loot dialogue to only show level ups.
Click on Add Loot Dialogue to add a new setup.
- Loot Dialogue Type
Select: Simple
We’ll only show this loot dialogue in the 2 cases we disabled for the other loot dialogue.
- Victory
Disable - Escape
Disable - Defeat
Disable - Leave Arena
Disable - Immediate Collection
Enable - No Outcome
Enable
Loot Dialogue Settings #
- Block Focus
Disable
Since our level up notification should only display without being controlled, blocking focus would prevent us from using any other UI box while it’s shown. - Show Level Up Notification
Enable
Level Up Notification #
- UI Box
Select: Menu Small
This’ll show the level up at a position that’s not disrupting our battle.
Updating Battle System Setup #
We also need to change the Real Time battle system’s settings to show battle gains again.
Navigate to Battles > Battle System and select the Real Time battle system.
Battle System Settings > Battle Gains Collection #
We’ll show the battle gains for 3 seconds and automatically close the UI again.
- Show Gains
Enable - Auto Close
Enable - Close After
Set to: 3 - Block Accept Button
Enable
Save Changes #
And we’re done with our real time battle system using tab targeting.
Don’t forget to save your changes by clicking on Save Settings at the bottom of the editor.
Final Testing #
Hit play and test the final result.
We see the received EXP, get level up dialogues and the move AI doesn’t bump into the player anymore.
This means we’re done with our real time battle tutoral using tab targeting!

