BP_ShooterCharacter won't take any damage

I did everything the video asked, but Nothing works, I tried using Ontakeanydamage delegate and plug Take Damage in there, (I was desperate) but it did not work. Here is my code

float AShooterCharacter::TakeDamage(float DamageAmount, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser)
	float DamageToApply = Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser);
	DamageToApply = FMath::Min(Health, DamageToApply);
	Health -= DamageToApply;
	UE_LOG(LogTemp, Warning, TEXT("Health Left: %f"), Health);

	return DamageToApply;

So you don’t get that log? Do you call TakeDamage? Do you get a log from that side?

yes I am calling it, but it is calling the AActor Take damage, does it have to be the shooter Characters?

if (bSucces && HitEffects)
		FVector ShotDirection = -Rotation.Vector();
		UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), HitEffects, HitResult.Location, ShotDirection.Rotation());
		AActor* DamagedActor = HitResult.GetActor();

		if (DamagedActor)
			FPointDamageEvent DamageEvent(Damage, HitResult, ShotDirection, nullptr);
			TakeDamage(Damage, DamageEvent, OwnerController, this);
			UE_LOG(LogTemp, Display, TEXT("SUCCEED"));

Yes, otherwise you are calling TakeDamage on the gun that hit the character. You need to call it on the actor you hit

DamagedActor->TakeDamage(Damage, DamageEvent, OwnerController, this);

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