top of page

MFP: Self-Target & Support

In the process of designing and implementing AoE abilities I also added the "offensive" variable which allows abilities to be set to either target opponents if set to true, or target allies if set to false. These non-offensive abilities will be referred to as support abilities. Being able to effect allies with ground targeted AoE abilities is potentially helpful for enemies and might come in handy for the player once I implement summoning abilities, but ultimately it doesn't have that many applications. What would be more beneficial would be abilities that directly target one's self, as these can be useful with our without allies. Currently support abilities are limited to buff effects, but that misses out the most iconic form of RPG support, healing. As such, I have also implemented a healing system, allowing characters to both buff and heal themselves and allies.

We begin by adding a "self" option to the activate ability function which calls our self target function.













Depending on the ability's type, the self target function then either calls the "apply point and click effect" function with the parent character as the target, or calls the spawn AoE function with the parent character's position as the target location

Beyond that, the "point and click" and AoE systems work as usual, so lets move on to the healing system. Over in the base character script we have a new "take healing" function. This works similarly to the take damage function. It is passed a float value and if health is below maximum and adding the float will not exceed the maximum, it adds the float to its current health. If health is below max but adding the float would exceed the max, then we just set health to max. If already at max health then nothing happens. If any changes are made to the character's health, this is reflected in their health bar.

Back in the ability script, I added a base healing float variable and an option in the "apply point and click effect" function for the target's take healing function to be called if the ability's base healing is above 0. This allows point and click abilities to heal the target if they are self targeted or targeted on an ally.

For the AoE, I added a healing float to the AoE script and a line which sets it in the ability script. The AoE then applies healing to targets in range the same way it applies damage.


The same was also done in the spawn projectile function and the projectile script, granting the option for supportive projectiles. The offensive/supportive bool was not applied to the projectile yet so it was not able to target allies, this was rectified by adding the bool, setting it in the spawn projectile function, and copying the targeting if statement from the AoE script.

Instant heals are great, but I wanted the functionality of something more gradual, a heal over time, a HoT. These work the same as the DoT system but call the take healing function rather than take damage. A HoT healing float was added to the ability script, which is used by the effect script to calculate the healing needed per 0.1 second tick to deliver the full HoT healing amount over the effect's duration. The healing is then delivered via a coroutine, identically to a DoT.

Here is a video of all our self-targeting and support options in-play:




コメント


bottom of page