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,332 visits, 6,113 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

All of the values that were originally contained in instance variables on our combatants have been moved to an array for this example. The project file is called BattleStats and stores the Player's stats on one row and the Opponent's on another. Included in these stats are the two new modifiers – Modifier and CritChance:

The project file needs to be loaded into an Array object at the start of the layout using AJAX. The request for the project file is added to the On Start of Layout event and a separate AJAX triggered event is used to load the project file into the Array object.

You might have also spotted that the Set Text actions for the two text objects that show the combatants' HP have been moved into the On Start of Layout event. This is to minimise the use of Every Tick actions as this system grows.

With the new array, the attack functions need a bit of a change to accommodate the array – the instance variables need to be replaced with their corresponding array cells.

The accuracy check is also now run against an accuracy value in an array cell (so that the two combatants can have different accuracy values). Plus, having removed the Set Text actions from the Every Tick event, these attack functions now include an action to update the HP text for their combatants.

There are also new sub-events to control the text that's displayed after an attack – it now takes into account whether a critical hit has occurred. We'll talk more about the critical hit mechanic in the next section.

  • 0 Comments

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