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

  • 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

  • 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

  • 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
  • Animating Target Selection
  • 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: 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

  • 2.5D Setup
  • 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
  • Gameplay Bits
  • Click Attack

Click Attack

Table of Contents
  • Input Key
    • Input ID Setting 0
  • Control Map
    • Control Key 0
      • Input Settings
      • Action Settings
      • Conditions
  • Combatants General Settings
    • Base Settings > Default Control Maps
  • Battle System Changes
    • Turn Based Settings > Other Options
    • Save Changes
  • Testing
  • Tip! Raycast Settings

Use a control map to automatically use the base attack on a clicked combatant.

Control maps are used to bind input keys to actions, e.g. using the base attack, an ability or item. A control map will use the first useable action it finds for an input key, i.e. you can bind multiple actions to a single key. You can learn more about control maps in this documentation.

In this tutorial, we’ll the player (or currently action-selecting combatant) automatically use the base attack when clicking on an enemy, without having to first select the Attack command in a battle menu.

This tutorial is based on the 2D RPG Quickstart and 3D RPG Quickstart tutorial series, but you can use this for any kind of project.

Input Key #

First, we’ll set up a new input key for the mouse click.

Open the Makinom editor, navigate to Base/Control > Input Keys and add a new input key.

  • Name
    Set to: Left Click

Input ID Setting 0 #

  • Input Origin
    Select Mouse.
  • Mouse Button
    Set to 0.
    I.e. the left mouse button (1 for right, 2 for middle).
  • Click Count
    Set to 1.
    A single click will be used.
  • Input Handling
    Select Down.
    I.e. when the left mouse button is clicked down.

Control Map #

Next, we’ll set up the control map.

Navigate to Base/Control > Control Maps and add a new control map (or change the default one, if you haven’t used them yet).

  • Name
    Set to: Click Attack

The Useable In settings define in which battle systems (or the field) the control map can be used – the default settings should be fine for us, i.e. using them in all battle systems.

  • Field
    Disable this setting.
  • All Battle Systems
    Enable this setting.
  • Grid Battles
    Select Ignore.

Additionally, we’ll allow using the control map while the combatant is selecting actions.

  • While Choosing
    Enable this setting.

Control Key 0 #

We’ll add a control key – they bind input keys to actions in the control map.

Click on Add Control Key to add one.

Input Settings #

The input settings handle which input key and when it can be used (e.g. limited to being on the ground or moving at a certain speed).

  • Input Key
    Select Left Click.

Action Settings #

The action settings handle which action will be used when the input key is used.

  • Type
    Select Action.
    We’ll use a defined action.
  • Action Type
    Select Attack.
    This’ll use the combatant’s base attack.

We only want to use this when the mouse cursor is over an available target and directly use that combatant as the target for the attack.

  • Only Cursor Over Target
    Enable this setting.
    I.e. the control key will only be used if the cursor is over a valid target for the action.
    Additionally you can enable the Only In Range setting to limit the use to being in use range of the action.
  • Use Cursor Over Target
    Enable this setting.
    This’ll use the combatant the cursor is over as target for the action.

Additionally, we’ll also prevent a target selection from being opened.

  • No Target Selection
    Enable this setting.

Conditions #

Using the control key can be limited by additional conditions – we’ll disable using it during target selections, to not interfere with regular click-target selection.

  • During Target Selection
    Disable this setting.

Combatants General Settings #

With the control map set up, all we need to do is add it for our combatants. You can either add it to individual combatants or as default setup for all combatants – that’s what I’ll do.

Navigate to Combatants > Combatants > General Settings and change the following settings.

Base Settings > Default Control Maps #

Click on Add Control Map.

  • Control Map
    Select Click Attack.

Battle System Changes #

Right now, our setup would already work, but only for the player combatant itself – e.g. having multiple combatants in the player group during a turn based battle would only use the control map for the group leader (the player).

We’ll change that by enabling control maps for the currently selecting combatants. This automatically uses control maps for the (player group) combatant that’s selecting actions.

Navigate to Battles > Battle System and select your battle system. Since I’m building upon the 3D RPG Quickstart tutorials, I’ll use the Turn Based battle system.

Turn Based Settings > Other Options #

  • Selecting Control Map
    Enable this setting.

Save Changes #

And that’s it – click on Save Settings to save the changes.

Testing #

Hit play and test clicking on enemies during battle.

https://orkframework.com/wp-content/uploads/ork3_tutorial_gameplay_bits__click_attack.mp4
https://orkframework.com/wp-content/uploads/ork3_tutorial_gameplay_bits__click_attack2.mp4

It works!

Tip! Raycast Settings #

Clicking on combatants doesn’t work?

This is handled by raycasts, i.e. you need to make sure your combatants are on a layer that is hit by the raycast. Also, make sure no other thing might be in the way between the screen and the combatant. It’s a good idea to have combatants on a dedicated layer and only use that for the raycast.

You can find the raycast settings for this in Battles > Target Settings in the Target Selection > Mouse/Touch Control settings.

Share This Article :
  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
Updated on May 12, 2023
Table of Contents
  • Input Key
    • Input ID Setting 0
  • Control Map
    • Control Key 0
      • Input Settings
      • Action Settings
      • Conditions
  • Combatants General Settings
    • Base Settings > Default Control Maps
  • Battle System Changes
    • Turn Based Settings > Other Options
    • Save Changes
  • Testing
  • Tip! Raycast Settings
Sitemap
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • API
  • ORK 2 Hub
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get ORK
  • Contact
  • Blog
  • Makinom
  • gamingislove.com
Categories
  • News (61)
  • ORK 2 (137)
    • Tutorial (137)
      • Game tutorial (50)
      • Gameplay (32)
      • How-to (55)
  • Release (133)
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!