Syntax for line trace hitting and applying damage to characters

I’m at my wit’s end, I have a weapon line trace that applies damage to destructible meshes, now I’m trying to figure out how to apply damage to characters. Here’s what I got:
ACharacter *person= Cast(hit.getactor());
If(person->Actorhastag (FName (“RegularDude”)
{
}

That’s it. What is the syntax for actually hitting the character/capsule component? Please help me. The sooner I get this taken care of the better

Do you have the actual code you are using?

ACharacter* Person = Cast<ACharacter>(hit.getactor()); 
if (Person)
{
if (Person->ActorHasTag(TEXT("RegularDude")))
{

}
}

Yes, I have the code that checks if the line trace hits something that’s not null. The problem is I don’t know the syntax for applying damage to a character as intelesense doesn’t have a take damage function like I did when I checked to see if I hit a destructible mesh.

So all Actors have a TakeDamage() function. I’m not exactly sure what the problem is, you shouldn’t have any issue calling Person->TakeDamage(…) after you make sure “Person” represents who you wanted.

Here is the entire bullet hit/fire function during it’s tick:

void ABullet::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );

FHitResult hit;

FVector StartTrace = this->GetActorLocation();

FVector EndTrace = (Velocity * DeltaTime) + StartTrace; 
EndTrace.Z += this->GetActorRotation().Pitch;

FCollisionQueryParams params;

params.AddIgnoredActor(this);

if (GetWorld()->LineTraceSingleByChannel(hit,StartTrace,EndTrace, ECC_Visibility,params))
{
	if (hit.GetActor())
	{
		DrawDebugSolidBox(GetWorld(), hit.ImpactPoint, FVector(10.f), FColor::Blue, true);
		ADestructibleActor *Mesh = Cast<ADestructibleActor>(hit.GetActor());
		if (Mesh)
		{
			Mesh->GetDestructibleComponent()->ApplyRadiusDamage(10.f, hit.ImpactPoint, 32.f, 10.f, false);
		}
		ATheMeleeDude *person = Cast<ATheMeleeDude>(hit.GetActor());
		
		if (person)
		{
			person->health = person->DamageResistance - damage;
			if (GEngine)
			{
				GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "Poop");
			}
			
		}
	}
	Destroy();
}
else
{
	bulletexpire += DeltaTime;
	DrawDebugLine(GetWorld(), StartTrace, EndTrace,FColor(0.f,-bulletexpire * 80.f,100.f),true);
	SetActorLocation(EndTrace);
	Velocity += FVector(0.f, 0.f, 200.f) * DeltaTime;
}

if (bulletexpire > 3)
{
	Destroy();
}

}

When I cast to TheMeleeDude, the if statement doesn’t run. Any reason why?

Mark this as resolved I got my trace hitting the character.