In this tutorial we’ll add hit chances and miss flying texts.
Abilities and items can use a hit chance to determine if a target was actually hit – only hit targets will receive status changes.
We’ll set up:
- hit chance formula
- miss flying text
- add hit chance to physical abilities
This tutorial is based on the ORK 4 Unity Quickstart 3D tutorials, but can be used in any project.
Hit Chance Formula #
We’ll use a formula to calculate the hit chance, it’s calculated like this:
(User.DEX / Target.AGI) * 100
It uses the following values:
- User.DEX
The user’s DEX status value. - Target.AGI
The target’s AGI status value.
The result will be limited to values between 0 and 100.
Open the ORK editor, navigate to Gameplay > Formulas and add a new formula.
Formula Settings #
- Name
Set to: Hit Chance - Use Minimum Value
Enable - Minimum Value
Select: Value > Value
Set the value to: 0 - Use Maximum Value
Enable - Maximum Value
Select: Value > Value
Set the value to: 100
Status Value #
Add Node > Combatant > Status Value
Add the user’s Dx.
- Operator
Select: Add - Status Origin
Select: User - Status Value
Select: DEX
Status Value #
Add Node > Combatant > Status Value
Divide by the target’s agility.
- Operator
Select: Divide - Status Origin
Select: Target - Status Value
Select: AGI
Value #
Add Node > Value > Value
Multiply by 100.
- Operator
Select: Multiply - Value
Select: Value > Value
Set the value to: 100
Miss Flying Text #
We’ll set up a flying texts to show ‘Miss’ when an attacked missed the target.
Navigate to Texts > Flying Texts.
Miss #
Click on Add Flying Text.
- Player/Ally/Enemy
Enable - Use Content Icon (Content)
Enable
The icon of the action that missed it’s target will be used. - Text (Content)
Set to: Miss
Abilities #
We’ll update all physical attack abilities, i.e.:
- Attack
- Poison Attack
- Fire Attack
- Water Attack
- Earth Attack
- Wind Attack
- Stun Attack
The setup is the same for all abilities – make use of the copy/paste functionality of the context menu to quickly add it to all abilities.
Target Settings > Hit Chance #
- Hit Chance
Enable - Hit Chance (%)
Select: Value > Formula
Select formula: Hit Chance
Save Changes #
And that’s it – click on the Save Settings button at the bottom of the editor.
Testing #
Hit play and fight a bit.
You’ll notice some attacks will miss their target.
Update Attack Schematics (Optional) #
The attacks still play a hit particle effect when the hit fails – let’s change that.
Open the Attack schematic we’re using to animate attacks in the schematic editor. It currently looks like this:
We’ll swap the Spawn Prefab and Calculate Action nodes – select both nodes (either drag-selection over both nodes or use shift+click to select multiple nodes) and use the context menu: Swap Nodes
Calculate Action #
We’ll enable using a separate next slot for Miss outcome of the calculation.
- Use ‘Miss’ Next
Enable
Connect the Miss next slot to the Wait node.
The schematic should now look like this:
Click on Save Schematic at the bottom of the editor to save the changes.
Testing Again #
Hit play again and fight a bit more.
Missing attacks no longer show particle effects – great!






