In this tutorial we’ll spawn the player group members and make them follow the player.
The default setup of an ORK project will only spawn the player outside of battles. Let’s change that to spawn other members of the player’s battle group as well.
Beside spawning the members, we’ll also need a move AI to make them follow their group leader (i.e. the player). We’ll also use a formation to have the members follow defined positions around the player.
We’ll set up:
- spawning player group members
- formation
- move AI to follow the group leader
This tutorial is based on the ORK 4 Unity Quickstart 3D tutorials, but can be used in any project.
Spawning Player Group Members #
Open the ORK editor and navigate to Gameplay > Game Settings, this is where the general player group settings are found.
Player/Group Settings > Group Spawn Settings #
We’ll simply have to turn on spawning group members.
The default setup will spawn only the battle group members, so we make sure that’s what’s set up.
- Spawn Group
Enable - Whole Group
Disable
We only spawn members of the battle group.
You can control the distance they spawn from the player using the Distance setting, but that doesn’t concern us, as we’re using a formation to handle that.
If you test now, the battle group members will spawn with the player, but use the default move AI (if you’ve followed the spawn hunting enemies tutorial), i.e. not follow the player and randomly moving around.
Formation #
Next, we’ll set up the formation the group will move in.
Navigate to Combatants > Formations, we’ll change the Default formation.
- Name
Set to: Player Group - Place On Ground
Enable
This’ll use a raycast to find the ground for our positions. - Layer Mask
Select only the Default layer.
First select Nothing, then select Default.
Our ground (and other level architecture) is on the Default layer.
Field Positions #
We’ll define the positions our group members will follow their group leader (i.e. the player) here.
Positions can be created in a visual editor – you can add and remove postions using a right-click and move them around using left-click-dragging.
Add 2 positions like this:
For further precision, you can also edit the positions below the formation graph.
Formation Position 0 #
- Position
Set to: X=-1.5, Y=0, Z=-1.5 - Local Space
Enable
This is enabled by default – it makes sure the positions are in local space of the user, i.e. they’ll turn with it.
Formation Position 1 #
- Position
Set to: X=1.5, Y=0, Z=-1.5 - Local Space
Enable
Battle Positions #
We’re not going to use the formation in battles. If you want to use it, just add positions to it.
When using a formation for battle, only the leader will be placed using the battle spots, the other group members will be placed according to the used formation.
Tip!
Formations are not limited to the player, they can also be used by enemies and other AI controlled groups.
Move AI #
We’ll continue with setting up the move AI for the player group members. Their move AI will only follow their group leader instead of hunting enemies.
Navigate to Combatants > Move AIs and add a new move AI.
- Name
Set to: Follow Leader
Group Settings #
These settings manage following the group leader.
- Follow Leader
Enable
Follow Range #
We’ll follow the leader at a distance of 3 world units with a threshold of 0.5.
- Range
Select: Value > Value.
Set the value to: 3 - Threshold
Select: Value > Value
Set the value to: 0.5
This is usually the default threshold.
Give Way #
The combatants can move away from the leader to give them space to move, we’ll use that.
- Give Way
Enable - Range
Select: Value > Value
Set the value to: 1 - Threshold
Select: Value > Value
Set the value to: 0.5
This is usually the default threshold.
Auto Respawn #
We’ll automatically respawn combatants when they are too far away.
E.g. in case they get stuck somewhere, this’ll reset them.
- Auto Respawn
Enable - Range
Select: Value > Value
Set the value to: 30
Prioritise Leader #
We don’t need to use this, since our combatants will only follow the leader and do nothing else.
In case you want to use random patrol (while they’re not following the leader) or other move AI features for the combatants, this can ensure they’ll follow the leader if they are too far away.
Updating Player Combatants #
We need to set up our player combatants to use the move AI we just created.
Navigate to Combatants > Combatants, we’ll change the following combatants:
- Fighter
- Caster
The setup is the same for all combatants.
AI Settings > Move AI #
- Own Move AI
Enable - Use Move AI
Enable - Move AI
Select: Follow Leader
Save Changes #
That’s it for the setup so far.
Don’t forget to save your changes by clicking on Save Settings at the bottom of the editor.
Updating Start Game Schematic #
All that’s left to do is actually use the formation we set up. Formations can be used by combatant group setups (Combatants > Combatant Groups), battle AIs and schematics.
We’ll update the Start Game schematic to use the formation.
Open the schematic editor and open the StartGame schematic.
Change Formation #
Add Node > Combatant > Formation > Change Formation
Add the node before the Spawn ORK Player node, otherwise the group members will not already spawn in formation.
- Formation
Select: Player Group - Object (Combatant)
Select: Player
And that’s it – click on Save Schematic to save the changes.
Testing #
Hit play to test the changes.
If, like me, you haven’t added more player group members yet, you’ll only have one combatant follow the player for now.
At least the player isn’t alone anymore!



