Also not seeing health log message

I am getting a warning log message that I put into Gun.cpp that tells me that my character is registering being hit, but I am not receiving the health log message from the Shootercharacter.cpp. I’m not sure where else to place a warning message to find where the code breaks. I have rebuilt, restarted and compiled many times.

Here is my code:

header:

cpp file:

here is the “I’m hit” warning message that is showing up:

thanks in advance for any help.

Perhaps you’re hitting something else. Change the log to

UE_LOG(LogTemp, Warning, TEXT("%s hit %s"), *GetOwner()->GetName(), *HitActor->GetName())

Thank you for your reply.

I am now getting the following error when I compile:

.../Unreal Projects/SimpleShooter/SimpleShooter/Source/SimpleShooter/ShootingCharacter.cpp:60:71: error: use of undeclared identifier 'HitActor'
        UE_LOG(LogTemp, Warning, TEXT("%s hit %s"), *GetOwner()->GetName(), *HitActor->GetName());

When I add it to the gun.cpp file, it works great. Somehow they are not connecting but I am not sure how to fix it.

thanks again.

I’m not sure what you mean. And I was suggesting you change the log in the last screenshot to see if you are hitting what you think you are hitting.

Right. And I did. And the results came back showing that the main player is hitting the second character.

LogTemp: Warning: WraithPlayerCharacter_2 is Hit by BP_MyShootingCharacter_C_0!

My main player is BP_MyShootingCharacter so it seems correct.

But I’m still not getting anything from the same message put into the “TakeDamage” in the ShootingCharacter.cpp file.

In that case would you mind sending your project over? You can use File > Package Project > Zip Up Project and upload that to somewhere like Google Drive and then link it.

Thanks so much Dan. Here is the link: https://drive.google.com/file/d/1gCc6L6uC1OwJDjTzjW3A7sDYxGwD4ogD/view?usp=sharing

WraithPlayerCharacter_2 is derived from ACharacter not your custom character class.

Ok, pardon my ignorance, but what do I do with that information?

Reparent it. Open the class settings in the blueprint editor and change its parent to your type.

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

Privacy & Terms