October
20
2013

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 Defence Rate
    Value Type: Select Value.
    Value: Set to 50.
    The base defence 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 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.

Target Settings > Target Selection

The target selection settings define how the target of an item or ability can be selected.

  • Use Menu
    Enable this setting.
    All available targets will be displayed in the battle menu.

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.

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=255, G=255, B=255, A=255).
  • End Color
    Select a blue color (R=126, G=170, B=214, A=255).

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 battle 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 notifications, status effect notifications, 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 BasedActive 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 notification texts (also for the consumable status values) in another tutorial.

Battle End

The battle end settings define how the information at the end of a battle (e.g. found items, level up, etc.) will be displayed.

Base Settings

  • GUI Box
    Select Bottom Dialogue.

The rest of the settings can be used like they’re now.

Battle Menus

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.

Menu Items

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.