I’m trying to make obstacles for a player and want to make rectangular tiles that deal damage every x seconds to a player inside an area. I currently have “Apply Radial Damage” at target points in the blueprint that deal damage successfully. It will do 10 damage every second to anyone within the radius. I would like to be able to control the area that deals damage a little more precisely with square edges.
How should I go about doing this? Should I be using box triggers? I tried OnBeginOverlap for box triggers but I would like to deal damage over time while within the trigger. On Begin Overlap only fires once. Is there a way to test box on player overlap every x seconds?
This could be very easy I’m still pretty new with UE4. Thanks a bunch in advance!
Make a class blueprint, on the class blueprint add a box trigger. Then add a variable of type Actor and make it into an array. Add the events for when an actor begins overlap and ends overlap. On the begin overlap add the actor into your array, and on the end overlap remove them from the array. Add a custom event or function, and add in a ForEach loop.
Plug your array into the ForEach loop. pull out the blue pin on the foreach loop and tell it to apply however much damage you want. Now back in your main event graph create an “Event Begin Play” event, and from that create the node “Set Timer” (or start timer, can’t remember). Tick the button to make it loop, put in an amount of time for however long you want the delay to be, and then type the function name or custom event name into it.
This is essentially how I did it. I forgot to update this thread but I rolled up my sleeves and found the best way of doing it. The other methods mentioned will work but are not quite as scalable. This is the best way of creating the obstacle I mentioned IMO.
Here is a screenshot of the blueprint to hopefully help someone in the future: