AoE Damage

I’m trying to figure out how to do Area of Effect damage with blueprints. I want to make it so say, if a character is standing on a type of floor or is inside a certain collision sphere their health will gradually go down. I’ve tried to have a while loop but the health just depletes in an instant, and putting a delay inside a while look just causes an infinite loop for some reason. I just want it to take a bit of health away gradually for as long as the player is in the AoE

When the actor steps on the tile, or enters the sphere, you could create a looped timer using Set Timer by Function Name. So, for example, every 5 seconds you could apply damage.

Keep a reference to the timer handler (return value from the node). You’ll want to cancel it the moment they leave the hazard.


Example of handling this via a timer. This has a bug (you’d want to call EndAOE on player death)

this is what I have so far, not sure what else I’s need to change

Is “Do Dam” a function you have somewhere else? I think you meant to use “Set Timer by Event”

no, i just dont really know what im doing here

Alright, changed it again, can you tell me what the issue is with this one?

Added an example that you can review! Hope it helps!

Doesnt seem to work with the code I already have, but thanks anyway, I’m not sure how to use your example, with the begin overlap, I have in the pictures I showed

It just causes the player to die instantly

this is was my attempt at integrating your code

In this case you trigger the dead state if it’s >. You may also want to add a 0 to the “Compare With” pin for clarity.

unfortunately it still doesn’t work, the character doesn’t die anymore, but the health doesn’t go down over time, it still only goes down once, when the player enters the sphere, but doesn’t repeat the process every few seconds, it just happens every time the player enters the sphere again

I would also avoid just dragging a pin from the Set Health node & just use Get Health for DidDamage->CompareFloat’s input.

Few seconds? Perhaps the 15 second loop time is the issue. Maybe reduce that a bit more. :slight_smile:

I did, I reduced it to one second, still nothing

Okay, I changed the amount of damage and it does look like its working but on a very small scale, for some reason it takes a bigh chunk of damage when the player first enters the sphere and then very very small amounts after staying in it, any idea why it take so much when it first enters?

Let’s clean these events up a bit

  • OnComponentBeginOverlap > Save a reference to the Actor to a variable > Fire BeginAOE
  • BeginAOE > Set Timer By Event > Store Timer Handler > Get Actor Reference > Subtract Damage > Call DidDamage
  • DidDamage > Compare Value of Health > If less-than 0 > Die > Call EndAOE

Don’t worry about getting variables or creating more nodes. Clarity is important. Somehow I don’t think those nodes are being “shared” properly.

Perhaps it’s getting called multiple times? Try using print string to verify when that’s getting called.

yea, looks like it, not really sure why its doing that though

Double check your collision meshes. Alternatively, you could maintain a bool “PendingDamage” that could be checked & cleared on damage.