ORK Framework Logo - RPG Editor for Unity
  • ORK 4 BETA
  • Features
  • Guide
    • Documentation
    • Tutorials
    • API
  • ORK 2
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get ORK

ORK 4 Documentation

  • Getting Started
    • Welcome
    • First Steps (Unity)
  • Features
    • The Status System
    • Schematics
    • Schematic Nodes
    • Dialogue Importer
    • Variables
    • Selected Data
  • Components
    • Battle Components
    • Combatant Components
    • Control Components
    • Cursor Prefab Components
    • Game Starters
    • Interactable Components
    • Move AI Components
    • Scene Setup Components
  • Editor
    • The ORK 4 Editor
    • Sections & Sub-Sections
    • Node Editor
    • Schematic Editor
    • Asset Sources
    • Unity Overlay Toolbar
  • Section: System
    • System Settings
    • Languages
    • Organizer Types
    • Game States & Conditions
    • General Condition Templates
    • Object Pools
    • Prefab Savers
    • Scene Connections
  • Section: Controls
    • Game Controls
    • Interaction Settings
    • Player Controls
    • Camera Controls
    • Input Keys
    • Control Maps
    • Camera Positions
    • Battle Camera
  • Section: Gameplay
    • Game Settings
    • Formulas
    • Difficulties
    • Shortcut Slots & Settings
    • Custom Settings & Global Custom Settings
    • Global Machines
    • Machine Templates
  • Section: Status
    • Status Values
    • Status Effects
    • Attack Modifiers
    • Defence Modifiers
    • Abilities & Ability Developments
    • Status Developments
    • Research Trees
    • Damage Types
    • Status Bonuses & Templates
    • Status Condition Templates
  • Section: Inventory
    • Inventory Settings
    • Inventory Containers
    • Currencies
    • Items
    • AI Rulesets
    • Crafting Recipes
    • Equipment Slots & Slot Set Templates
    • Equipment & Available Equipment Templates
    • Shops
    • Loot
  • Section: Combatants
    • Combatants
    • Combatant Groups
    • Class Slots
    • Classes
    • Factions & Faction Benefits
    • Animations
    • Move AIs
    • Formations
    • Action Combos
  • Section: Battles
    • Battle Systems
    • Turn Based Battles
    • Active Time Battles
    • Real Time Battles
    • Phase Battles
    • Battle Spots
    • Battle AIs
    • Battle Actions Settings
    • Special Commands Settings
    • Target Settings
    • Target Selection Templates
    • Battle Range Templates
    • Battle Grid Settings
    • Battle Grid Highlights
    • Battle Grid Cell Types
    • Battle Grid Formations
  • Section: Content
    • Content Types
    • Music
    • Sound Templates
    • Areas
    • Teleports
    • Quests & Quest Tasks
    • Logs & Log Texts
    • Object Contents
  • Section: UI
    • UI Settings
    • UI Layers
    • UI Layouts
    • UI Boxes
    • HUDs
    • Notifications
    • Cursor Settings
  • Section: Menus
    • Start Menu
    • Save Game Settings
    • Option Categories
    • Menu Screens
    • Menu Requirements
    • Battle Menus
    • Loot Dialogues
    • Item Collection
    • Combatant Selections
    • Quantity Selections
    • Shop Layouts
  • Section: Texts
    • Text Settings
    • Formatting Settings
    • Flying Texts
    • Use Cost Display
    • Status Preview Display
    • Bonus Display
    • Status Change Display
    • Console Settings & Console Types
    • Text Codes
  • Sections: Editor
    • Editor Settings
    • Backups
    • Variables
    • Plugins
  • Scripting
    • Access Handler
    • Custom Nodes
    • Custom Save Data
    • Custom Component Save Data

ORK 4 Tutorials

  • ORK 4 Unity Quickstart Tutorials (3D)
    • ORK 4 Unity Quickstart 3D
    • 01 Initial ORK Setup
    • 02 Player Setup
    • 03 Music & Scenes
    • 04 UI System Setup
    • 05 UI Boxes
    • 06 Flying Texts
    • 07 Status Values
    • 08 Status Effects
    • 09 First Abilities
    • 10 Fighter Setup
    • 11 First Enemies & Battle AI
    • 12 Battle System Setup
    • 13 Animating Battle Start and End
    • 14 Random Battles
    • 15 Animating Actions
    • 16 Player Battle HUD
    • 17 Elemental Attacks
    • 18 Animating More Actions
    • 19 Inventory & Loot
    • 20 Equipment
    • 21 Loot, Start Equipment & Viewers
    • 22 Magic Abilities
    • 23 Caster Setup
    • 24 More Enemies
    • 25 Start Menu & Save Games
    • 26 Menu Screens
    • 27 Interactions
    • 28 Item Collectors
    • Quickstart Extended
  • Battle Tutorials
    • Active Time Battles
    • Phase Battles
    • Hit & Miss
    • Critical Hits
    • Cast Time
    • Grid 01: Battle Grid Setup
    • Grid 02: Highlights
    • Grid 03: Cell Types
    • Grid 04: Move Command
    • Grid 05: Scene Grid Setup
    • Grid 06: Battle Ready
    • Grid 07 Use & Affect Ranges
    • Grid 08: Better Camera Control
  • Gameplay Tutorials
    • Multiple Interaction Controllers
    • Player Group Spawn & Follow
    • Spawn Hunting Enemies
    • Gamepad Controls (Unity Input System)
    • Combined Inputs
    • Quests 01: Menu Screen
    • Quests 02: Hunting
    • Quests 03: Collect Potion Materials
    • Quests 04: Collect Equipment Materials
    • Quests 05: Quest Mark HUDs
    • Crafting 01: Menu Screen
    • Crafting 02: Materials & Recipes
    • Crafting 03: Getting Materials
    • Crafting 04: Proficiency & Critical Outcome
    • Shop
    • Inventory Containers
  • Schematics Tutorials
    • UI Animation Schematics
    • Flying Text Animation Schematics
    • HUD Conditional Schematics
  • UI Tutorials
    • Unity UI: Initial Setup
    • Unity UI: Status Value UI Setup
    • Unity UI: Status Effect UI Setup
    • Unity UI: Shortcut UI Setup
    • Unity UI: Dragging Notification
    • Unity UI: Interaction HUD
    • Unity UI: Shortcut HUD
    • Unity UI: Turn Order HUD
    • Unity UI: Cast Time HUD
    • Unity UI: Quest HUD
    • Unity UI: Tooltip HUD
    • Unity UI: Move Range HUD

ORK 4 Extensions

  • Plugins
    • Save Game Compression Plugin
  • Schematic Nodes
    • Footstepper Nodes (Unity)
  • Scripts
    • A* Pathfinding Movement Component (Unity)
    • PolyNav 2D Movement Component (Unity)
    • Cinemachine Camera Control Type (Unity)
    • Rewired Input Key (Unity)
    • Unity Legacy Input Key (Unity)
    • Core GameKit Wrapper (Unity)
    • Pool Boss Wrapper (Unity)
View Categories
  • Guide
  • ORK 4
  • ORK 4 Tutorials
  • Battle Tutorials

Grid 04: Move Command

In this tutorial we’ll set up the grid move command.

This tutorial is part 4 of a mini-series covering grid battles. You can find the start of this series here.

The grid move command is used by combatants to perform movement on the grid. For the player this involves a move target cell selection – using the highlights we set up earlier the player will see the move range and path during the selection. The actual movement is handled by a schematic, like any action used in battle.

We’ll set up:

  • grid move schematic
  • move range formula
  • move command
  • update phase battle action cost
  • add grid move command to battle menu
  • add battle AI using grid move command (and add to combatants)

This tutorial is based on the ORK 4 Unity Quickstart 3D tutorials and using a phase battle system, but can be used in any project and with any battle system.

Grid Move Schematic #

We’ll start with the schematic.

We’ll create a simple schematic to animate the grid move action. We’ll follow the selected path cell by cell, performing possible grid cell events on the cells we move over/to.

Movement is handled using the Change Position node – the setup described here will use the Auto move component selection. This’ll try to select the appropriate component for movement, but this might not result in the desired outcome for all setups. If movement doesn’t work in your setup, try one of the different move components based on your setup (e.g. Character Controller or Combatant Movement Component).

The user of the action is the Machine Object of the schematic, the path from the user’s current position to the target position can be accessed via nodes.

Check Grid Path Length #

Add Node > Battle > Grid Path > Check Grid Path Length

We’ll first check if there even is a grid path, i.e. if it’s length is greater than 0.

  • Check Type
    Select: Is Greater
  • Check Value
    Select: Value > Value
    Set the value to: 0

Store Grid Path #

Add Node > Battle > Grid Path > Store Grid Path

This node is used to store a cell from the path into selected data – you can either store the whole path, the next or last cell.

We’ll store the next cell on the path and also remove the cell from the path, so that we can later continue with the next cell after this one.

This node is connected to the Success slot of the previous node.

  • Data Key
    Set to: cell
  • Data Origin
    Select: Local
  • Change Type
    Select: Set
  • Cell Selection
    Select: Next
  • Remove Cell
    Enable

Change Position #

Add Node > Movement > Movement > Change Position

We’ll now move the user (Machine Object) to the stored cell.

  • Object (Moving Object)
    Select: Machine Object
  • Move Component
    Select: Transform
    Please note that you might need to use a different selection based on your setup.
  • To Object
    Enable
  • Object (Target Position)
    Select: Selected Data
  • Data Key
    Set to: cell
  • Data Origin
    Select: Local

We’ll move to the cell instead of setting directly to the position.

  • Move
    Enable
  • Wait
    Enable
    We wait for the movement to finish before continuing.
  • Apply Gravity
    Enable
  • Face Direction
    Enable
  • Rotate Component
    Select: Transform
    Just like the Move Component, this might need a different component based on your setup.
  • Move By Speed
    Disable
    We’ll interpolate to the new position.
  • Time
    Select: Value > Value
    Set the value to: 0.25
  • Interpolation
    Select: Linear

You can also enable Move By Speed and move at a fixed speed instead.

Set Grid Cell Combatant #

Add Node > Battle > Grid Cell > Set Grid Cell Combatant

We’ll register the combatant on the cell we just moved to.

  • Object (Combatant Settings)
    Select: Machine Object
  • Set As
    Select: Move
    This’ll register the combatant as moving on the cell.
    In case another combatant is already on the cell it’ll not replace it.
  • Object (Grid Cell Settings)
    Select: Selected Data
  • Data Key
    Set to: cell
  • Data Origin
    Select: Local

Check Grid Path Length #

Copy the first Check Grid Path Lengt node.

We’re done with our move to the next cell, so we’ll check if we finished the path.

Grid Cell Event #

Add Node > Battle > Grid Cell Event > Grid Cell Event

We don’t use grid cell events in our tutorial, but it’s always good to have them included in your grid move in case you later add them.

Grid cell events perform certain things when a combatant moves over or moves to a cell, or starts/ends their turn on a cell. E.g. you can change status effects, use schematics or an ability on the combatant.

This node is connected to the Success slot of the previous Check Grid Path Length node, i.e. we still have some of the path left to go.

The Next slot of this node is connected back to the Store Grid Path node.

  • Start Type
    Select: Move Over
    We’re continuing on the path, i.e. we move over this cell.
  • Wait
    Enable

The rest of the setup should already be correct:

  • Object (Cell Object)
    Select: Selected Data
  • Data Key
    Set to: cell
  • Data Origin
    Select: Local
  • Object (Combatant)
    Select: Machine Object

Grid Cell Event #

Copy the previous Grid Cell Event.

This node is connected to the Failed slot of the previous Check Grid Path Length node, i.e. we’re done with our move.

  • Start Type
    Select: Move To
    We’re done with the path, i.e. we move to this cell.

Wait (Optional) #

Add Node > Base > Wait

We’ll wait for a short time, just to slow things down a bit.

  • Time
    Select: Value > Value
    Set the value to: 0.5

And that’s it for the schematic. Click on Save Schematic to save it as GridMove.

Move Range Formula #

Grid movement is based on a move range available to a combatant.

We’ll use a formula to calculate the move range based on the AGI status value. The formula will divide AGI by 5 (i.e. 1 point every 5 AGI) and add a base move range of 3.

Open the ORK editor, navigate to Gameplay > Formulas and add a new formula.

Formula Settings #

We’ll limit the move range t0 20 (cells), we handle this via the maximum value of the formula.

  • Name
    Set to: Move Range
  • Use Maximum Value
    Enable
  • Maximum Value
    Select: Value > Value
    Set the value to: 20

Status Value #

Add Node > Combatant > Status Value

We add the agility of the user.

  • StatusValue
    Select: AGI

Value #

Add Node > Value > Value

We now divide by 5.

  • Operator
    Select: Divide
  • Value
    Select: Value > Value
    Set the value to: 5

Value #

Add Node > Value > Value

Add 3 for our base move range.

  • Operator
    Select: Add
  • Value
    Select: Value > Value
    Set the value to: 3

Math Function #

Add Node > Base > Math Function

This node is used to use a defined math function on the formula’s result.

We’ll use it to round the current value, e.g. 5.4 will become 5, 5.6 will become 6.

  • Math Function
    Select: Round

That’s it for the formula

Move Command Setup #

With all our needed parts set up, we can now set up the move command.

Navigate to Battles > Battle Grid Settings and change the Move Command settings.

Move Command #

  • Use Only Once
    Enable
  • Player (Use Only Once)
    Disable
    Player combatants can use grid movement as long as they have move range left.
    Keep the others enabled, i.e. enemies can only move once.
  • Allow Cancel
    Enable
  • Use Shortest Path
    Enable
  • Move Over Allies/Enemies
    Disable
    We can’t move over cells that are already occupied by another combatant.
    Enable these settings in case you want to allow moving over other combatants.
  • Default Move Range
    Select: Value > Formula
    Select formula: Move Range
  • Camera Control Target
    Enable
    The camera will target the selected cell during the grid move cell selection.

Default Battle Animation #

This is where we set up our grid move schematic – combatants can optionally override the default animation.

Click on Add Battle Animation.

  • Schematic Asset
    Select: GridMove

Update Phase Battle Action Cost #

If you’re using the phase battle system setup, we’ll also adjust the action cost for grid movement. Instead of the default 2 AP, it should only cost 1 AP.

Navigate to Battles > Battle System and select the Phase battle system.

Action Settings #

  • Own Grid Move Cost
    Enable
  • Action Cost
    Select: Value > Value
    Set the value to: 1

Battle Menu #

Next we’ll add the grid move command to the battle menu.

Navigate to Menus > Battle Menus and select the Default battle menu.

Copy Option 0 (the Attack command) and change the newly added copy (Option 1).

  • Type
    Select: Grid Move
  • Use Action Info
    Enable
    This’ll use the content information of the grid move command and also display the action costs.

Battle AI #

We’ll add a new battle AI that handles grid movement for the enemies. The battle AI will move to the nearest alive enemy of the user.

Navigate to Battles > Battle AIs and add a new battle AI.

Battle AI Settings #

  • Name
    Set to: Grid Move

Check Status #

Add Node > Combatant > Check Status

We’ll find an alive enemy before selecting the nearest of them.

  • Found Targets
    Select: Clear
  • Target
    Select: Enemy

Click on Add Status Condition.

  • Status Needed
    Select: Death
  • Is Dead
    Disable

Get Nearest #

Add Node > Position > Get Nearest

We’ll now selected the nearest found target (i.e. the nearest alive enemy).

This node is connected to the Success slot of the previous Check Status node.

  • Found Targets
    Select: Check
  • Target
    Select: None
  • Use Grid Distance
    Enable

Grid Move #

Add Node > Action > Grid Move

This node selects a path to a target (cell) and uses the grid move action. We’ll move to the found target (i.e. the nearest enemy).

  • Move Type
    Select: Move Toward Target
  • Target Cell
    Select: Nearest

Target Cell Settings #

These settings define which cells around the target are valid to move to – we’ll use the default setup, i.e. a distance of 1.

  • Range Type
    Select: Distance
  • Minimum Distance
    Set to: 1
  • Maximum Distance
    Set to: 1

Updating Combatants #

We’ll add the grid move battle AI to our combatants.

Navigate to Combatants > Combatants.

We’ll add the new battle AI to the General Settings and the following combatants:

  • Spider
  • Skeleton
  • Slime

These combatants replace the default battle AI instead of adding to it, so we need to add the new battle AI to them individually.

The setup is the same for all, so repeat it for the general settings and 3 combatants.

AI Settings > Battle AI #

We’ll set the grid move battle AI as the first battle AI in the list, i.e. it’ll be used before all other.

Copy Battle AI 0 and change the settings of the original.

  • Battle AI
    Select: Grid Move

Save Changes #

And that’s it for the grid move command setup.

Don’t forget to save your changes by clicking on Save Settings at the bottom of the editor.

The next part of the grid mini-series will finally set up battle grids in our battle arena scenes.

Table of Contents
  • Grid Move Schematic
    • Check Grid Path Length
    • Store Grid Path
    • Change Position
    • Set Grid Cell Combatant
    • Check Grid Path Length
    • Grid Cell Event
    • Grid Cell Event
    • Wait (Optional)
  • Move Range Formula
    • Formula Settings
    • Status Value
    • Value
    • Value
    • Math Function
  • Move Command Setup
    • Move Command
      • Default Battle Animation
  • Update Phase Battle Action Cost
    • Action Settings
  • Battle Menu
  • Battle AI
    • Battle AI Settings
    • Check Status
    • Get Nearest
    • Grid Move
      • Target Cell Settings
  • Updating Combatants
    • AI Settings > Battle AI
  • Save Changes
Sitemap
  • ORK 4 BETA
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • API
  • ORK 2 Hub
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get ORK
  • Contact
  • Blog
  • Makinom
  • gamingislove.com
Categories
  • News (73)
  • ORK 2 (137)
    • Tutorial (137)
      • Game tutorial (50)
      • Gameplay (32)
      • How-to (55)
  • Release (156)
Search

© 2015 Gaming is Love e.U.

Disclosure: This site may contain affiliate links, which means I may receive a commission if you click a link and purchase something that I have recommended. While clicking these links won’t cost you any money, they will help me fund my development projects while recommending great assets!