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

2D RPG Quickstart

30
  • START 2D RPG Quickstart
  • 01 Initial 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
  • END 2D RPG Quickstart

3D RPG Quickstart

30
  • START 3D RPG Quickstart
  • 01 Initial 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
  • END 3D RPG Quickstart

Status System Setup

24
  • 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

53
  • 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

20
  • 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

17
  • 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

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

UI Setups

16
  • Unity UI: Initial Setup
  • Unity UI: TextMesh Pro Setup
  • Unity UI: UI Box
  • Unity UI: Flying Text
  • Unity UI: Dragging Notification
  • Unity UI: Canvas with Screen Space Camera
  • Unity UI: Interaction HUD
  • Unity UI: Simple Player HUD
  • Unity UI: Quest HUD
  • Unity UI: Battle Actions 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

13
  • 2.5D Setup
  • Body Part Weakpoint
  • Click Attack
  • Combining Input Origins
  • Combining Status Value Flying Texts
  • Fun With Flying Text
  • HUD Effects With Conditional Schematics
  • Inventory Containers
  • Local Multiplayer
  • Multi Interaction Controllers
  • Target Selection Lines
  • World Space HUD
  • World Space Dialogue
  • Home
  • Guide
  • Tutorials
  • 3D Action RPG
  • 06 Chomper Attack
View Categories

06 Chomper Attack

In this tutorial we’ll set up the comper’s attack.

The chomper will use a close range melee attack – we’ll set up:

  • schematic animating the enemy’s attack
  • battle range template for the attack range
  • attack ability
  • battle AI
  • battle system
  • chomper’s prefab (damage dealer/zone)

Let’s get to it.

Chomper Attack Schematic #

The chomper’s attack also uses damage dealers (we’ll set them up later) and combatant animations with partly wait times, similar to the player’s attack.

Like with the player’s attack, this attack can also be canceled, so we need to ensure that certain nodes are executed in any case. This is done by enabling their Execute On Stop setting (at the top of the node’s settings). I’ll note in each node that needs this.

Navigate to Schematics and start working on a new schematic.

Rotate To #

Add Node > Movement > Rotation > Rotate To

This node rotates a game object to face a target, we’ll use it to rotate the user (Machine Object) to the target (Starting Object).

  • Object (Rotating Object)
    Select Machine Object.
  • Rotate Component
    Select Transform.
    We’ll force rotating via the transform.
  • Lock Rotation
    Enable X and Z.
    We’ll only rotate on the Y axis.
  • Rotation Target
    Select Game Object.
  • Object
    Select Starting Object.
  • Fade Rotation
    Enable this setting.
  • Time
    Select Value > Value.
    Set the value to 0.5.
  • Wait
    Enable this setting.
  • Interpolation
    Select Linear.

Combatant Animation #

Add Node > Animation > Combatant > Combatant Animation

We’ll play the combatant’s attack animation.

  • Object
    Select Machine Object.
  • Animation Type
    Select Attack.
  • Wait
    Enable this setting.
  • Normalized Time (Wait)
    Set to 0.4.
  • Store Duration
    Enable this setting.
  • Normalized Time (Store Duration)
    Set to 0.4.
  • Variable Key
    Set to wait.
  • Variable Origin
    Select Local.

Play Sound #

Add Node > Audio > Audio > Play Sound

We’ll play the Attack sound type on the user (Machine Object).

  • Object (Play On)
    Select Machine Object.
  • Use Sound Type
    Enable this setting.
  • Sound Type
    Select Attack.
  • Play One Shot
    Enable this setting.
  • Set Pitch
    Enable this setting.
  • Random Pitch
    Enable this setting.
  • Pitch
    Set to 0.8.
  • Pitch 2
    Set to 1.2.

Activate Damage Dealer #

Add Node > Battle > Action Outcome > Activate Damage Dealer

We’ll handle the damage dealer setup on the combatant’s prefab later, the setup will be similar to the player (i.e. activation via the ability’s tags).

  • Object (Activate On)
    Select Machine Object.
  • Activate
    Enable this setting.
  • Use Action Tags
    Enable this setting.
  • Set Action
    Enable this setting.

Wait #

Add Node > Base > Wait

We’ll now wait for the stored duration.

  • Time
    Select Variable > Float Variable.
  • Variable Key
    Set to wait.
  • Variable Origin
    Select Local.

Activate Damage Dealer #

Copy the previous Activate Damage Dealer node, we’ll now deactivate it again.

This node needs to be executed on stop.

  • Execute On Stop
    Enable this setting.
  • Activate
    Disable this setting.

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

Battle Range Template #

The chomper should have an attack range of 1.5 world units, but use the move AI to get into range when being further away.

There are already different range templates set up in a new project, but we’ll need a range between 1 and 2 (which are set up).

Navigate to Templates > Battle Range Templates and add a new template.

  • Name
    Set Range 1.5.

Range Settings #

We’ll set up the maximum range, raycast line of sight check and using the move AI to move into range.

Maximum Range #

  • Maximum Range
    Enable this setting.
  • Range
    Select Value > Value.
    Set the value to 1.5.

Raycast Line of Sight #

We’ll use child objets on user and target for the raycast.

  • Use Raycast
    Enable this setting.
  • Layer Mask
    Select only the Default layer.
    First select Nothing and then select Default.
  • Use Child (User)
    Select Path.
  • Find Child (User)
    Set to Head.
  • Use Child (Target)
    Select Path.
  • Find Child (Target)
    Set to Head.

Move AI Settings #

  • Move Into Range
    Enable this setting.
    This’ll use the combatant’s move AI to move into range.

While we’re here, let’s adjust 2 other ranges that are already set up to also use line of sight.

Range 4 #

Select the Range 4 template.

Raycast Line of Sight #

  • Use Raycast
    Enable this setting.
  • Layer Mask
    Select only the Default layer.
    First select Nothing and then select Default.
  • Use Child (User)
    Select Path.
  • Find Child (User)
    Set to Head.
  • Use Child (Target)
    Select Path.
  • Find Child (Target)
    Set to Head.

Range 5 #

Select the Range 5 template.

Raycast Line of Sight #

  • Use Raycast
    Enable this setting.
  • Layer Mask
    Select only the Default layer.
    First select Nothing and then select Default.
  • Use Child (User)
    Select Path.
  • Find Child (User)
    Set to Head.
  • Use Child (Target)
    Select Path.
  • Find Child (Target)
    Set to Head.

Attack Ability #

Next, we’ll set up the enemy’s attack ability.

Navigate to Status > Abilities and add a new ability.

  • Name
    Set to Chomper Attack.

Ability Settings #

  • Ability Type
    Select Default.
  • Useable In
    Select Both.

Use Settings #

The ability can be canceled by other attacks.

  • Cancelable
    Enable this setting.

Target Selection Settings #

We’ll set up a Custom target selection instead of using a template, targeting a single enemy within a use range of 1.5.

  • Target Selection Type
    Select Custom.

Target Settings #

  • Target Type
    Select Enemy.
  • Target Range
    Select Single.

Use Range Settings #

  • Own Use Range
    Enable this setting.

Click on Add Range.

  • Range Type
    Select Template.
  • Template
    Select Range 1.5.

Target Settings > Target Changes #

Click on Add Target Change.

  • Cancel Action
    Enable this setting.
    The ability can cancel the target’s action (if it’s cancelable).

Click on Add Status Change.

  • Change Type
    Select Status Value.
  • Status Value
    Select HP.
  • Operator
    Select Sub.
  • Change Value
    Select Combatant > Status Value.
  • Status Value (Change Value)
    Select ATK.

Battle Animation #

Click on Add Battle Animation.

  • Schematic Asset
    Select ChomperAttack.

Damage Dealer Settings #

Click on Add Tag.

  • Tag
    Set to attack.

This is the same activation tag we’ve used on the staff’s damage dealer.

Click on Add Battle Animation. We’ll use the schematic we’ve set up to animate the damage dealer hit.

  • Schematic Asset
    Select DamageDealerHit.

Battle AI #

Next, we’ll set up 3 battle AIs, one for doing nothing (should always be used as a fallback), one for getting a target based on the move AI’s detection, and one for the chomper’s attack.

Navigate to Battles > Battle AI, we’ll change the Default battle AI and add another battle AI.

Do Nothing #

This battle AI only uses the None action, i.e. the combatant will do nothing.

It’s a fallback in case no other action is used (e.g. no target detected). If the battle AI doesn’t find an action, a combatant will use it’s base attack, which we don’t want.

Battle AI Settings #

  • Name
    Set to Do Nothing.

None #

Add Node > Action > None

This’ll use the None action.

No further setup needed.

Get Move AI Target #

Add a new battle AI, this’ll get the nearest target detected by the combatant’s move AI.

We’ll only use this battle AI in other battle AIs to not have to set this up again and again.

Battle AI Settings #

  • Name
    Set to Get Move AI Target.

Check Move AI Target #

Add Node > Move AI > Check Move AI Target

This node uses combatants already detected by the move AI as found targets.

  • Found Targets
    Select Clear.
    This’ll remove previously found targets.
  • Target
    Select Enemy.

Check Move AI Detection #

Add Node > Move AI > Check Move AI Detection

This node will check if combatants could be detected by the move AI and use them as found targets.

This node is connected to the Failed slot of the Check Move AI Target node, i.e. we’ll check if any combatant could be detected but the move AI currently hasn’t detected (e.g. due to timeouts).

  • Found Targets
    Select Clear.
  • Target
    Select Enemy.

Get Nearest #

Add Node > Position > Get Nearest

This node uses the nearest target as found target. We’ll use it to get the nearest from the previously found targets and not check for additional targets.

The node is connected to the Success slots of the other 2 nodes.

  • Found Targets
    Select Check.
  • Target
    Select None.

Attack #

Add a new battle AI, we’ll use the combatant’s base attack if a target is found and it’s less than 5 world units away.

Battle AI Settings #

  • Name
    Set to Attack.

Battle AI #

Add Node > Base > Battle AI

This node uses another battle AI – we’ll use the Get Move AI Target battle AI, selecting a target via the move AI.

  • Battle AI
    Select Get Move AI Target.

Check Target Count #

Add Node > Target > Check Target Count

Checks if any target is in the found targets list.

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

Check Distance #

Add Node > Position > Check Distance

We’ll now check if any of the found targets is nearer than 5 world units.

This node is connected to the Success slot of the Check Target Count node.

  • Found Targets
    Select Check.
  • Target
    Select None.
  • Check Type
    Select Is Less.
  • Check Value
    Select Value > Value.
    Set the value to 5.

Attack #

Add Node > Action > Attack

Uses the combatant’s base attack.

  • Force Found Targets
    Enable this setting.
    This’ll force to target the found target.

Updating Combatant General Settings #

Next, we’ll set up the Do Nothing battle AI as a default battle AI for all combatants.

Navigate to Combatants > Combatants > General Settings.

Battle Settings > Default Battle AI #

Click on Add Battle AI.

  • Battle AI
    Select Do Nothing.

Updating the Chomper #

Now, we’ll add the comper’s attack and battle AI.

Navigate to Combatants > Combatants and select the Chomper.

Attacks & Abilities > Override Settings > Base Attack #

  • Own Base Attack
    Enable this setting.

Click on Add Base Attack.

  • Ability
    Select Chomper Attack.

Battle Settings > Battle AI #

Click on Add Battle AI.

  • Battle AI
    Select Attack.

Battle Settings #

Next, we’ll set up a few things for our battle system.

Navigate to Battles > Battle System > General Settings.

Base Settings #

We’ll only use a real time battle system in this game. One is already set up, so let’s select it.

We’ll do the setup for it after the general settings.

  • Default Battle System
    Select Real Time.
  • Real Time Area System
    Select Real Time.
    This should already be set up this way.

Range Settings #

We’ll increase the ranges for various things.

Battle Range #

This defines the range to the player a combatant can have to be part of the battle.

So, anything outside this range doesn’t fight – this can be used to improve performance in scene wide battles like in this project.

  • Range
    Select Value > Value.
    Set the value to 70.

AI Range #

This defines the range to the player a combatant can have to use the battle AI.

We’ll match it to the battle range.

  • Range
    Select Value > Value.
    Set the value to 70.

Move AI Range #

This defines the range to the player a combatant can have to use the move AI. This is only for outside battles – battle systems have their own move AI setup.

We’ll match it to the battle range.

  • Range
    Select Value > Value.
    Set the value to 70.

Real Time Battle System #

Navigate to Battles > Battle System and select the Real Time system.

Base Settings #

Nothing to change here for us, the default setup should be correct.

Make sure the player and camera control isn’t blocked at all.

Control Block Settings #

  • Block Player Control
    Select None.
  • Block Camera Control
    Select None.

Real Time Settings #

The Real Time Settings are the only settings specific for the real time battle system, the other settings are the same for all battle systems.

There’s only one thing we have to do here – ignoring None actions.

This’ll discard any None action of combatants, i.e. all those enemies using the Do Nothing battle AI if they don’t have an action will not even do nothing.

Unless you’re using the None action to do some animations, it’s best to ignore them in real time battles to improve performance.

Other Options #

  • Ignore None Actions
    Enable this setting.

Battle System Settings #

We’ll set up a few AI settings here – the AI decision time and the real time battle’s move AI range.

AI Decision Time Settings #

This defines the time it takes an AI controlled combatant to select an action.

We’ll use it with a random time between 2 and 5 seconds to keep enemies from spamming actions.

  • Min AI Decision Time
    Select Value > Value.
    Set the value to 2.
  • Max AI Decision Time
    Select Value > Value.
    Set the value to 5.

Move AI Settings #

We need to allow using the move AI in this battle system and set up it’s range.

  • Allow Move AI
    Enable this setting.
  • Use Move AI Range
    Enable this setting.
  • Range
    Select Value > Value.
    Set the value to 70.

Save Changes #

That’s it for the setup in the editor.

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

Update the Prefab #

Open the Chomper Variant prefab for editing – you can find it in Assets/Tutorial Assets/Prefabs/Combatants/.

We’ll add a Damage Zone and a Radius component to the root, and a Damage Dealer component to it’s Attack child object.

Add Damage Zone #

Add a Damage Zone component to the prefab’s root using the component menu.

The default setup is already correct for us.

Add Radius #

Add a Radius component to the prefab’s root using the component menu.

It should automatically set the radius according to the added colliders.

  • Radius
    Select Value > Value.
  • Value
    Set to 0.6.

Add Damage Dealer #

Add a Damage Dealer component to the Attack child object (the Sphere Collider in front of it’s mouth) using the component menu.

  • Start Type
    Select Trigger Stay.
    Damage zones on game objects within the trigger will cause damage to them.
    We’ll use Trigger Stay because the damage dealer might become active while the player is already inside it.
  • Damage Zone From Children
    Enable this setting.
  • Damage Zone From Parent
    Enable this setting.
  • One Time Damage
    Enable this setting.

Activation Settings #

If you remember, we used the activate tag attack in the chomper’s attack ability, so we need to use that here as well.

  • Field
    Enable this setting.
  • All Battle Systems
    Enable this setting.

Click on Add Activation Tag.

  • Activation Tag
    Set to attack.

And that’s it for the prefab – save the changes.

Close the prefab editing.

Testing #

Alright – everything’s set up.

Hit play, let’s hunt some chompers!

Great – they hunt us, they bite us, but we can hit back!

However, they just disappear when they die … and hits need a bit more pop.

 

Next, we’ll set up hit effects and the enemy’s death.

Share This Article :
  • Facebook
  • X
  • LinkedIn
  • Pinterest
Table of Contents
  • Chomper Attack Schematic
    • Rotate To
    • Combatant Animation
    • Play Sound
    • Activate Damage Dealer
    • Wait
    • Activate Damage Dealer
  • Battle Range Template
    • Range Settings
      • Maximum Range
      • Raycast Line of Sight
      • Move AI Settings
    • Range 4
      • Raycast Line of Sight
    • Range 5
      • Raycast Line of Sight
  • Attack Ability
    • Ability Settings
    • Use Settings
    • Target Selection Settings
      • Target Settings
      • Use Range Settings
    • Target Settings > Target Changes
    • Battle Animation
      • Damage Dealer Settings
  • Battle AI
    • Do Nothing
      • Battle AI Settings
      • None
    • Get Move AI Target
      • Battle AI Settings
      • Check Move AI Target
      • Check Move AI Detection
      • Get Nearest
    • Attack
      • Battle AI Settings
      • Battle AI
      • Check Target Count
      • Check Distance
      • Attack
  • Updating Combatant General Settings
    • Battle Settings > Default Battle AI
  • Updating the Chomper
    • Attacks & Abilities > Override Settings > Base Attack
    • Battle Settings > Battle AI
  • Battle Settings
    • Base Settings
    • Range Settings
      • Battle Range
      • AI Range
      • Move AI Range
  • Real Time Battle System
    • Base Settings
      • Control Block Settings
    • Real Time Settings
      • Other Options
    • Battle System Settings
      • AI Decision Time Settings
      • Move AI Settings
  • Save Changes
  • Update the Prefab
    • Add Damage Zone
    • Add Radius
    • Add Damage Dealer
      • Activation Settings
  • Testing
Sitemap
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • API
  • ORK 2 Hub
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get ORK
  • Contact
  • Blog
  • Makinom
  • gamingislove.com
Categories
  • News (69)
  • ORK 2 (137)
    • Tutorial (137)
      • Game tutorial (50)
      • Gameplay (32)
      • How-to (55)
  • Release (149)
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!