In this tutorial we’ll set up general battle related settings.
This tutorial continues the sub-series for setting up battles.
Before diving into setting up the actual battle system, we’ll handle some other battle settings that are independent from the used battle system type.
- battle system general settings
- target settings
- battle spots
- battle texts (action info notifications)
- battle end (loot dialogue)
- player HUD
Battle System #
First, navigate to Battles > Battle System > General Settings. You can learn more about battle systems in this documentation.
Base Settings #
This is where you set up the Default Battle System and Default Battle Menu that’ll be used in the game. We’ll revisit this when we set up the battle system we’re using.
- Default Battle System
Defines the battle system that’ll be used in your game, unless an individual Battle component overrides the default system. - Real Time Area System
Defines a Real Time battle system that’ll be used by Real Time Battle Area components. - Default Battle Menu
Select Default. - Enemy Counter
In case multiple enemies of the same combatant are in a battle, they can be counted by adding numbers or letters to their names. - Play Damage Animation
Disable this setting.
This handles if damage animations are played on combatants that are currently in action. - Play Victory Animation
Enable this setting.
The winning combatants will automatically play the victory animation type (set up in Base/Control >Animation Types > General Settings).
Chances & Factors #
However, we’ll take a look at the default chances and factors.
- Base Defend Rate
Since we don’t use the defend command, this setting can be ignored.
If you’re using it, this’d define how much damage a combatant takes when defending, 100 being 100%, 50 being 50% of the damage, etc. - Base Counter Chance
Select Value > Formula.
Select the Critical Chance formula. - Base Block Chance
We also don’t use block (we don’t have any blockable status changes set up), so we can ignore this setting.
Blocking would completely block damage when the chance checks out. - Base Escape Chance
The default value of 50 is good for us.
I.e. we have a 50% chance of escaping from battle.
Target Settings #
Navigate to Battles > Target Settings, this is where target selection related settings are made. You can learn more about target selection in this documentation.
Target Selection #
These settings handle how targets can be selected.
Target Menu #
- Use Target Menu
Enable this setting.
This’ll use the battle menu to select targets (enabled by default).
Target Highlight > Cursor Settings #
We’ll use a cursor prefab spawned on the target’s game object.
Click on Add Highlight.
- Highlight Type
Select Prefab. - Prefab
Select Cursor. - On Child
Select Path.
We’ll define the path to a child object. - Find Child
Set to Cursor.
It’s a child object on all our combatant prefabs for where the cursor should display. - Local Space
Enable this setting. - Ignore Scale
Enable this setting.
We’ll also blink the HUD of selected targets.
Click on Add Highlight.
- Highlight Type
Select Fade HUD Color. - Fade HUD
Select Blink. - Time
Set to 1. - Interpolation
Select Linear. - Fade Alpha
Enable this setting. - Fade Red/Green/Blue
Disable these settings. - Start Color
Select a white color with low alpha (e.g. A=100 or 0.4, depending on your color picker). - End Color
Select a white color with a higher alpha (e.g. A=150 or 0.6, depending on your color picker).
Mouse/Touch Control #
- Layer Mask
Select only the Combatants layer.
Select Nothing to deselect all layers first, followed by Combatants. - Input Type
Select Both.
Allows using mouse and touch input. - Mouse Button
Set to 0.
Uses the left mouse button click. - Finger Count
Set to 1. - Click Count
Set to 1. - Mode
Select Start.
Battle Spots #
Navigate to Battles > Battle Spots, we’ll adjust how our combatants are placed. You can learn more about battle spots in this documentation.
We’ll move them a bit farther apart (Z axis of the position) and also change the rotation of the player spots.
Base Settings #
- Use Rotation
Enable this setting.
Combatants being placed on battle spots will use the rotation of the spot, i.e. we’ll use the spots to handle player and enemy combatants looking into each other’s direction. - Place On Ground
Enable this setting.
We’ll use raycasting to place the battle spots directly on the ground. - Layer Mask
Select only the Default layer.
This is where the ground is on.
Player Spots #
There are already 3 battle spots set up for the player – we’ll adjust their position and rotation.
The default position setup will place the leader in the center, we’ll change that to have the leader at the side.
We’ll use a Y axis for the position high enough to have room for raycasting – the position of battle spots is in local space of the battle arena (i.e. the game object with the Battle component).
Member 0 #
- Spot Position
Set to X=-3, Y=10, Z=4. - Set Rotation
Enable this setting. - Rotation
Set to X=0, Y=180, Z=0.
Member 1 #
- Spot Position
Set to X=0, Y=10, Z=4. - Set Rotation
Enable this setting. - Rotation
Set to X=0, Y=180, Z=0.
Member 2 #
- Spot Position
Set to X=3, Y=10, Z=4. - Set Rotation
Enable this setting. - Rotation
Set to X=0, Y=180, Z=0.
Ally Spots #
We don’t have ally groups in our game, so you can ignore these settings.
Ally spots would only be used if you have at least 3 different factions in a battle, the player, the enemy and a faction allied to the player.
Enemy Spots #
We’ll do similar changes to the enemy spots, just a different rotation and Z axis position (-4 instead of 4).
We only use enemy groups with maximum 3 combatants in this game, so we only need 3 defined spots.
Member 0 #
- Spot Position
Set to X=-3, Y=10, Z=-4. - Set Rotation
Enable this setting. - Rotation
Set to X=0, Y=0, Z=0.
Member 1 #
- Spot Position
Set to X=0, Y=10, Z=-4. - Set Rotation
Enable this setting. - Rotation
Set to X=0, Y=0, Z=0.
Member 2 #
- Spot Position
Set to X=3, Y=10, Z=-4. - Set Rotation
Enable this setting. - Rotation
Set to X=0, Y=0, Z=0.
Battle Texts #
Navigate to Battles > Battle Texts, we’ll set up action info notifications, showing actions used by combatants. You can learn more about battle texts in this documentation.
Action Info Notifications #
Battle texts are a bit different than the other notifications – they use a slightly different setup and have their own UI box setup (i.e. can’t use the default UI box setup for notifications).
We’ll use the Top Right Notification UI layout to list multiple action infos in case the action happens fast.
Click on Add Action Infos.
- Player/Ally/Enemy
Enable these settings.
The action infos will be displayed for all factions – you can use this to set up separate info notifications for them. - UI Box
Select Beige Top Right Notification. - Visibility Time
Set to 2. - UI Layout
Select Top Right Notification. - Shared Layout
Enable this setting.
We’ll share the layout with the other notifications.
The Show In settings handle in which battle systems these notifications are used. The default settings should already be correct:
- Field
Disable this setting - All Battle Systems
Enable this setting.
All info texts already have a default setup that should be ok for this tutorial – feel free to change them to your liking. There’s a lot, though.
Battle End #
Navigate to Battles > Battle End, this is where we’ll handle distribution of experience and how the loot dialogue will look like. You can learn more about battle end and loot dialogues in this documentation.
Base Settings #
- Whole Party
Enable this setting.
All members will get experience, not just the combatants participating in battle.
Loot Dialogue 0 #
The Simple loot dialogue is added by default, but we still need to set it up to display something.
- Loot Dialogue Type
Select Simple.
This will display a series of dialogues, showing the loot, experience and status changes of level ups.
You can use different loot dialogues for different battle outcomes, by default it’ll be used for all (which we’ll do).
Loot Dialogue Settings #
- Show Battle Gains
Enable this setting.
We’ll list the loot and experience the player gained. - Show Level Up Notification
Enable this setting.
We’ll show status changes of a combatant’s level up.
Battle Gain Notification #
Can be used to list loot and experience.
- UI Box
Select Beige Bottom Dialogue. - Show Title
Enable this setting. - Text (Title Content)
Set to: Spoils - Text (Total Gains Text)
Set to: <currency>
<item>
<experience>
The rest of the texts (e.g. Currency Text) can already be used as they are, feel free to change them if you want.
Level Up Notification #
Handles the UI box and some other settings for level up notifications.
The actual content is defined in the Level Up Texts settings below.
- UI Box
Select Beige Bottom Dialogue. - Show Title
Enable this setting. - Text (Title Content)
Set to: <name>
Level Up Texts #
These settings define the content of level up notifications.
We’ll keep the default settings, which’ll list the reached level, status value changes and learned abilities, etc.
Text Display Settings #
We’ll need to make a small adjustment for displaying use costs. The default setup will show the full name of status values, but we want to use the short name instead.
Navigate to UI > Text Display Settings and change the following settings.
Use Cost Display #
These settings handle how the use cost of abilities and items is displayed.
We’ll adjust the status value related settings.
Negative Change Text #
- DefaultContent
Set to: <shortname> <change>
Positive Change Text #
- DefaultContent
Set to: <shortname> +<change>
Set Change Text #
- DefaultContent
Set to: <shortname> =<change>
Player HUD #
And finally, we’ll set up the player HUD – please follow this UI tutorial to handle the setup for the Unity UI module.
The tutorial will set up status value UI, status effect UI and the actual player HUD. Either follow the tutorial to set up the prefabs or download the completed HUD prefabs and use them for the setup
With the Player HUD set up, we’ll now add a Display Condition to it.
Display Conditions > Game State Condition #
We’ll check for our game state managing battle HUDs.
Click on Add Game State.
- Condition Type
Select Game State. - Game State
Select Show Battle HUD. - Check State
Select Active.
Save Changes #
And that’s it for the battle preparation!
Don’t forget to save your changes by clicking on Save Settings at the bottom of the editor.
Next, we’ll set up a battle system – but which one?
This tutorial series is best suited for 2 out of the 4 available battle systems: You can choose between Turn Based battles and Active Time battles.
Setting up battles in the scenes is the same, regardless of which battle system you want to use. You can also set up both, if you want, e.g. switching out the default battle system or have some battles override the default system.
Path TURN #
Using a Turn Based battle system, combatants perform actions in a predetermined order.
If you choose this battle system, we’ll set up:
- turn based battle system
- a Turn Order HUD, showing the battle order
Continue with TURN 01 to set up the Turn Based battle system.
Path ATB #
Using an Active Time battle system, combatants perform actions when their timebar is filled.
If you choose this battle system, we’ll set up:
- active time battle system (including formulas, etc.)
- cast times for actions
- a Timebar HUD, showing all combatants on a unified timebar.
Continue with ATB 01 to set up the Active Time battle system.