Having issues with my ToonTanks Extra Credit

Hello,

So I’m trying to make a Healer Turret for my toontanks, that fires healing projectiles at my turrets when they’re below their default health.

So I duplicated the BP_ProjectileBase to make BP_ProjectileHeal, and all I changed was the damage to be -20 and the textures/effects to be different from ProjectileBase.

Then I derived a new C++ class from PawnTurret and named it PawnHealer. Here’s those code for it (I currently have my only-fire-if-target-has-taken-damage commented out for debug purposes).

Header:

CPP

All the code for my PawnBase, PawnTank, and PawnTurret is the same as it is at the end of the tutorial.

THE PROBLEM:
When I start the game, the healing turret is shooting at it’s target, as (currently) intended. But once I start moving my tank, the projectiles start exploding immediately after spawning, thus no longer reaching the Turret and healing it. In the output log below, the Error message stop because my Tank started moving.

output

I have tried swapping the original BP_ProjectileBase back into my BP_PawnHealer to see if it was an issue with my projectile, and the same thing happens. Likewise, if I put ProjectileHeal onto my BP_PawnTurret, it works fine. So it seems like it has to be a problem with my TurretHealer class, but I don’t know what.

Any ideas?

So upon further investigation, I believe this is due to the PawnHealer BeginPlay() and Tick() both calling the Super:: versions of those functions, which would cause them to also call the PawnTurret versions of those functions.

If I delete those calls, nothing works, as I assume the PawnTurret needed those to function. But I can’t skip over PawnTurret’s and use PawnBase’s, because PawnBase doesn’t have those functions.

So assuming this is the reason things aren’t working, what would be the best solution? What class’s versions of those functions would I call, or is there a different solution?

Edit: Linked them to AActor’s versions. seemed to have worked!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms