Turn-Based Battle - Damage Modifiers

9

Index

Features on these Courses

Attached Files

The following files have been attached to this tutorial:

.c3p

tb-battle-arraycritmods.c3p

Download now 172.88 KB

Stats

3,440 visits, 6,302 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 18 May, 2021. Last updated 24 May, 2021

The Damage Modifier function has been extended in this example and should be fairly expandable as you add more modifiers to the BattleStats array. The expression string may get a bit unruly, but as long as you keep track of where your stats are in the array, you should be fine.

The function has gained a new parameter that allows the system to define whether it's the player or the opponent's turn, so the correct set of values in the array can be used. During the attack functions, the Damage Modifier function is called with either the string Player or Opponent to pick the correct set of values.

The function starts by resetting the CriticalHit Boolean and calling the random number function to obtain a new random number to determine if a critical hit is triggered. If the random number is less than the Critical Chance value stored in the BattleStats array then the attack continues as normal – the damage modifier calculation only factors in the random variance and the Modifier value stored in the array.

If the random number generated is greater than the Critical Chatvalue in the array then the CriticalHit Boolean is set to true (which affects the text displayed during the turn) and the damage modifier calculation will include the CRITMODIFIER variable.

If you need to add more modifiers into the array, you can simply add their cell references to the calculation. If the value doesn't always need to be used, set it to one in the array initially and change it at runtime for when you need it. This could be applied to all sorts of things, from status effects to item boosts, weather effects, type matchups and more.

  • 0 Comments

Want to leave a comment? Login or Register an account!