Detecting Instant Hits on Enemies Derived From ShooterCharacter.H

I created a custom enemy blueprint character for the shooter game that will chase me around.
It chases me.
It is derived from ShooterCharacter.H

Now I want to damage and kill him with the Machine gun.

I was looking at this Shooter Game | Unreal Engine Documentation

Which led me to the ProcessInstantHit_Confirmed Method in ShooterWeapon_Instant.cpp

So I took a look at what was there




void AShooterWeapon_Instant::ProcessInstantHit_Confirmed(const FHitResult& Impact, const FVector& Origin, const FVector& ShootDir, int32 RandomSeed, float ReticleSpread)
{
	// handle damage
	if (ShouldDealDamage(Impact.GetActor()))
	{
		DealDamage(Impact, ShootDir);
	}

	// play FX on remote clients
	if (Role == ROLE_Authority)
	{
		HitNotify.Origin = Origin;
		HitNotify.RandomSeed = RandomSeed;
		HitNotify.ReticleSpread = ReticleSpread;
	}

	// play FX locally
	if (GetNetMode() != NM_DedicatedServer)
	{
		const FVector EndTrace = Origin + ShootDir * InstantConfig.WeaponRange;
		const FVector EndPoint = Impact.GetActor() ? Impact.ImpactPoint : EndTrace;

		SpawnTrailEffect(EndPoint);
		SpawnImpactEffects(Impact);
	}
}



From reading that it looks like I should be able to make something happen on a character derived from shootercharacter.h when an instant hit occurs
using the blueprint node “any damage”. I tried to a few classes from the shooter game on AnyDamage like this.

8feb0d309c859044992c5cc5aa2b9528d11ff28b.jpeg

I couldn’t get them to work.

Does anyone know if there is a way I can detect instant hit events from the shooter game and then make something
happen in BP?

Problem Solved

I solved the problem on my own, but still welcome any comments about my solution.

It looks like the instant hit weapon class was talking to a damage system that existed only in the C++ code of the Shooter game.

So I declared this Function in ShooterCharacter.h



	/** SS Custom Events for Damage **/
	UFUNCTION(BlueprintImplementableEvent)
	void SSCustomDamage();


Added a function call to it in the TakeDamage Method of ShooterCharacter.cpp



float AShooterCharacter::TakeDamage(float Damage, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, class AActor* DamageCauser)
{
	AShooterPlayerController* MyPC = Cast<AShooterPlayerController>(Controller);
	SSCustomDamage();
	if (MyPC && MyPC->HasGodMode())
	{
		return 0.f;
	}

	if (Health <= 0.f)
	{
		return 0.f;
	}

	// Modify based on game rules.
	AShooterGameMode* const Game = GetWorld()->GetAuthGameMode<AShooterGameMode>();
	Damage = Game ? Game->ModifyDamage(Damage, this, DamageEvent, EventInstigator, DamageCauser) : 0.f;

	const float ActualDamage = Super::TakeDamage(Damage, DamageEvent, EventInstigator, DamageCauser);
	if (ActualDamage > 0.f)
	{
		Health -= ActualDamage;
		if (Health <= 0)
		{
			Die(ActualDamage, DamageEvent, EventInstigator, DamageCauser);
		}
		else
		{
			PlayHit(ActualDamage, DamageEvent, EventInstigator ? EventInstigator->GetPawn() : NULL, DamageCauser);
		}

		MakeNoise(1.0f, EventInstigator ? EventInstigator->GetPawn() : this);
	}

	return ActualDamage;
}


and then implemented it here in a blueprint

7d653346dadf10082097bbaf0b2f7a21226e245d.jpeg

and it works as expected