Download

Constant damage?

I have a box collision set up on an enemy AI character so that when it over laps with the main player he loses 10% of his health. However it only does it once and to lose more health the player needs to walk outside the box collision and back in again. What I’m trying to do is have the player constantly lose health while he is inside the box collision.

This is the blueprint for the player health.

Hero health.JPG

and this is the blueprint of the AI attack.

Ai Attack.JPG

I guess I am trying to get a way for that blueprint to loop the damage.

OnComponentBeginOverlap is fired one time when you overlap the box. You have to set a bool to true when the overlap begin and to false when it stop after that you have to check the bool stats with the Event Tick and add your substract heal function.

Is there anything I can use instead of an event tick? I already have an event tick so it won’t let me create a second one.
0f8afe6d5fe28c18e16da99a5ad688855a5b0300.jpeg

Also is this what you meant by setting a bool to true and false. Just starting to get my head around blueprints but still very much a beginner.
true false.JPG

You can use a Sequence node to add more than one functionality to something. It will do things in sequence, from top to bottom. That will get you more room out of the Event Tick. I would personally not use Tick, though. I would use a Set Timer and put the damaging stuff into a function, set your interval and let the logic do its thing.

I’ll be honest I’ve been working with unreal for a few months now but only game logic for the last two weeks. Before that I only copied blueprints that I saw in youtube videos without really paying attention to what they mean but two weeks ago I realized that without learning and trying to create my own BP’s I’ll end up going nowhere. It’s starting to make a bit of sense now but I still have a long way to go yet. Yggdrasil give me a month and I’m sure I’ll understand the second part of your post but for now over my head sadly. What I did do is put a delay on the output node of the set health and looped it back into the cast game character which acts very randomly. I will press play one time and it will work perfectly and the next play it won’t work at all. Its very weird. I’m sure I’m trying to do something that shouldn’t be done but its not breaking the game. The only thing is it only works 1 out of 4 times.

bb591a0ef959fe7ab295e1f96294000004b921a2.jpeg

I have a “silly” question. But what’s your reasoning behind the CompareFloat rather than just a <= bool?

That was from a youtube video I saw on how to set up health.

https://www.youtube.com/watch?v=5NuLsycksvU&feature=youtu.be&t=1195

Ah gotcha… anyways, you can use a timer, probably right after that OnBeginOverlap. Set the DOT time however much you want and then loop it

Was this what you meant?
48169f6ce32a4e49044b933cfd183f0c3596b0e2.jpeg

It didn’t work. I tried a combination of things with it also like put it between casttogamecharacter and set health. I also attached other actor in the box collision to object in the timer as well as game character to the object but nothing worked.

It doesn’t work because you didn’t input the function name (custom event)…

So, what you do is…make a custom event… Name it whatever. Then put what you want to happen. NOT the timer. Keep the timer where it is. Anyways, in FunctionName. put the exact name of the custom event.

I am going to try to put something together in a sec to help out.

5d004fa5a90176a2918a79aa5733a9e7c2c87bd4.jpeg
Done in 4.8.3

a677df9faf3fe98687df885a8613ef80cca94394.jpeg
Done in 4.9R3

Now, not sure if that’s the most optimized way…but that’s how I would do it. (Sorry it took a bit, League of Legends called)

Ok for the life of me I couldn’t figure out what you mean by “Then put what you want to happen.” So I tried to guess based on the graph you posted but none of them worked. Can you tell me where I’m going wrong?

Custom.JPG
Custom2.JPG
Custom3.JPG
Custom 4.JPG
Custom5.JPG

Was that what you meant? what am I missing?

Did you know there are already some damage functions built in to ue4?

Call it from the function in the looping timer and implement it in your pawn.

Also, what does that note say on your cast?

I know but I have already set up my HUD for this type of damage. I don’t want to have to redo it all again for a new type of damage system. There must be a way of looping the damage I have set up. Anyone?

Just loop over the condition in your Trigger.

ab4cc8e3aad82f701ae48d7ca6564dd6cac4b252.png

It doesn’t work unfortunately

7e847765829e9ba00912db93b0a5c858b7870f98.jpeg

The guy that posted the video tutorial to set up this health system has been asked numerous times how to do this, take constant damage but he has purposely ignored those questions and answered newer questions which leads me to believe that he already knows that with this type of player health its not possible to take constant damage. If he had just acknowledged this then it would have saved my weeks of work. I’ve tied so many other systems into this health setup, I’m now going to have to scrape it all and start from scratch.

I’ve watched some of his videos…and while his methods DO work as intended in his tutorials…it’s not always the most efficient, or sensible thing to do.

The way you are damaging the player is “wrong”.

By wrong, we mean that as _cDub has said, there’s already a way for the player to take damage, and it’s very efficient.

And like Devil showed you…that’s another way you could do it…but just like anything in Blueprints, there’s different ways to achieve something, you have to find out the way that it most efficient and easy for you. But you should be learning the right way…

So, sadly, I would say to forget about his tutorial and start to do it the “easy” way.

Alright, so this is how I did it when I had to do something for a school project a few months back.

This is my CharacterBP: It has the Event Any Damage node and is in charge of reducing my HP always. It is a very simple example.
8b7bb899d167a37622679c993415e82ec2ca12c9.jpeg

I am going to create a simple DOT actor and post that BP.

So this is a landmine I did:

LandMinePriorToChange.jpg

So, first off, remember to make sure you spell everything correctly…took me a few seconds to figure out why this wasn’t working;) But here’s the DOT and it works as intended. Taking the dmg I specified off the player’s HP that is set in Character BP.

DOTLandMine.jpg