Fireball AOE


By Will Fox

5/4/2023

Hey everyone!

This month, my group and I are finalizing our project which means we have a ton of debugging on our hands. This week, I fell down a rabbit hole regarding the Lich's fireball. See, in our latest build, we were aware of a bug that allowed the player to be killed in less than a second when hit by a fireball. The reason for this was because there are two phases of damage for the fireball - originally, anyways. Essentially, the reason for having two damage phases was for the purpose of applying on hit damage and AOE damage. For example, if the Lich hits you directly with the fireball, we want that to do damage. On top of that, we also want the residual explosion to also deal damage. However, after discussing with my team, we decided that the only thing that should deal damage is the fireballs explosion just to keep things simple. By doing this, I was able to narrow down where and why the player was taking a ton of damage in one hit from the fireball. The answer to this problem was disappointingly simple. All I needed to do was turn off the sphere collision attached to the explosion actor so that it would stop triggering the "on overlap" event that deals damage. 


Now, this fix only works for the player. The reason being is because there is only one player. We don't need to worry about other players in the vicinity taking explosion damage too. However, if the player is using the lich and there are a bunch of enemies grouped up, we want all of them to take damage from a singular explosion - because it's an explosion. My original approach to making this work was using the "on overlap" event and checking to see if the enemy getting hit by the fireball had already been hit. I kept track of the enemies that have already been hit by creating a list of actors. Unfortunately, this didn't work as intended since the "on overlap" event can be a bit buggy due to some runtime issues on the Unreal Engine. Essentially, this event node will execute every time something overlaps with the connected object. However, if there is an object that is constantly overlapping, it hogs up all of the "bandwidth" of this node and the event will only read in that one singular overlapped object. The work around for this was by using the "on event tick" node, and then using a built in function from unreal called "get all overlapping actors" that returns a list of overlapping actors for a specified object. This node is super useful for these types of situations since it returns a list of every single actor that is overlapping rather than only one specific actor/object that is colliding/overlapping at that given moment.


By using this function, I was able to effectively implement an area of effect attack for the lich's fireball which I am pretty happy with. It's always satisfying when an attack works exactly as intended - dealing damage only once and effecting everything around it. On top of that, now that I know how to effectively implement AOE, I can use this method for other explosive projectiles.


Leave a comment

Log in with itch.io to leave a comment.