You taking damage?

How’s your tank damage coming along?

Just finished the the lecture, and I must admit that I did it in a very different manner. Radial damage is a cool and very useful concept, but I feel this is a bit overkill for the project. Radial damage is great for explosions, and multi-target damage(like grenades or shooting in the middle of a crowd of enemies). Since BattleTank is more of a single target game, and since i dont want any damage applied unless I hit the target, i simply added a damageAmount to the projectile, and a TakeDamage(int32 amount) on the tank.

1 Like

Just something I noticed in the video: if you set a variable to another variable in the header, the CurrentHealth will always default to 100, even if you change the StartingHealth on the BP (even though health is one of the most universal values in games at 100). We should probably be setting it on BeginPlay. I ran into this before, was somewhat annoying to find :slight_smile:

1 Like

You’re quite right, I’ve actually got a tidy-up and bugfix video coming up next so I’ll include this. Appreciated and well spotted.

damage is logged twice with the current health getting exponentially smaller despite the damage to apply being the same each frame even with the destroy delay being set to 0.0; I also tried destroying it immediatly but it is randomly crashing the game now even with only one destroy method being called. Code seems to match video’s so the cause is unknown. My radial force actor also applies no force despite being constructed the same way as in the tutorials but this is a different persisting problem.
This behavior also happens when working only with doubles…

After reverting my code back to normal the game still crashes.

The crash had to do with the integer conversions he had us do in the video. When i changed to floats again i didnt get crashing.

Also I just noticed when working with doubles the take damage is called twice but it doesnt damage explonentially with each hit.

Now I just noticed in the world outliner the projectile actors never get destroyed despite vanishing in the game.

When I call destroy immediately since its not crashing anymore, the actor officially gets destroyed with no animation, but it still logs twice and at first it logs the current health as less then what it should be but on the second log it logs it as what it should be.

Then I added the delay back in because I noticed that when its set to 0.0 it sees it as infinite. But its still taking off damage two times.

So why do projectiles call their on hit method twice?

Hi Steve, if I remember correctly both of these issues get sorted out later in the section.

I actually never fixed this but moved on anyway as to not be plagued by problems for too long. You didn’t get the same behavior in the course and I could never figure out why this was happening. My tanks also only take damage when getting hit in an unknown “sweet spot”, even when increasing the radius of damage, and radial impulse doesn’t fire an impulse. I never found the answer to these problems.

I am using version 4.15 so there is a chance it is a difference in the required way to set this up in this version or a version related bug. Even if the case the causes or confirmation of bug is unknown.

1 Like

Yeah having same problem with unknown “sweet spot”. Tried to crank up the radius, but doesn’t seem to change anything. I can clearly see my tank being hit and knocked back but no msg about that, Honestly, it seems more likely to get through when it hits you further from origin point - half the times it hits me at the start nothing happens except for me getting knocked back, but when it barely hits or lands just in front or behind it goes through (radius rn is 2000 , it seems way too much, but just wanted to make sure it wasn’t the problem)

EDIT:
Might have figured out reason for that “sweet spot” - had removed colisions from barrel and some other tank parts. Seems like hit event was registered and projectile disapeared when hitting them but it wasn’t considered a hit on actual tank. Really hope this won’t bring back the self collision problems tho.

1 Like

I’m having the same problem where most hits on my tank don’t register a hit event that creates damage. I tried setting the turret/barrel/left track/right track to match the same collision settings as the Tank root element, but it’s still not working. Maybe 1 in 3 hits actually triggers a damage response.

What specifically did you change to get this working? Is this problem addressed in future lectures?

1 Like

Privacy & Terms