The result of every action in a battle has to be calculated, and there are two ways to achieve this.

Attacking an enemy, healing an ally or escaping from battle – all battle actions have one thing in common: The outcome needs to be calculated.

Calculating the result can be done in two ways:

  • Calculate Step
    A simple event step that calculates the result.
  • Damage Dealers/Zones
    A more complex method using components that calculate the result on physical contact.

Let’s see those variations in more detail.

The Calculate Step

Actions, like using abilities or items, use Battle Events to animate them. Those events offer the Calculate event step – every time this step is used in an event, the underlying action (the one that called the event) will calculate the outcome. If an action isn’t animated, the calculation is done automatically.

The use costs of an ability (like casting a fire spell costs 5 MP) will be consumed the first time a calculate step is executed. If you want an action to do damage multiple times, simply use multiple calculate steps – but keep in mind, that each calculation will do the damage defined for the ability/item.

You can optionally have different Next steps in the battle event, based on the outcome of the calculation (e.g. when the attack missed or blocked, or a critical hit).

Damage Dealers/Zones

Damage Dealers and Damage Zones are components added to game object, to allow automatically calculating damage when physically interacting – like a sword hitting an enemy. They need a Collider and a Rigidbody component attached to the game object.

Damage Zones

Damage zones are added to the prefabs of your combatants. You can add multiple damage zones and create vulnerable spots  by using the Damage Factor setting.

The damage factor determines how much damage on the damage zone will do, e.g.:

  • 1 is 100 % damage
  • 0.5 is 50 % damage
  • 1.75 is 175 % damage

Optionally, you can also block the damage completely – e.g. adding a blocking damage zone to a shield will allow a combatant to block attacks with the shield.

A combatant needs at least one damage zone to receive damage from damage dealers.

Damage Dealers

Damage dealers are added to everything that should do damage – like a weapon, a fireball effect or projectiles. The damage will be done upon a selected physical interaction:

  • Trigger Enter
    When a damage zone enters the damage dealer’s trigger.
  • Trigger Stay
    While a damage zone stay’s within the damage dealer’s trigger.
  • Trigger Exit
    When a damage zone leaves the damage dealer’s trigger.
  • Collision Enter
    When a damage zone starts colliding with the damage dealer’s collider.
  • Collision Stay
    While a damage zone is touching the damage dealer’s collider.
  • Collision Exit
    When a damage zone stops colliding with the damage dealer’s collider.

When using trigger/collider stay, you can define the timeout between damages (e.g. doing damage every 0.5 seconds).

To use a damage dealer for an action, it must be set up to support it. This can be done in two ways:

  • Define the action
    You have to enable using a damage dealer for base/counter attacks, or specifically add the item or ability to the damage dealer.
  • Tags
    Add a tag to the damage dealer (e.g. weapon) and use this tag when you want to use the damage dealer.
    You can add tags to abilities and items for auto activating damage dealers.

Before a damage dealer actually does action, it must be activated. This can be done in two ways:

  • Activate Damage Dealer step
    This Battle Event step can activate/deactivate damage dealers on the object it’s used on.
    Only damage dealers that are set up for the used action or match a tag defined in the step will be activated.
  • Auto Activate
    Damage dealers that are set up for an action or match one of their tags can be activated automatically when the action is used.
    You can enable this for each battle system type individually.

Clearly, the easiest way is by using tags and auto activate to activate your damage dealers. E.g. add the tag weapon to all weapon damage dealers and all abilities that will do damage through a weapon, and the damage dealers will automatically be activated when one of the abilities is used.

You can also use Battle Events to do additional things when hitting a target (e.g. play effects or move the target) – in that case, you’ll also need to use a Calculate step in the event to do the actual damage.

Combination

You aren’t limited to use only one of the methods to do damage – you can combine them as you like.

howto_doing_damage1

Like having a fire wall damaging everything that moves through it (damage dealers/zones) and cast a sleep spell on a target (calculate). You can even combine them in a single action, like an explosion spell doing damage on a single target (calculate) and damaging other combatants by debris (damage dealers/zones).

Damage Over Time

Doing damage over time (DOT) is different than doing damage directly through abilities or items. Instead of directly calculating the damage as explained earlier, DOT is done through status effects that are applied by the abilities/items.

Poison ability applies a Poison status effect.

The effect will reduce the target’s HP by 5 % every 10 seconds, and end after 60 seconds.