Damage help.

I cant remember how this is done can someone help me.

I want to set the amount of damage in the weapon_instant.cpp

This is how i have set the TakeDamage() up in the character class, TakeDamage() is override.



float ALow_Poly_FPSCharacter::TakeDamage(float DamageAmount, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, class AActor* DamageCauser) 
{
	const float ActualDamage = Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser);
	if (ActualDamage > 0.0f) 
	{
		Health -= ActualDamage;
		if (Health <= 0.0f) 
		{
			UE_LOG(LogTemp, Warning, TEXT("Dead"))
		}
	}
	return ActualDamage;
}


I tried to just use GetController() But it doesn’t allow it so im trying to use GetInstigatorController()



		if (Hit.GetActor()->ActorHasTag("")) {
			APlayerController* PlayerController = Cast<APlayerController>(GetInstigatorController());
			if (PlayerController != nullptr)
			{
				// Create a damage event  
				TSubclassOf<UDamageType> const ValidDamageTypeClass = TSubclassOf<UDamageType>(UDamageType::StaticClass());
				FDamageEvent DamageEvent(ValidDamageTypeClass);

				Hit.GetActor()->TakeDamage(100, DamageEvent, PlayerController, this);
			}


when compiling this, it gives me this error.

Was too long to screenshot it all