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

Status System Setup

  • START Status System Setup
  • 01 Status Values
  • 02 Status Development
  • 03 Attack/Defence Modifiers
  • 04 Status Effects
  • 05 Formulas
  • 06 Ability & Item Types
  • 07 Abilities Part 1: Attacks
  • 08 Abilities Part 2: Support & Sabotage
  • 09 Abilities Part 3: Elemental Magic
  • 10 Items
  • 11 Equipment Part 1: Slots & Slot Set Templates
  • 12 Equipment Part 2: Weapons
  • 12.5 (Optional) Equipment Part 2.5: Weapons
  • 13 Equipment Part 3: Shields, Armor & Accessories
  • 13.5 (Optional) Equipment Part 3.5: Shields, Armor & Accessories
  • 14 Equipment Part 4: Available Equipment Templates
  • 15 Loot
  • 16 Battle AIs
  • 17 Combatants Part 1: General Settings
  • 18 Combatants Part 2: Players
  • 19 Combatants Part 3: Enemies
  • 20 Combatant Groups
  • END Status System Setup

3D RPG Playground

  • START 3D RPG Playground
  • 01 Player Setup
  • 02 Start Menu
  • 03 First Interaction
  • 04 Music
  • 05 Areas
  • 06 Collecting Items
  • 07 Displaying Equipment
  • 08 Combatant Prefabs, Icons & Portraits
  • 09 Combatant Animations
  • 10 Camera Positions
  • ANIM 01 Battle Start/End Schematics
  • ANIM 02 Use, Cast & Camera
  • ANIM 03 Abilities & Items
  • ANIM 04 Physical Attacks
  • ANIM 05 Special Actions
  • BATTLE 01 Battle Menu
  • BATTLE 02 Prepare for Battle
  • TURN 01 Turn Based Setup
  • TURN 02 Turn Order HUD
  • ATB 01 Active Time Setup
  • ATB 02 Cast Times
  • ATB 03 Timebar HUD
  • BATTLE 03 The First Battle
  • BATTLE 04 Hunting Move AI
  • BATTLE 05 Spawning Combatants
  • 11 Save Games
  • MENU 01 UI Boxes
  • MENU 02 Template HUDs
  • MENU 03 Overview Menu
  • MENU 04 Menu Screens
  • 12 Shop
  • BATTLE 06 Random Battles
  • DUNGEON 01 Enter the Dungeon
  • DUNGEON 02 The Trapdoor
  • DUNGEON 03 Enemies on Level 1 & 2
  • DUNGEON 04 Traps on Level 3
  • DUNGEON 05 Going Deeper
  • 13 Bestiary (+MENU+ANIM)
  • QUEST 01 Hunting Quests (+MENU)
  • QUEST 02 Guard NPC
  • QUEST 03 Forest Ruin Cheese
  • QUEST 04 Witch NPC with Cheese
  • QUEST 05 Quest Mark HUDs
  • 14 Research Trees (+MENU)
  • CRAFT 01 Crafting Materials
  • CRAFT 02 Crafting Recipes
  • CRAFT 03 Crafting Menu
  • CRAFT 04 Crafting Proficiency & Critical Crafting
  • CRAFT 05 Materials Loot
  • 15 Changing Choice Dialogue
  • 16 Follow Me!
  • BATTLE 07 Sequence Loot Dialogue

3D Action RPG

  • START 3D Action RPG
  • 01 Status System Setup
  • 02 Player Setup
  • 03 Player Weapon
  • 04 Player Attacks
  • 05 Enemy: Chomper
  • 06 Chomper Attack
  • 07 Hit & Death
  • 08 HUDs
  • 09 Rolling on the Floor
  • 10 Enemy: Spitter
  • 11 Spit Attack
  • 12 Potion
  • 13 Grenade
  • 14 Item HUD
  • 15 Enemy: Grenadier
  • 16 Grenadier Melee Attacks
  • 17 Grenadier Flamethrower
  • 18 Item Drops
  • END 3D Action RPG

2D Grid Battle RPG

  • START 2D Grid Battle RPG
  • 01 Player Setup
  • 02 Prefab & Music Setup
  • 03 Randomizing Combatants
  • 04 UI Setup
  • 05 Battle Start, End & Phase Schematics
  • 06 Battle System Setup
  • 07 Battle Grid Setup
  • 08 Grid Move
  • 09 Forest Battle Grid
  • 10 Battle AI
  • 11 Ability Ranges
  • 12 Death & Use Schematics
  • 13 Attack Schematic
  • 14 Shoot Schematics
  • 15 Battle Selection Interaction
  • END 2D Grid Battle RPG

Schematics

  • Simple Start Schematic
  • Battle Start Schematic
  • Battle End Schematic
  • Moving to Target and Back
  • Animating a Base Attack
  • Animating a Magic Ability
  • Grid Movement
  • Open and Close UI Animations
  • Flying Text Mover

UI Setups

  • Unity UI: Initial Setup
  • Unity UI: TextMesh Pro Setup
  • Unity UI: UI Box
  • Unity UI: Flying Text
  • Unity UI: Dragging Notification
  • Unity UI: Interaction HUD
  • Unity UI: Simple Player HUD
  • Unity UI: Quest HUD
  • Unity UI: Shortcuts HUD
  • Unity UI: Currency HUD
  • Unity UI: Tooltip HUD
  • Unity UI: Control HUD
  • Unity UI: Attack Modifiers
  • Unity UI: Defence Modifiers

Gameplay Bits

  • Combining Input Origins
  • Combining Status Value Flying Texts
  • Fun With Flying Text
  • HUD Effects With Conditional Schematics
  • Inventory Containers
  • Multi Interaction Controllers
  • World Space HUD
  • World Space Dialogue
  • Home
  • Guide
  • Tutorials
  • 3D RPG Playground
  • BATTLE 04 Hunting Move AI

BATTLE 04 Hunting Move AI

Table of Contents
  • Idle Schematic
    • Wait
  • Move AI Setup
    • Base Settings
      • Move Range
      • Auto Stop
      • Speed Settings
    • Waypoint Settings
      • Idle Settings
    • Enemy Detection
      • Target Position Check
    • Hunting Settings
  • Combatants General Settings
    • Default Movement Component
    • Default Move AI
  • Radius for Combatants

In this tutorial we’ll set up a simple move AI to let enemies hunt the player.

This tutorial continues the sub-series for setting up battles.

Move AIs are used to let combatants determine targets for movement, while the actual movement is handled by the combatant’s movement component setup. Learn more about move AIs in this documentation.

In the next tutorial we’ll spawn our enemies in the field and start battles when getting close to them – for this, we want them to hunt the player, so we’ll set up a simple hunting move AI.

Idle Schematic #

First, we’ll set up a simple schematic that’ll be used to animate a combatant’s idle behaviour between two waypoints. We’ll just use a random wait time, though.

Wait #

Add Node > Base > Wait

We’ll wait for a random time between 1 and 5 seconds.

  • Random
    Enable this setting.
  • Time
    Select Value > Value.
    Set the value to 1.
  • Time 2
    Select Value > Value.
    Set the value to 5.

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

Move AI Setup #

Navigate to Combatants > Move AI, we’ll change the Default move AI.

Base Settings #

  • Name
    Set to Hunt.

Move Range #

We’ll limit the range a combatant will move in – this is measured from the combatant’s spawn position.

  • Use Move Range
    Enable this setting.
  • Range
    Select Value > Value.
    Set the value to 10.

Auto Stop #

  • Use Auto Stop
    Disable this setting.
    We’ll not use this, but it can be useful, depending on the movement component you’re using for your combatants.

Speed Settings #

These settings define at which speed a combatant moves for different modes. The default settings are enough, we’ll just change the Waypoint Speed.

  • Speed Type (Waypoint Speed)
    Select Walk.
    This’ll use the combatant’s walk speed.
    The Speed setting is only used as a fallback if no walk speed could be determined.

Waypoint Settings #

These settings handle waypoint movement, either for randomly selected positions or fixed waypoints defined by a Combatant Spawner or Add Combatant component used to add the combatant to the scene.

  • No Combatant Radius
    Enable this setting.
  • Enable Random Patrol
    Enable this setting.
    We’ll randomly patrol within a defined area.
  • Patrol Radius
    Set to 10.

Idle Settings #

  • Enable Idle
    Enable this setting.

Click on Add Idle Schematic.

  • Schematic Asset
    Select the RandomPatrolWait schematic we just created.

Enemy Detection #

These settings handle how the combatant will detect enemies. We’ll detect enemies on sight within 10 world units and within an angle of 90 degrees of the forward direction of the combatant

  • Use Enemy Detection
    Enable this setting.
  • Timeout
    Set to 0.5.
  • Range
    Select Value > Value.
    Set the value to 10.

Click on Add Detection.

  • Type
    Select Sight.
  • Use Raycast
    Enable this setting.
    We’ll do a line of sight check.
  • Layer Mask
    Select the Default layer (only).
    To first unselect all other layers, select the Nothing layer, followed by the Default layer.
  • Use Child (User)
    Set to Head.
  • Use Child (Target)
    Set to Head.
  • Angle
    Set to 90.

Target Position Check #

  • Lost Position Check
    Enable this setting.
    When the detected target leaves the detection range, the combatant will keep following it until the lost interval runs out.
    Otherwise the combatant will move to the last known position.

The target checks define how often the target’s new position is forwarded to the movement component – depending on the used component (we’ll use NavMesh) this can be more or less performance heavy. We’ll add different checks do increase the update interval when the target gets closer.

  • Interval
    Set to 0.
  • Minimum Distance
    Set to 0.

Click on Add Target Check.

  • Interval
    Set to 0.2.
  • Minimum Distance
    Set to 2.

Click on Add Target Check.

  • Interval
    Set to 0.5.
  • Minimum Distance
    Set to 5.

Click on Add Target Check.

  • Interval
    Set to 1.
  • Minimum Distance
    Set to 10.

Hunting Settings #

We don’t have to do more than just enable hunting.

  • Use Hunting
    Enable this setting.

Combatants General Settings #

Now we’ll set up the default movement component (which will handle the actual movement) and default move AI used by our combatants. The combatant directly controlled by the player will never use a move AI – in case you spawn other members of the player group, they can use a move AI, e.g. to follow the player around.

Navigate to Combatants > Combatants > General Settings.

Default Movement Component #

The scenes are set up for NavMesh, so that’s what we’re using to move the combatants.

  • Component Type
    Select Nav Mesh Agent.
  • Add Component
    Enable this setting.

Default Move AI #

  • Use Move AI
    Enable this setting.
  • Move AI
    Select Hunt.

And that’s it for the editor setup – don’t forget to save your changes by clicking on Save Settings at the bottom of the editor.

Radius for Combatants #

The move AI’s range checks (and other range checks) can also take the radius of a combatant into account. You can set up a radius by adding a Radius component to the combatant prefabs – and that’s what we’ll do.

The setup is pretty simple, just add a Radius component to all combatant prefabs found in Assets/Tutorial Assets/Prefabs/Combatants/Enemies/ and Assets/Tutorial Assets/Prefabs/Combatants/Player/.

The Radius component will automatically set the radius based on the game object’s collider (Character Controller in case of our combatant prefabs) when added.

You can select multipe prefabs and add the combatant to all of them at once.

 

And that’s it for the move AI (and radius) setup!

Next, we’ll look into spawning combatants in our scenes.

Share This Article :
  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
Updated on December 17, 2021
Table of Contents
  • Idle Schematic
    • Wait
  • Move AI Setup
    • Base Settings
      • Move Range
      • Auto Stop
      • Speed Settings
    • Waypoint Settings
      • Idle Settings
    • Enemy Detection
      • Target Position Check
    • Hunting Settings
  • Combatants General Settings
    • Default Movement Component
    • Default Move AI
  • Radius for Combatants
Sitemap
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • API
  • ORK 2 Hub
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get ORK
  • Contact
  • Blog
  • Makinom
  • gamingislove.com
Categories
  • News (59)
  • ORK 2 (137)
    • Tutorial (137)
      • Game tutorial (50)
      • Gameplay (32)
      • How-to (55)
  • Release (129)
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!