Finally, some action! But before we can start with our first battle, let’s go over some needed battle settings first.
We’ll take care of the following things for now:
- Basic battle settings
- Battle spots
- Battle texts
- Battle menus
New GUI boxes
First, we need to add new GUI boxes. Open the ORK Framework editor and navigate to Menus > GUI Boxes. The first GUI box will be used to display information at the top of the screen, add a new GUI boxes and change the following settings.
Base Settings
- Name
Set to Top Info. - Height Adjustment
Select Auto.
Content Box Settings
- Bounds
Set to X=0, Y=0, W=1280, H=50. - Anchor
Select Upper Left. - Text Allignment
Select Center.
Name Box Settings
- Bounds
Set to X=0, Y=0, W=200, H=50. - Anchor
Select Upper Left. - Adjust Width
Enable this setting. - Adjust Height
Enable this setting. - Text Color
Select Yellow. - Font Size
Set to 15.
That’s it for this GUI box.
Now, we’ll create another GUI box for our battle menu. For this, we’ll copy the already existing Bottom Dialogue GUI Box and change the following settings.
Base Settings
- Name
Set to Battle Menu. - Height Adjustment
Select Auto.
Content Box Settings
- Bounds
Set to X=0, Y=800, W=300, H=400.
Name Box Settings
- Adjust Width
Enable this setting. - Adjust Height
Enable this setting. - Text Color
Select Yellow. - Font Size
Set to 15.
Open Box Behaviour > Fade Settings
We want our battle menu to fade in and out – simply enable the fade settings, the default settings are good enough.
- Fade In
Enable this setting.
Open Box Behaviour: Move Settings
- Move In
Enable this setting. - Start Position
Set to X=-400, Y=800.
The GUI box will fade from this position to the content box position. - Interpolation
Select Ease Out Quad.
This will slow down at the end of the fade.
Close Box Behaviour > Fade Settings
- Fade Out
Enable this setting.
Close Box Behaviour > Move Settings
- Move Out
Enable this setting. - End Position
Set to X=-400, Y=800.
The GUI box will fade to this position from the content box position. - Interpolation
Select Ease In Quad.
This will start slow.
Battle Settings
Navigate to Battle System > Battle Settings. The battle settings is a collection of overall settings for all battle systems. Change the following settings.
Base Settings
- Enemy Counter
Select Letters.
This will add letters (A, B, C, …) to enemies of the same kind. - Base Defend Rate
Value Type: Select Value.
Value: Set to 50.
The base defend rate defines the percent of damage a combatant will receive after using the ‘Defend’ command.
In our case, the combatant will take only 50 % of the damage. - Base Counter Chance
Value Type: Select Formula.
Formula: Select LUK Chance.
The base counter chance defines the percent chance a combatant has to counter an attack. - Base Block Chance
Value Type: Select Formula.
Formula: Select LUK Chance.
The base block chance defines the percent chance a combatant has to block an attack. - Base Escape Chance
Value Type: Select Value.
Value: Set to 25.
The base escape chance defines the chance in percent a combatant will successfully escape when using the ‘Escape’ command.
In our case, the combatant can escape with a chance of 25 %.
Default Use Range
The default use range defines the distance that is allowed between user and target to be able to use actions like abilities and items.
We’ll set it up to not use any range ristrictions by default. The default range can be overridden for each battle system, as well as for each ability and item individually.
Default Range
- Range Type
Select None.
That’s it for the battle settings.
Target Settings
Navigate to Battle System > Target Settings. The target selection settings define how the target of an item or ability can be selected. Change the following settings.
Target Selection
- Use Target Menu
Enable this setting.
All available targets will be displayed in the battle menu.
Target Cursor
We’ll also use a target cursor – a game object that will be displayed at the selected combatant’s game object.
- Use Cursor
Enable this setting. - Prefab
Select CursorPrefab.
Can be found in Assets/Tutorial Resources/Prefabs/BattleSystem/. - On Child
Set to Head.
The prefab will be displayed on this child object of the combatant’s game object. - Offset
Set to X=0, Y=1, Z=0.
The prefab will be displayed 1 world unit above the child object.
Blink Target Object
We’ll also let the selected target blink.
- Use Blink
Enable this setting. - Blink Children
Enable this setting.
Child objects of the combatant’s game object will also blink. - Time (s)
Set to 0.5. - Fade Alpha
Disable this setting. - Fade Red/Green/Blue
Enable this settings. - Start Color
Select a white color (R=1, G=1, B=1, A=1). - End Color
Select a blue color (R=0.5, G=0.67, B=0.84, A=1).
Mouse/Touch Control
Finally, we’ll also use clicking/touching a combatant’s game object.
- Use Click
Enable this setting. - Mouse Button
Set to 0.
This is a left mouse button click. - Use Touch
Enable this setting. - Touch Count
Set to 1.
A one finger touch. - Click Count
Set to 1.
A single click is enough. - Mode
Select Start.
The combatant will be selected when the click/touch starts.
That’s it for the target settings.
Battle Spots
The battle spots define where combatants will be placed in a battle. The defined positions are in local space of the battle component in the scene. You can also simply place game objects in the scene and add them to the battle component’s settings in the inspector. The battle spots defined in the battle system section are the default battle spots and will automatically be used when no battle spots are defined in the scene.
So, this is a very convenient thing to have, else you’d have to add battle spots for each battle in your game.
Player Spots
The battle spots for the player group.
- Member 0: Standard Battle Spot Coordinates
Set to X=3, Y=5, Z=3. - Member 1: Standard Battle Spot Coordinates
Set to X=0, Y=5, Z=3. - Member 2: Standard Battle Spot Coordinates
Set to X=-3, Y=5, Z=3.
Enemy Spots
The battle spots for enemies of the player group. Add three enemy spots by clicking on Add Enemy Spot three times.
- Member 0: Standard Battle Spot Coordinates
Set to X=-3, Y=5, Z=-3. - Member 1: Standard Battle Spot Coordinates
Set to X=0, Y=5, Z=-3. - Member 2: Standard Battle Spot Coordinates
Set to X=3, Y=5, Z=-3.
That’s it for the battle spots.
Battle Texts
The battle texts define most of the texts used in battles.
Text Settings
- Default GUISkin
Select BaseSkin.
Can be found in Assets/Tutorial Resources/Skins/.
You need to drag the GUISkin from the project tab onto the field.
This GUISkin will be used as default skin for all texts like damage/refresh flying texts, status effect flying texts, etc. - All Allies Choice
Set to All Allies.
This is used when an item or ability targets all allied combatants. - All Enemies Choice
Set to All Enemies.
This is used when an item or ability targets all enemy combatants. - All Combatants Choice
Set to All.
This is used when an item or ability targets all allied and enemy combatants.
Info Text Settings
The info texts will display an information dialogue about the actions a combatant is using (e.g. Blue Pants uses Potion).
- Show Info
Enable this setting. - GUI Box
Select Top Info. - Visibility Time (s)
Set to 3.
The info text will be displayed for 3 seconds. - Show In
Enable Turn Based, Active Time and Real Time.
The default texts should already be set up for you – if not, here they are (enable them if not enabled):
- Attack Info
Set to %u attacks. - Ability Info
Set to %u uses %. - Item Info
Set to %u uses %. - Defend Info
Set to %u defends. - Escape Info
Set to %u tries to escape. - Counter Info
Set to %u counters. - Death Info
Set to %u dies. - Do Nothing Info
Set to %u does nothing. - Steal Item Info
Set to %u steals %. - Steal Item Fail Info
Set to %u fails to steal. - Steal Money Info
Set to %u steals % Gold. - Steal Money Fail Info
Set to %u fails to steal Gold.
That’s it for the battle texts for now. We’ll get to the flying texts (also for the consumable status values) in another tutorial.
Battle End
The battle end settings define how experience rewards are distributed and the information at the end of a battle (e.g. found items, level up, etc.) will be displayed.
Loot Dialogue 0
The Loot Dialogues handle displaying the loot and other battle gains – you can set up different loot dialogues for different battle outcomes, as well as select between a Simple dialogue and a more advanced Layout Screen.
We’ll use the Simple option for this small game, the default settings are fine as they are, we just need to select the GUI box we want to use.
Battle Gain Notification > Dialogue Settings
- GUI Box
Select Bottom Dialogue.
The rest of the settings can be used like they’re now.
The battle menu will define what actions the player can use. The default battle menu is defined in the Battle Settings (the first one in the list is currently selected). Each class can override the default battle menu, and each combatant can override the class and default battle menu. This way, you can create special battle menus for classes and combatants.
We’ll use the default battle menu – select the first battle menu and change the following settings.
Base Settings
- GUI Box
Select Battle Menu.
You can add menu items however you like and in whatever order you like – but at least one menu item must be added. The menu items define which actions are available. The first menu item is already added to the battle menu, so let’s change it’s settings.
- Type
Select Attack.
This uses the combatant’s base attack. - Use Ability Information
Enable this setting.
The menu item will use the combatant’s base attack ability’s name, description and icon.
Click on Add Menu Item to add another menu item.
- Type
Select Ability.
This will display the abilities of the combatant. - Type Display
Select Combined.
This will combine all different ability types into a single menu item. - Sub Menu
Enable this setting.
Displays the different ability types in a sub menu when selecting the ability menu item.
This is only available when Combined is selected. - Name
Set to Abilities.
Add another menu item.
- Type
Select Item.
This will display the items of the combatant. - Type Display
Select Combined. - Sub Menu
Enable this setting.
Displays the different item types in a sub menu when selecting the item menu item. - Name
Set to Items.
And add another one.
- Type
Select Defend.
This will use the defend command. - Name
Set to Defend.
Add the last one.
- Type
Select End.
This will do nothing and end the combatant’s turn. - Name
Set to Do nothing ….
That’s it for the battle menu – click on Save Settings.
And that’s it for now – the next lesson will cover Enemies and Battle AI.