05 Battle Start, End & Phase Schematics

In this tutorial we’ll set up schematics to animate some things in our battles.

We’ll set up schematics for handling different parts of our battle – the battle’s start (setting up the battle), the battle’s end and changing the phase (i.e. showing who’s phase it is).

We’ll set up:

  • battle start schematic
  • battle end schematic
  • phase change schematics

Let’s get to it.

Battle Start Schematic #

Our battle will start automatically when loading into it’s scene – the scene load there will only fade out the screen, not fade back in. This allows us to do the initial battle setup before fading in the screen.

We’ll also let the player place combatants manually (the setup for this is handled in the next tutorial).

Navigate to Schematics and start working on a new schematic.

Settings #

Since we’ll only spawn the enemy combatants and let the player select and place their combatants as they want, we need to add an actor for the enemies of the battle.

Actors #

Click on Add Actor.

  • Actor Type
    Select Enemies (Battle).

Show Battle Grid #

Add Node > Battle > Grid > Show Battle Grid

This node is used to show or hide the grid of a battle.

We’ll show the grid – you can also set up a battle grid to automatically show when the scene is loaded, in which case this node isn’t needed.

  • Show/Hide
    Enable this setting.

Spawn Battle Combatants #

Add Node > Battle > Spawn > Spawn Battle Combatants

We’ll only spawn the enemies.

  • Spawn All
    Disable this setting.
  • Object
    Select Actor 0: Enemies.

Show Dialogue #

Add Node > UI > Dialogue > Show Dialogue

We’ll show a battle message – since our UI box for this is displayed above the screen fader, we’ll be able to show it even with faded out screen.

  • Dialogue Type
    Select Auto Close.
  • UI Box
    Select Battle Message.
  • Block Accept Button
    Enable this setting.
  • Close After
    Set to 5.
  • Wait
    Disable this setting.
  • Text (Message Content)
    Set to: <color=#FF0000FF>Get Ready!</color>

Wait #

Add Node > Base > Wait

We’ll wait for a second.

  • Time
    Select Value > Value.
    Set the value to 1.

Camera Control Target #

Add Node > Input > Camera Control Target

This node is used to change the target of a built-in camera control (or a custom control that extends from the BaseCameraControl class).

We’ll target the Machine Object, which is the game object the Battle component will be on. We do this to be able to control the camera and pan using screen edge panning (we set that up earlier). Otherwise there’d be no target for the camera due to no player being spawned.

  • Target Type
    Select Game Object.
  • Object (Target Object)
    Select Machine Object.

Fade Screen #

Add Node > Animation > Fade > Fade Screen

We’ll now fade in the screen.

  • Wait
    Enable this setting.
  • Time
    Set to 0.5.
  • Fade Alpha/Red/Green/Blue
    Enable these settings.

The default fade screen setup is for fading out, just click on Swap Colors to switch to fading in.

This should now have the Start Color as a black color with full alpha and the End Color as a black color with no alpha.

Player Grid Placement #

Add Node > Battle > Spawn > Player Grid Placement

This node will start using the grid placement selection for the player combatants – we’ll set up the details for this in the next tutorial.

Our grid placement will be set up to define which combatants are part of the battle group – so want the player to place at least 1 combatant to be able to fight.

  • Allow Cancel
    Enable this setting.
    We allow the player to cancel out of the placement.
  • Cancel Resets
    Disable this setting.
    Canceling will not reset, i.e. already placed combatants will be used.
  • Needs 1 Placed
    Enable this setting.
    The player needs to place at least one placed combatant to be able to cancel.

And that’s it for the schematic. Click on Save Schematic to save it, e.g. as BattleStart.

Battle End Schematic #

Usually you’d set up separate schematics for victory, escape or defeat, but you can also use the same schematic and check the battle’s outcome in it.

We’ll do this, since all our battle endings will simply take us back to town.

Create a new schematic.

Check Battle Outcome #

Add Node > Battle > Battle > Check Battle Outcome

This node checks the outcome of the battle and has a next slot for each possible outcome.

No further settings.

Change Music #

Add Node > Audio > Music > Change Music

In case we win, we play the victory music.

This node is connected to the Victory slot of the Check Battle Outcome node.

  • Play Type
    Select Play.
  • Music
    Select Victory.

Show Dialogue #

Add Node > UI > Dialogue > Show Dialogue

We’ll show a victory message.

  • Dialogue Type
    Select Auto Close.
  • UI Box
    Select Battle Message.
  • Block Accept Button
    Enable this setting.
  • Close After
    Set to 5.
  • Wait
    Disable this setting.
  • Text (Message Content)
    Set to: <color=#00FF00FF>BATTLE WON!</color>

Wait #

Add Node > Base > Wait

  • Time
    Select Value > Value.
    Set the value to 3.

Collect Battle Gains #

Add Node > Battle > Gains > Collect Battle Gains

We collect the battle gains (if there are any) – i.e. we don’t show them for our tutorial, as that’s not the topic.

Check out the 3D RPG Playground tutorials for showing battle gains.

  • Show Gains
    Disable this setting.

Wait #

Add Node > Base > Wait

  • Time
    Select Value > Value.
    Set the value to 1.

Load Scene #

Add Node > Game > Scene > Load Scene

We’ll load back into the Town scene.

Set the scene of the already added Target Scene 0 settings.

  • Target Scene
    Set to Town.
  • Position Type
    Select Spawn ID.
  • Spawn ID
    Select Value > Value.
    Set the value to 0.

Change Music #

Copy the previous Change Music node. In case we’re defeated, we play the lost music.

This node is connected to the Defeat slot of the Check Battle Outcome node.

  • Music
    Select Lost.

Show Dialogue #

Copy the previous Show Dialogue node, we’ll now show a battle lost message.

  • Text (Message Content)
    Set to: <color=#FF0000FF>BATTLE LOST!</color>

Clear Battle Gains #

Add Node > Battle > Gains > Clear Battle Gains

We lost, so we remove any battle gains we might have earned.

The default setup is already correct (clearing everything).

This node connects to the 3 second Wait node.

Show Dialogue #

Copy the previous Show Dialogue node, we’ll now show an escape message.

This node is connected to the Escape slot of the Check Battle Outcome node. The node’s Next slot connects to the Clear Battle Gains node.

  • Text (Message Content)
    Set to: <color=#FF0000FF>BATTLE LOST!</color>

And that’s it for the schematic. Click on Save Schematic to save it, e.g. as BattleEnd.

Player Phase Schematic #

Phase battles can use schematics at the start and end of a phase – this allows you to do some setup or animate the changing phase.

We’ll use it to show a battle message, announcing who’s phase it is. Let’s start with the player’s phase.

Create a new schematic.

Camera Control Target #

Add Node > Input > Camera Control Target

We’ll target the Machine Object, which contains all members of this phase – i.e. the camera will target the first member in the list.

  • Target Type
    Select Game Object.
  • Object (Target Object)
    Select Machine Object.

Show Dialogue #

Add Node > UI > Dialogue > Show Dialogue

We’ll show that it’s the player’s phase.

  • Dialogue Type
    Select Auto Close.
  • UI Box
    Select Battle Message.
  • Block Accept Button
    Enable this setting.
  • Close After
    Set to 5.
  • Wait
    Disable this setting.
  • Text (Message Content)
    Set to: <color=#00FF00FF>Player Phase!</color>

Wait #

Add Node > Base > Wait

  • Time
    Select Value > Value.
    Set the value to 1.

And that’s it for the schematic. Click on Save Schematic to save it, e.g. as PlayerPhase.

Enemy Phase Schematic #

The enemy phase schematic will simply change the displayed message, i.e. we keep working on the current schematic.

We’ll simply change what we need to for this variation and use Save Schematic As to save it as a new schematic.

Show Dialogue #

  • Text (Message Content)
    Set to: <color=#FF0000FF>Enemy Phase!</color>

And that’s it for the schematic. Click on Save Schematic As … to save it, e.g. as EnemyPhase.

 

Next, we’ll set up the battle system.