My enemies go from point A to point B(using a target pont). I want to place a turret in their path, so they can destroy it by giving the turret damage, but I can’t seem to make it work, can you help me?
are you looking for the enemies to do damage over time or just a single hit per turret on impact?
if you want a single impact then i would just use a on begin overlap instead of the custom event you have now, then do the cast like your doing now or if your going to have many things the enemies can damage then have a system that uses tags, and last have the apply damage. i would have the turrets health check and destruction script in the turret blueprint.
if you want a damage over time (DOT) then you can do the same as above but add a timer in. so you would have the begin overlap → set timer event → then cast and the rest. then you set the timer to looping and the interval would be how often damage is applied. theres a bit more to this setup and ill try to add a picture in a few mins.
Edit: added pictures.
as you can see in the first picture which is the enemy on begin overlap you start a timer which fires a custom event every one second. this event damage turret first makes sure the turret still exists and if it does it applies damage, if the turret doesnt exist then the timer get stopped. the timer is also stopped when there is no more overlap (end overlap) so that if the enemy moves away or is not in the vicinity of the turret the damage stops.
of course all of this depends on your individual project but this shows the basic idea. you may need to add in other factors like telling the enemy to move on again when it has no target.
Hello, I copied your code identically to my proyect, it didn’t work. the enemies(those spheres) aren’t damaging the turret(that weird black structure), they just keep piling up in that place. Maybe it is due to the collision?
so you want them to apply a dot(damage over time debuff) and also to disappear on contact? also please confirm that some aspects are working for me. currently does this script apply damage to the turret? and are there any warnings or errors being thrown by the enigine? it should be ok but just asking to be thorough.
ok now on to making it work as you wanted. if you want the enemies to disappear on contact and apply a dot then its a pretty easy fix. the script currently is a dot system where its applying 10 damage every 1 second. as for the enemy disappearing im imagining a system like in wow where a debuff is applied for say 5 seconds, so it would be 10 damage every 1 second for 5 seconds. to do that you would just need to set the visibility / hidden in game on the actor which will make it not appear in game. then you need to disables the collision on the enemy actor so it doesnt interact with other actors (physically at least). you will then need a delay node and a destroy actor node, this will control for how long the enemy will exist and therefore for how long damage will be applied to the turret. all of these nodes would be inserted directly after the set timer. the last thing you need is to disconnect / delete the end overlap event seen in the picture as when you disable collision it may mess things up.
it should also be noted that if your currently not getting damaged to be applied then you may need to check you collision settings to ensure you have something that can overlap,
hmm on a second read pf the original question it seems the above may not be what your looking for. do check the damage though and also post your current collision settings. you may just need to set something to overlap dynamic, generate overlap events, or add an extra collision volume.