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
  • Status System Setup
  • 05 Formulas

05 Formulas

Table of Contents
  • Formulas
    • Calculating Physical Damage
    • Calculating Magical Damage
    • Calculating Hit Chance
    • Calculating Critical Chance
    • Calculating Critical Damage Multiplier
    • Calculating Level Based Reward
  • 0: Physical Damage
    • Formula Settings
    • Status Value
    • Status Value
    • Begin Sub Calculation
    • Status Value
    • Value
    • End Sub Calculation
  • 1: Magical Damage
    • Formula Settings
    • Value
    • Status Value
    • Status Value
    • Begin Sub Calculation
    • Status Value
    • Status Value
    • End Sub Calculation
  • 2: Hit Chance
    • Formula Settings
    • Status Value
    • Status Value
    • Value
  • 3: LUK Base
    • Formula Settings
    • Status Value
    • Value
    • Status Value
  • 4: Critical Chance
    • Formula Settings
    • Value
    • Value
  • 5: Critical Damage Multiplier
    • Formula Settings
    • Value
  • 6: Level Based Reward
    • Formula Settings
    • Level
  • Save Changes

In this tutorial we’ll set up the main formulas for our status system.

Formulas #

We’ll set up the following formulas:

  • physical damage
  • magical damage
  • hit chance
  • critical chance
  • critical damage multiplier
  • level based reward

Formulas work as a steb-by-step calculation, calculating each node at a time to the current formula result. We’ll use sub-calculations (via Begin Sub Calculation and End Sub Calculation nodes) to make sure the math is still correct.

Navigate to Game > Formulas, well change the already added Default formula and add additional formulas. You can optionally use formula types for organizing them in the editor, but it’s not required (and isn’t part of this tutorial series).

Calculating Physical Damage #

The physical damage is calculated like this:

Value * User.WPN * User.ATK / ((100+Target.DEF) / 100)

It uses the following values:

  • Value
    The initial value forwarded to the formula, e.g. 1 for a base attack or 2 for a critical hit.
  • User.WPN
    The user’s Weapon Damage status value.
  • User.ATK
    The user’s Attack status value.
  • Target.DEF
    The target’s Defence status value.

Due to how formulas work, we’ll pack the 2nd half of the formula ((100+Target.DEF) / 100) into a sub-calculation.

Calculating Magical Damage #

The magical damage is calculated like this:

Value * 2 * User.MATK * User.MATK / (User.MATK + Target.MDEF)

It uses the following values:

  • Value
    The initial value forwarded to the formula, e.g. 15 for a low level magic spell.
  • User.MATK
    The user’s Magic Attack status value.
  • Target.MDEF
    The target’s Magic Defence status value.

Due to how formulas work, we’ll pack the 2nd half of the formula (User.MATK + Target.MDEF) into a sub-calculation.

Calculating Hit Chance #

The hit chance is calculated like this:

(User.DEX / Target.AGI) * 100

It uses the following values:

  • User.DEX
    The user’s Dexterity status value.
  • Target.AGI
    The target’s Agility status value.

The result will be limited to values between 0 and 100. We only need one formula for this.

Calculating Critical Chance #

The critical chance is calculated like this:

(User.LUK + (User.DEX / 4)) – (Target.LUK + (Target.DEX / 4))

It uses the following values:

  • User.LUK
    The user’s Luck status value.
  • User.DEX
    The user’s Dexterity status value.
  • Target.LUK
    The target’s Luck status value.
  • Target.DEX
    The target’s Dexterity status value.

Since user and target calculations are basically the same, we’ll split the formula into 2:

  • LUK Base
    The formula used to calculate user and target sides of the formula (by passing on different users): (LUK + (DEX / 4)) / 3
  • Critical Chance
    The formula used to calculate the critical chance: LUK Base(User) – LUK Base(Target).

The result will be limited to values between 0 and 100.

Calculating Critical Damage Multiplier #

We’ll use this formula as a multiplication factor for critical hit damages. We’ll simply use a value of 1.5 as the critical damage multiplier.

While we can also just define that value wherever a critical hit is used (e.g. in an attack ability), using a formula allows us to later change this for all abilities or items that use the formula. This makes it easier to test different setups and change it for all using critical hits.

Calculating Level Based Reward #

Combatants will give experience and quantity (e.g. gold) rewards scaled by their level. The level based reward is calculated like this:

Value * User.Level

It uses the following values:

  • Value
    The initial value forwarded to the formula, e.g. 1 for 1x level experience/quantity, 2 for 2x level experience/quantity.
  • User.Level
    The user’s level.

0: Physical Damage #

This formula calculates the physical damage, using a sub calculation for the defence part of the formula. Using the formula requires to pass on an initial value that is greater than 0 to achieve actual damage.

Formula Settings #

  • Name
    Set to Physical Damage.

Status Value #

Add Node > Combatant > Status Value

Multiply by the user’s weapon damage. This’ll multiply the passed on initial value (coming from an ability) by the weapon damage.

  • Operator
    Select Multiply.
  • Status Origin
    Select User.
  • Status Value
    Select Weapon Damage.
  • Value Origin
    Select Current.

Status Value #

Add Node > Combatant > Status Value

Multiply by the user’s attack.

  • Operator
    Select Multiply.
  • Status Origin
    Select User.
  • Status Value
    Select Attack.
  • Value Origin
    Select Current.

Begin Sub Calculation #

Add Node > Base > Begin Sub Calculation

This node starts a sub calculation.

The result of the sub calculation (ending using an End Sub Calculation node) is added to the current formula result using this node’s operator.

We’ll divide the current formula result by the sub calculation’s result. We’ll also immediately set the sub calculation’s current value to 100.

  • Operator
    Select Divide.
  • Initial Value
    Select Value > Value.
    Set the value to 100.

Tip! You can also have sub calculations within your sub calculations!

Status Value #

Add Node > Combatant > Status Value

Uses a combatant’s status value – we’ll use the target’s defence.

  • Operator
    Select Add.
  • Status Origin
    Select Target.
  • Status Value
    Select Defence.
  • Value Origin
    Select Current.
    We’ll use the current value of the status value.

Value #

Add Node > Value > Value

Divide by 100.

  • Operator
    Select Divide.
  • Value
    Select Value > Value.
    Set the value to 100.

End Sub Calculation #

Add Node > Base > End Sub Calculation

This ends our sub calculation, using it’s Begin Sub Calculation node’s operator to change the formulas value.

Any open sub calculation is closed at the end of a formula, i.e. we don’t really need to add this node, but it’s better to keep things clean and organized – every Begin Sub Calculation node should have an End Sub Calculation node.

No further settings needed.

1: Magical Damage #

This formula calculates the magical damage, using a sub calculation for the defence part of the formula. Using the formula requires to pass on an initial value that is greater than 0 to achieve actual damage.

Formula Settings #

  • Name
    Set to Magical Damage.

Value #

Add Node > Value > Value

Multiply by 2. This’ll multiply the passed on initial value (coming from an ability) by 2.

  • Operator
    Select Multiply.
  • Value
    Select Value > Value.
    Set the value to 2.

Status Value #

Add Node > Combatant > Status Value

Multiply by the user’s magic attack.

  • Operator
    Select Multiply.
  • Status Origin
    Select User.
  • Status Value
    Select Magic Attack.
  • Value Origin
    Select Current.

Status Value #

Add Node > Combatant > Status Value

Once more multiply by the user’s magic attack. You can just copy the previous node.

  • Operator
    Select Multiply.
  • Status Origin
    Select User.
  • Status Value
    Select Magic Attack.
  • Value Origin
    Select Current.

Begin Sub Calculation #

Add Node > Base > Begin Sub Calculation

This node starts a sub calculation.

We’ll divide the current formula result by the sub calculation’s result. This time we don’t set an initial value (i.e. keep it at 0).

  • Operator
    Select Divide.

Status Value #

Add Node > Combatant > Status Value

Add the user’s magic attack.

  • Operator
    Select Add.
  • Status Origin
    Select User.
  • Status Value
    Select Magic Attack.
  • Value Origin
    Select Current.

Status Value #

Add Node > Combatant > Status Value

Add the target’s magic defence.

  • Operator
    Select Add.
  • Status Origin
    Select Target.
  • Status Value
    Select Magic Defence.
  • Value Origin
    Select Current.

End Sub Calculation #

Add Node > Base > End Sub Calculation

This ends our sub calculation, using it’s Begin Sub Calculation node’s operator to change the formulas value.

No further settings needed.

2: Hit Chance #

This formula calculates the hit chance.

Formula Settings #

  • Name
    Set to Hit Chance.
  • Use Minimum Value
    Enable this setting.
  • Minimum Value
    Select Value > Value.
    Set the value to 0.
  • Use Maximum Value
    Enable this setting.
  • Maximum Value
    Select Value > Value.
    Set the value to 100.

Status Value #

Add Node > Combatant > Status Value

Add the user’s dexterity.

  • Operator
    Select Add.
  • Status Origin
    Select User.
  • Status Value
    Select Dexterity.
  • Value Origin
    Select Current.

Status Value #

Add Node > Combatant > Status Value

Divide by the target’s agility.

  • Operator
    Select Divide.
  • Status Origin
    Select Target.
  • Status Value
    Select Agility.
  • Value Origin
    Select Current.

Value #

Add Node > Value > Value

Multiply by 100.

  • Operator
    Select Multiply.
  • Value
    Select Value > Value.
    Set the value to 100.

3: LUK Base #

This formula is part of the critical chance calculation and calculates the user’s and target’s side of the calculation by passing on the user or target.

Formula Settings #

  • Name
    Set to LUK Base.

Status Value #

Add Node > Combatant > Status Value

Add the user’s dexterity.

  • Operator
    Select Add.
  • Status Origin
    Select User.
  • Status Value
    Select Dexterity.
  • Value Origin
    Select Current.

Value #

Add Node > Value > Value

Divide by 4.

  • Operator
    Select Divide.
  • Value
    Select Value > Value.
    Set the value to 4.

Status Value #

Add Node > Combatant > Status Value

Add the user’s luck.

  • Operator
    Select Add.
  • Status Origin
    Select User.
  • Status Value
    Select Luck.
  • Value Origin
    Select Current.

4: Critical Chance #

This formula calculates the critical chance using the LUK Base formula for user and target.

Formula Settings #

  • Name
    Set to Critical Chance.
  • Use Minimum Value
    Enable this setting.
  • Minimum Value
    Select Value > Value.
    Set the value to 0.
  • Use Maximum Value
    Enable this setting.
  • Maximum Value
    Select Value > Value.
    Set the value to 100.

Value #

Add Node > Value > Value

Add the LUK Base formula for the user.

  • Operator
    Select Add.
  • Value
    Select Value > Formula.
    Select LUK Base.

The setup should automatically use the User as the user and the Target as the target of the other formula.

  • Game Object (User)
    Select User.
  • Game Object (Target)
    Select Target.

Value #

Add Node > Value > Value

Subtract the LUK Base formula for the target.

  • Operator
    Select Sub.
  • Value
    Select Value > Formula.
    Select LUK Base.

This time we need to change the user of the formula.

  • Game Object (User)
    Select Target.
  • Game Object (Target)
    Select Target.

5: Critical Damage Multiplier #

This formula calculates the multiplier for critical damages and will be used by critical target changes of abilities.

Formula Settings #

  • Name
    Set to Critical Damage Multiplier.

Value #

Add Node > Value > Value

Add 1.5.

  • Operator
    Select Add.
  • Value
    Select Value > Value.
    Set the value to 1.5.

6: Level Based Reward #

This formula calculates the level based reward, e.g. used by experience rewards of defeated combatants or loot tables dropping level based gold quantities.

Using the formula requires to pass on an initial value that is greater than 0 to get an actual reward.

Formula Settings #

  • Name
    Set to Level Based Reward.

Level #

Add Node > Combatant > Level

Uses a combatant’s level as value. We’ll multiply the initial formula value by the user’s level.

  • Operator
    Select Multiply.
  • Status Origin
    Select User.

Save Changes #

And that’s it for the formula setup.

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

Next, we’ll set up ability types and item types.

Share This Article :
  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
Updated on July 21, 2022
Table of Contents
  • Formulas
    • Calculating Physical Damage
    • Calculating Magical Damage
    • Calculating Hit Chance
    • Calculating Critical Chance
    • Calculating Critical Damage Multiplier
    • Calculating Level Based Reward
  • 0: Physical Damage
    • Formula Settings
    • Status Value
    • Status Value
    • Begin Sub Calculation
    • Status Value
    • Value
    • End Sub Calculation
  • 1: Magical Damage
    • Formula Settings
    • Value
    • Status Value
    • Status Value
    • Begin Sub Calculation
    • Status Value
    • Status Value
    • End Sub Calculation
  • 2: Hit Chance
    • Formula Settings
    • Status Value
    • Status Value
    • Value
  • 3: LUK Base
    • Formula Settings
    • Status Value
    • Value
    • Status Value
  • 4: Critical Chance
    • Formula Settings
    • Value
    • Value
  • 5: Critical Damage Multiplier
    • Formula Settings
    • Value
  • 6: Level Based Reward
    • Formula Settings
    • Level
  • Save Changes
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!