Unreal Minusing too much

Hello, I am making a game for the Game On Jam, I chose exploding barrels as the cliche`, I gave them a lives system. I have it Explode and Revive. But, when the Revive script is executed it keeps minusing here is the code


If I print it gives me number in the negatives like -188, and keeps going down
I know that I named the IsExploding Var is named wrong should be ShouldRevive
You can ask for the uasset files

You hooked up you function to the event tick. You are calling this every frame.
You need to limit the execution to once per action. Either add a do once node with a reset factor or move it to an event based action (like on take any damage)

Now, after making it the the part of ActorBeginOverlap, If i hit it the first time it shows 5, which is default amount of lives, then if, I hit it again, it prints multiple lines:
1
2
2
3
3
4, and then hitting it again removes it.

You should have in internal bool isReviving that it should check against before running the code after overlap.

Before going into the revive timeline set isReviving to true. After the timeline is complete set it to false.

That way it should only trigger once per overlap until it is ready again.

Still the same


What is the length of your timeline? If it’s zero then it will automatically complete the function. It should be the equivalent of the re-spawn time.

This is connected to the overlap actor now? Show the beginning of the function.

They are both 3 seconds.
Here is the whole graph for that event.




I should clean up the code

You need to test the booleans before any action directly after overlap, not later down in the code.

Still the same amount of damage done from a single hit

what happens in the explode function?

Ok so add a branch with a check for is exploding at the begginning. If false then set is exploding to true then put the rest of your code. (You can remove the later set for is exploding)

Still the same

Busy?

expBarrel.zip (69.4 KB)

Here is a working example of what you are trying to achieve. Overlap the default floating pawn with the barrels to see the effect.

Yes I was busy.

2 Likes

Thanks, After tweaking a lot of things to make it work, I got it to work. You maintained the same semi-clean code.

2 Likes