Using multiple timers/auto-attacking and DoTs

Hi Everybody,

This is my first post so I am sorry if I 't explain my question well. I’m trying to create auto-attack system for a RPG game. Currently I have my hero and enemy actors with collision components and onComponentBeginOverlap calls my interface to deal damage. It works no problem but when trying to use a timer to handle repetition I know that I can’t make a second timer in the same place. I tried to place my timer in a component but I am having issue adding the component on-the-fly so that later in the creation of the game when DoTs are added to combat I can handle them the same way. So am I looking at this all wrong, or missing a node that can do this for me?

INFO:

Working in 4.10.4(willing to move to 4.11)

New to Unreal

Know only a little C++(trying to limit need to use)

Thanks for any answers you can give!

Disclaimer: I was not able to test this, so there are most likely bugs.

I remember setting up a targeting system a while back that was an auto targeting system. I didn’t use overlap though, but I like that approach. So using that approach I put together this pseudo blueprint for you to describe how I would approach an auto target system like the one I understand you to be describing here.

Basically:

  • On overlap, add a unique item to an array of targets
  • On end overlap remove that actor from the target array
  • After initiating the begin overlap, you can now start iterating through your targets
  • First check to see if the length of targets is greater than 0 (stuff is in the array)
  • Then for each item in the array, check to see if it’s valid (target could have been destroyed)
  • If the target is still valid, delay for a duration
  • After delay do the damage
  • after dealing damage attack targets again (this will check if targets are still valid automatically)
  • If the target is not still valid, remove it from the list
  • If the list is empty do nothing

This will still attack someone who leaves the area before the delay timer is complete. So there’s lots of room for improvement on this idea. But see how this approach works for you. If it doesn’t, please discuss! I enjoy this type of problem.

Good luck!

Alternatively you could simply keep track of time and have a cool down for attack: If cool down time is not elapsed then you can’t attack, once it is start cool down timer again for that attack.

Looking at adapting what you have presented here and have done some other research too, can you answer what the built in node apply damage uses for a health or hp value? I cant seem to find something easily.

If i understand your question, the value you’re referring to is “Base Damage” I have it set to 100 in the example provided. If that is not what you are referring to, please provide more context for your question and I will happily reconsider my response or do more research.

I am sorry for the confusion I caused there. I was looking for the max hp value the “Base Damage” is subtracting from. Or is it creating a variable here and adding the value of “Base Damage” to it? In other words, how when using the node “Apply Damage” can I get the overall damage I’ve done to the actor so I can know if I need to kill the actor? I hope that’s clearer.

Understood. Thank you for the clarification. You have an apply damage, and a receive damage event. These are basically just a way to communicate with one another and pass numbers and other useful information allowing you to interpret the “damage”.

Example:

Object A uses apply damage and targets Object B. INSIDE Object B you need to handle the “Receive Damage” events. Otherwise the damage is being thrown into a void.

When you receive the damage you can then choose to do whatever you would like with it. You normally would store a value for “HP or Health” for an game object in the game object blueprint of your character/soldier or whatever.

This event “Receive Damage” then is used to modify that value. Like so:

These are three examples of how to handle damage depending on your use case. AnyDamage will be called when any damage is received. and Point and Radial respective to their damage types.

This is done on the character receiving the damage and NOT the object applying the damage (unless of course the damage causer can take damage, but that’s outside the scope of your issue)

You might find this page useful:

Good luck!

Thank you very much. My hours of searching could not find that page and would have just frustrated me if I had because they 't describe the event nodes you show here. You have been super helpful with my problem and I think that I should be able to achieve my system. I will post results.

Awesome, feel free to reply here if you need further assistance. Glad I was able to help. For tracking purposes, it would help me out if you would accept this answer for tracking purposes. Replying to the comments will reopen the issue if you need to at a later time. Thanks! And good luck!

And here’s the working end result!

86726-autoattackcomponentv2.png

86727-playertargetgatheringv2.png