In this tutorial we’ll update camera controls and battle AIs and add reuse times.
This tutorial is part 3 of a mini-series covering real time battles with tab targeting. You can find the start of this series here.
We’ll work on fixing the issues we noticed in our first test play, i.e. we’ll update the camera controls to allow rotating using the gamepad’s right stick, change the enemy battle AI to only use targets detected by their move AI and prevent spamming of actions by adding reuse times.
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.
Update Camera Controls #
We’ll start with updating the Top Down Border camera we’re using and add rotation via the right stick’s horizontal axis.
Open the ORK editor and navigate to Controls > Camera Controls.
Camera Control 0 > Rotation Settings #
- Rotation Input Change
Set to: 180 - Use Delta Time
Enable
The rotation input change will be used in delta time, i.e. we’ll take a second to rotate by 180°. - Use Axis
Enable - Axis Key
Select: Right Stick Horizontal
And that’s all we need, we can now rotate the camera with the right stick of the gamepad.
Feel free to test it right away.
Battle AI using Move AI Detection #
Next, we’ll add a new battle AI that will select targets based on the move AI’s detection. The move AI was set up as part of the spawn hunting enemies tutorial and detects the user’s enemy within 10 world units in a 90 degree cone in front of the user.
Our other battle AI don’t handle setting a target, they just use an action and automatically use a target based on the combatant’s AI settings. We can simply set up a new battle AI to set the combatant detected by the move AI as target and the other battle AI will use it – in case no target was detected by the move AI, we’ll use the None action, having the combatant do nothing.
Navigate to Battles > Battle AIs and add a new battle AI.
Battle AI Settings #
- Name
Set to: Move AI Detection
Check Move AI Detection #
Add Node > Move AI > Check Move AI Detection
This node will use targets that are detected by the move AI as found targets for the battle AI.
- Found Targets
Select: Clear - Target
Select: Enemy
None #
Add Node > Action > None
This node uses the None action.
- Is Silent
Enable
This’ll prevent any schematics or notifications from being used.
That’s it for the battle AI, let’s add it to our combatants.
Update Combatants #
Navigate to Combatants > Combatants and select General Settings.
We’ll add the new battle AI to the General Settings and the following combatants:
- Spider
- Skeleton
- Slime
These combatants replace the default battle AI instead of adding to it, so we need to add the new battle AI to them individually.
The setup is the same for all, so repeat it for the general settings and 3 combatants (you can copy/paste the settings using the context menu).
AI Settings > Battle AI #
We’ll set the move AI detection battle AI as the first battle AI in the list, i.e. it’ll be used before all other.
We also limit it to be used in real time battles without battle grids.
Copy Battle AI 0 and change the settings of the original.
- Battle AI
Select: Move AI Detection - All Battle Systems
Disable - Grid Battles
Select: No
Click on Add Battle System.
- Battle System
Select: Real Time
Reuse Times #
To prevent spamming of abilities, we’ll set up reuse times. After using an ability, it’ll not be available for use until the reuse time is up.
Follow the reuse time tutorial to set up:
- default reuse time of 5 seconds for abilities and items
- base attack: 1 second
- magic attack spells: 10 seconds
I’d also recommend setting up a shortcut HUD that displays reuse times (via shortcut UI).
Save Changes #
We’ll do another test, don’t forget to save your changes by clicking on Save Settings at the bottom of the editor.
Testing #
Alright, we fixed some things, now let’s test again.
Hit play and test the real time battle.
Great, the camera is rotating using the right stick, enemies don’t attack us right away and the reuse times are working. There’s more to do, though:
- enemies don’t react to damage, so we can just kill them easily as long as they don’t turn around
- combatants still move forward before using abilities, and they don’t face their target when attacking
- no player HUD
We’ll continue in the next part of the real time mini-series.



