GAS Client not playing Montage

Using local split screen everything works fine, but for online multiplayer when i test client, montage doesnt seem to work.

image

Looks like playMontage could fail because avatar is different on client? and fail to find?
Im using ASC on MyPlayerState so tried this no luck

void AGameplayPlayerController::InitializePlayerState()
{
	if(GetLocalRole() != ROLE_Authority )
	{
		AMyPlayerState* MyPlayerState= GetPlayerState<AMyPlayerState>();
		NULL_CHECK(MyPlayerState);
	
		ShowGameplayWidget();
		FGameplayAbilityActorInfo* ActorInfo = new FGameplayAbilityActorInfo();
		ActorInfo->InitFromActor(PlayerPawnRef, PlayerPawnRef,    MyPlayerState->GetAbilitySystemComponent()); 

		return; 
	}
	if(bPlayerStateInitialized)return;
	NULL_CHECK(PlayerPawnRef);

	UE_LOG(LogTemp,Warning,TEXT("GAMEPLAYPLAYERCONTOLLER %s ---------> InitializePlayerState for PlayerPawnRef %s  "),*GetName(),*PlayerPawnRef->GetName());
	
	///THIS IS IMPORTANT: ELSE IN GAMEPLAY ABILITY AVATAR INFO DIRECTS TO
	///PLAYER STATE AND MONATGE WONT PLAY
	// Init ASC with PS (Owner) and our new Pawn (AvatarActor)
	AMyPlayerState* MyPlayerState= GetPlayerState<AMyPlayerState>();
	NULL_CHECK(MyPlayerState);
	
	UE_LOG(LogTemp,Warning,TEXT("GAMEPLAYPLAYERCONTOLLER %s ---------> InitializePlayerState   MyPlayerState  %s  "),*GetName(),*MyPlayerState->GetName());
	
	FGameplayAbilityActorInfo* ActorInfo = new FGameplayAbilityActorInfo();
	ActorInfo->InitFromActor(PlayerPawnRef, PlayerPawnRef,    MyPlayerState->GetAbilitySystemComponent()); 

	UE_LOG(LogTemp,Warning,TEXT("PlayerPawnRef->InitialPlayerStats num --> %d"),PlayerPawnRef->InitialPlayerStats.Num());
		
	MyPlayerState->GetAbilitySystemComponent()->AbilityActorInfo = TSharedPtr<FGameplayAbilityActorInfo>(ActorInfo);
	for (const TSubclassOf<UGameplayEffect> InitialPlayerStat : PlayerPawnRef->InitialPlayerStats)
	{
		UE_LOG(LogTemp,Warning,TEXT("InitialPlayerStat --> %s"),*InitialPlayerStat->GetName());
		
		MyPlayerState->ApplyEffectToSelf(InitialPlayerStat,1);		
	}
	 
	
	MyPlayerState->SetupStartSkills(PlayerPawnRef->BasicAttackAbility ,PlayerPawnRef->DashAbility );
	 

	 
	bPlayerStateInitialized=true;
 
 MyPlayerState->OnPlayerStateChanged.AddDynamic(this,&AGameplayPlayerController::OnPlayerStateChanged);


}

I found that, intentionally, the PlayMontage functionality on ASC is avoiding the owning client (LocallyControlled).

This is from AbilitySystemComponent.cpp

I think it’s because GAS way should be to, predictably, running the montage locally simulated on the owning client.

If someone have more info about this, or if I’m totally wrong, please let me know!

1 Like