ORK 4 RPG Framework Logo
  • ORK 4 GUIDE
    • Documentation
    • Tutorials
    • Extensions
    • API
  • ORK 3 GUIDE
    • Documentation
    • Tutorials
    • 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
    • Real TT 01 Real Time Battles & Tab Targeting
    • Real TT 02 Control Map, Use Ranges & Battle Area
    • Real TT 03 Camera Control, Battle AI & Reuse Time
    • Real TT 04 Damage Detection, Action Animation & Player HUD
    • Real TT 05 Switch Player & Final Adjustments
    • Hit & Miss
    • Critical Hits
    • Cast Time
    • Reuse 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
    • Control Map for Keyboard (Shortcuts)
    • Control Map for Gamepad (Shortcuts)
    • 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
    • Menus 01 UI Box Setup
    • Menus 02 Template HUDs
    • Menus 03 Menu Setup
    • Menus 04 Main Menu
    • Menus 05 Inventory
    • Menus 06 Equipment
    • Menus 07 Ability
    • Menus 08 Group
    • Menus 09 Quest
    • Menus 10 Crafting
  • Module 01: Status System
    • Introduction to Modular Tutorials
    • M01.1: Status Values
      • Introduction to Status Values
      • Health
      • Mana
      • Barrier
      • Base Experience
      • Class Experience
      • Spendable Experience
      • Normal Stats
    • M01.2: Modifiers
      • Introduction to Modifiers
      • Element
      • Attack Type
      • Size
      • Race
    • M01.3: Status Effects
      • Introduction to Status Effects
      • Buffs
      • Debuffs
      • Poison
      • Regeneration
      • Blind
      • Stun
      • Sleep
      • Silence
      • Enchants
      • Charm
      • Doom
      • Reflect
  • Module 02: Actions
    • Introduction to Actions
    • M02.1: Formulas
      • Introduction to Formulas
      • Physical Damage Formula
      • Magical Damage Formula
      • Hit Chance
      • Critical Chance
    • M02.2: Abilities
      • Introduction to Abilities
      • Base Attack
      • Elemental Magic Spells
      • Steal Ability
      • Drain
      • Healing Spell
      • Cure
      • Buff Abilities
      • Debuff Abilities

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

Real TT 04 Damage Detection, Action Animation & Player HUD

0:00 / 8:05
  • View as Markdown Open this page as plain Markdown (opens in a new tab)
  • Open in ChatGPT Ask questions about this page (opens in a new tab)
  • Open in Claude Ask questions about this page (opens in a new tab)
  • Open in Google AI Studio Ask questions about this page (Google account required) (opens in a new tab)

In this tutorial we’ll set up damage detection, update start/end animations of actions and add a new player HUD.

This tutorial is part 4 of a mini-series covering real time battles with tab targeting. You can find the start of this series here.

We’ll update the enemy move AI to react to damage, change the start and end animations of abilities and items and set up a new player HUD.

This tutorial is based on the ORK 4 Unity Quickstart 3D tutorials using gamepad controls (with combined inputs), cast times and spawning enemies, but can be used in any project.

Update Move AI Detection #

We need to update the enemy’s move AI to detect combatants that damage them.

Open the ORK editor, navigate to Combatants > Move AIs and select the Hunt move AI.

Enemy Detection #

  • Detect On Damage
    Enable

Updating Action Start/End Animations #

If you’ve noticed during battle, using abilities or items will have the user first take a step forward before the action, and try to move back after the action.

This was set up in the quickstart 3D tutorials using the start and end animations for abilities and items. While this works great for the regular arena-style battles, it doesn’t work in real time battle areas.

So, let’s change this and only use them outside of real time battles.

New Start Animation Schematic #

Additionally, we’ll set up a new schematic that’ll rotate toward the target instead.

Open the schematic editor.

Rotate To #

Add Node > Movement > Rotation > Rotate To

This node is used to rotate an object toward another object.

  • Object (Rotating Object)
    Select: Machine Object
  • Rotate Component
    Select: Transform
  • Lock Rotation
    Enable X and Z, disable Y
  • Rotation Target
    Select: Object
  • Object (Rotation Target)
    Select: Starting Object

And that’s it for the schematic – click on Save Schematic and save it as RotateToTarget.

Updating the Settings #

Open the ORK editor and navigate to Battles > Battle Actions.

In case you’ve set up grid battles, you’ll already have multiple start animations set up. We need to change the MoveForward animation to not be used in real time battles and add a new start animation.

Ability Settings > Ability Start Animation (MoveForward) #

  • All Battle Systems
    Disable

Click on Add Battle System.

  • Battle System
    Select: Turn Based

Click on Add Battle System again.

  • Battle System
    Select: Active Time

Now we add a new battle animation.

Click on Add Battle Animation.

  • Schematic Asset
    Select: RotateToTarget

We need to limit it’s use to real time battles.

  • All Battle Systems
    Disable

Click on Add Battle System.

  • Battle System
    Select: Real Time

Ability Settings > Ability End Animation #

  • All Battle Systems
    Disable

Click on Add Battle System.

  • Battle System
    Select: Turn Based

Click on Add Battle System again.

  • Battle System
    Select: Active Time

Item Settings > Item Start Animation #

  • All Battle Systems
    Disable

Click on Add Battle System.

  • Battle System
    Select: Turn Based

Click on Add Battle System again.

  • Battle System
    Select: Active Time

Now we add a new battle animation.

Click on Add Battle Animation.

  • Schematic Asset
    Select: RotateToTarget

We need to limit it’s use to real time battles.

  • All Battle Systems
    Disable

Click on Add Battle System.

  • Battle System
    Select: Real Time

Item Settings > Item End Animation #

  • All Battle Systems
    Disable

Click on Add Battle System.

  • Battle System
    Select: Turn Based

Click on Add Battle System again.

  • Battle System
    Select: Active Time

New Player HUD Prefab #

Instead of using the Player Battle HUD that we set up in the quickstart 3D tutorials, we’ll create a new HUD based on it. We’ll add shortcut slots (to show the reuse times of the abilities) and only display the HUD for the player (i.e. the combatant controlled by the player). Most of the hard work has already been done in the quickstart 3D and shortcut HUD tutorials, we only need to make a few adjustments.

Locate your Player Battle HUD prefab (I’ve saved mine in Assets/UI/HUDs/) and duplicate it – rename the new copy to: Player RT Battle HUD

Open the new prefab for editing. It’ll currently look something like this (depending on which other tutorials you’ve followed with some more text and value bars):

We’ll adjust the position and size, change the background image, add shortcut slots at the bottom and make some layout adjustments.

Rect Transform #

With the root of the HUD selected, we’ll adjust the height and change the placement of the HUD to the bottom center of the screen.

Select the bottom center anchor preset.

Change the settings in this order:

  • Height
    Set to: 170
  • Pivot
    Set to: X=0.5, Y=0
  • Pos Y
    Set to: 0

Horizontal Layout Group #

You’ll notice the text now being in the center of the HUD. We’ll change the layout to align it to the upper left.

  • Child Alignment
    Select: Upper Left

Image #

Change the background image to BeigeBox instead of the current blue one.

  • Image Source
    Select: BoxBeige

Shortcut Slot List #

We’ll add a shortcut slot list setup using either the scene hierarchy’s context menu (ORK Framework > HUD > Shortcut > Shortcut Slot List (Horizontal Layout)) or the ORK toolbar (search for: Shortcut Slot List Horizontal).

The list is added as a child object and the HUD’s layout will try to place it – we don’t want this.

Layout Element #

Add a Layout Element component to the Shortcut Slot List child object of the HUD.

  • Ignore Layout
    Enable

Now, we’re free to place the shortcut slot list how we want.

Rect Transform #

Adjust the position and size, showing the slots at the bottom of the HUD.

Select the bottom stretch anchor preset.

  • Pivot
    Set to: X=0.5, Y=0
  • Left
    Set to: 200
  • Right
    Set to: 10
  • Pos Y
    Set to: 10
  • Height
    Set to: 100

HUD List Content #

The HUD List Content component is responsible for adding the shortcut slots (using prefabs).

  • Prefab
    Select: Shortcut Slot
  • Slot List Type
    Select: Range
    We’ll display a range of slots, from a start index to an end index.
  • Shortcut List Index
    Set to: -1
  • Slot Start Index
    Set to: 1
  • Slot End Index
    Set to: 9

I’m displaying slots 1-9, so 9 slots in total.

Portrait #

And as a last step for the HUD, we’ll adjust the position of the portrait.

Select the Portrait Content child object.

Rect Transform #

Select the middle left anchor preset

  • Pivot
    Set to: X=0, Y=0.5
  • Pos X
    Set to: 0
  • Pos Y
    Set to: 0

And that’s it, save the changes you’ve made to the HUD prefab.

The HUD should now look something like this:

Updating HUD Setup #

With the prefab ready, we can set up the HUD in the editor. We also need to disable using the Shortcut HUD if you’re using it.

We don’t need to turn off the Player Battle HUD, since it doesn’t display due to it’s display conditions anyway. We’d have to set the Show Battle HUD game state for that.

New Player HUD #

Open the ORK editor, navigate to UI > HUDs and add a new HUD.

Base Settings #

  • Name
    Set to: Player Real Time
  • HUD Type
    Select: Combatant
  • Auto Display
    Enable

Combatant Settings #

We’ll only display the HUD for the leader of the player group, i.e. the player combatant.

  • Only Leaders
    Enable
  • Player
    Enable
  • Ally, Enemy
    Disable

Unity UI #

  • UI Layer
    Select: HUD
  • HUD Prefab
    Select: Player RT Battle HUD

Disabling Shortcut HUD #

Select the Shortcuts HUD.

  • Auto Display
    Disable

Save Changes #

We’ll do another test, don’t forget to save your changes by clicking on Save Settings at the bottom of the editor.

Testing #

Alright, we’ve changed another batch of things, let’s see how it plays now.

Hit play and test the real time battle.

https://orkframework.com/wp-content/uploads/ork4_tutorials_gameplay__real_time_battle_demo.mp4

Seems our hard work paid off, the battle is working, we have a HUD, actions are animated correctly.

However, there is one more thing that’s been following us through all these tests … the 2nd player group member (if you’ve set up player group spawning).

We’ll change this in 2 ways:

  • we don’t spawn the other group member
  • we allow changing the player

Also, there’s no game over when the player dies, we’ll change that as well.

We’ll continue in the next part of the real time mini-series.

Table of Contents
  • Update Move AI Detection
    • Enemy Detection
  • Updating Action Start/End Animations
    • New Start Animation Schematic
      • Rotate To
    • Updating the Settings
      • Ability Settings > Ability Start Animation (MoveForward)
      • Ability Settings > Ability End Animation
      • Item Settings > Item Start Animation
      • Item Settings > Item End Animation
  • New Player HUD Prefab
    • Rect Transform
    • Horizontal Layout Group
    • Image
    • Shortcut Slot List
      • Layout Element
      • Rect Transform
      • HUD List Content
    • Portrait
      • Rect Transform
  • Updating HUD Setup
    • New Player HUD
      • Base Settings
      • Combatant Settings
      • Unity UI
    • Disabling Shortcut HUD
  • Save Changes
  • Testing
Sitemap
  • Showcase
  • ORK 4 Guide
    • Documentation
    • Tutorials
    • Extensions
    • API
  • ORK 3 Guide
    • Documentation
    • Tutorials
    • API
  • ORK 2 Hub
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get ORK
  • Contact
  • Blog
  • Makinom
  • gamingislove.com
Categories
  • News (75)
  • ORK 2 (137)
    • Tutorial (137)
      • Game tutorial (50)
      • Gameplay (32)
      • How-to (55)
  • Release (158)
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!