#Hit react montage doesn't play

8 messages · Page 1 of 1 (latest)

dire python
#

I followed "91. Hitting the Character" multiple times and the hit react montage doesn't play. The output log shows "Pressed 1" but not "Pressed 2 or 3". It returns and doesn't process the code to play the montage.

I tried renaming the Combat variable and it still happens. It returns Combat->EquippedWeapon as null. But doesn't return null in the PlayFireMontage, only the HitReactMontage.

I tried commenting out the if check for the combat and it outputs "Pressed 2" but the hit react montage still doesn't play even though the code runs inside the "if (AnimInstance && HitReactMontage)".

void ABlasterCharacter::PlayHitReactMontage()

{

UE_LOG(LogTemp, Warning, TEXT("Pressed 1"));

if (Combat == nullptr || Combat->EquippedWeapon == nullptr) return; //Returns here

UE_LOG(LogTemp, Warning, TEXT("Pressed 2"));

UAnimInstance* AnimInstance = GetMesh()->GetAnimInstance();

if (AnimInstance && HitReactMontage)

{

UE_LOG(LogTemp, Warning, TEXT("Pressed 3"));

AnimInstance->Montage_Play(HitReactMontage);

FName SectionName("FromFront");

AnimInstance->Montage_JumpToSection(SectionName);

}

}

low fog
#

this sounds like a silly question, but is the character you're shooting at holding a weapon?

dire python
low fog
#

that's why it isn't playing the montage

#

it has no equipped weapon, therefore equippedweapon is nullptr, so it returns

#

if the character you're shooting at is holding a weapon, it'll play the montage

#

🙂

dire python