Gameplay Abilities -> Active Gameplay Effect -> Period

I have ActiveGameplayEffect and wish to know how much time left till PERIOD (not duration) ends.

I’m trying to get handle:

float UX_FunctionLibrary::X_AGE_GetPeriodTimeLeft(UAbilitySystemComponent * W_AbilitySystemComponentReference, const FActiveGameplayEffectHandle W_EffectHandle)
{
	FTimerHandle Y_PeriodicTimeHandle = W_AbilitySystemComponentReference->GetActiveGameplayEffect(W_EffectHandle)->PeriodHandle;
	
	const UGameplayEffect * ActiveEffect = W_AbilitySystemComponentReference->GetGameplayEffectDefForHandle(W_EffectHandle);

	UE_LOG(LogTemp, Warning, TEXT("Effect name = %s"), *(ActiveEffect->GetName()) );
	
	if (Y_PeriodicTimeHandle.IsValid())
	{
		return 1.0f;
	}
	else 
	{
		UE_LOG(LogTemp, Warning, TEXT("Period Handle Invalid"));
		return 0.0f;
	}
}

LOG:

[2019.07.31-07.43.22:235][863]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.22:235][863]LogTemp: Warning: Period Handle Invalid
[2019.07.31-07.43.23:235][925]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.23:235][925]LogTemp: Warning: Period Handle Invalid
[2019.07.31-07.43.24:237][987]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.24:237][987]LogTemp: Warning: Period Handle Invalid
[2019.07.31-07.43.25:235][ 49]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.25:235][ 49]LogTemp: Warning: Period Handle Invalid

but handle always invalid.

I’m executing effect on server:

283716-effectexec.png

And trying read period on client with GameplayCue.

Any ideas why handle invalid???

My effect

and it’s working. i see how attributes changing every 3 secs… but i cant reach handle anyway :frowning:

float UX_FunctionLibrary::X_AGE_GetPeriodTimeLeft(UAbilitySystemComponent * W_AbilitySystemComponentReference, const FActiveGameplayEffectHandle W_EffectHandle)
{
	FTimerHandle Y_PeriodicTimeHandle = W_AbilitySystemComponentReference->GetActiveGameplayEffect(W_EffectHandle)->PeriodHandle;
	if (Y_PeriodicTimeHandle.IsValid())
	{
		return 1.0f;
	}
	else 
	{
		return 0.0f;
	}
}

I’m getting 0.

And effect handle is ok, because i can reach other effect functions or parameters.
Also i tried set duration… and i can read it but not period :frowning:

Can you debug the name to check if it’s the right effect? cause it doesn’t make sense that the period handle would be invalid

283698-1.png

float UX_FunctionLibrary::X_AGE_GetPeriodTimeLeft(UAbilitySystemComponent * W_AbilitySystemComponentReference, const FActiveGameplayEffectHandle W_EffectHandle)
{
FTimerHandle Y_PeriodicTimeHandle = W_AbilitySystemComponentReference->GetActiveGameplayEffect(W_EffectHandle)->PeriodHandle;

	const UGameplayEffect * ActiveEffect = W_AbilitySystemComponentReference->GetGameplayEffectDefForHandle(W_EffectHandle);

	UE_LOG(LogTemp, Warning, TEXT("Effect name = %s"), *(ActiveEffect->GetName()) );
	
	if (Y_PeriodicTimeHandle.IsValid())
	{
		return 1.0f;
	}
	else 
	{
		UE_LOG(LogTemp, Warning, TEXT("Priod Handle Invalid"));
		return 0.0f;
	}
}

LOG:

[2019.07.31-07.43.22:235][863]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.22:235][863]LogTemp: Warning: Priod Handle Invalid
[2019.07.31-07.43.23:235][925]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.23:235][925]LogTemp: Warning: Priod Handle Invalid
[2019.07.31-07.43.24:237][987]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.24:237][987]LogTemp: Warning: Priod Handle Invalid
[2019.07.31-07.43.25:235][ 49]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.25:235][ 49]LogTemp: Warning: Priod Handle Invalid

BTW effect executed on server like this:

283716-effectexec.png

Maybe because there is no prediction period do not synchronize with client part ??
I’m trying get period on client part with GameplayCue

float UX_FunctionLibrary::X_AGE_GetPeriodTimeLeft(UAbilitySystemComponent * W_AbilitySystemComponentReference, const FActiveGameplayEffectHandle W_EffectHandle)
{
FTimerHandle Y_PeriodicTimeHandle = W_AbilitySystemComponentReference->GetActiveGameplayEffect(W_EffectHandle)->PeriodHandle;

	const UGameplayEffect * ActiveEffect = W_AbilitySystemComponentReference->GetGameplayEffectDefForHandle(W_EffectHandle);

	UE_LOG(LogTemp, Warning, TEXT("Effect name = %s"), *(ActiveEffect->GetName()) );
	
	if (Y_PeriodicTimeHandle.IsValid())
	{
		return 1.0f;
	}
	else 
	{
		UE_LOG(LogTemp, Warning, TEXT("Priod Handle Invalid"));
		return 0.0f;
	}
}

LOG:

[2019.07.31-07.43.22:235][863]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.22:235][863]LogTemp: Warning: Priod Handle Invalid
[2019.07.31-07.43.23:235][925]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.23:235][925]LogTemp: Warning: Priod Handle Invalid
[2019.07.31-07.43.24:237][987]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.24:237][987]LogTemp: Warning: Priod Handle Invalid
[2019.07.31-07.43.25:235][ 49]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.25:235][ 49]LogTemp: Warning: Priod Handle Invalid

Effect executed on server like this :

283716-effectexec.png

Maybe because effect executed on server period not synchronized with client???

I’m trying read period on client with GameplayCue.

Well? did it print the correct name to the log? and instead of checking by just looking at the return value, print to the log if the timer is valid or not, maybe there’s something wrong with the return value.
is that function static or const?

[2019.07.31-07.43.22:235][863]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.22:235][863]LogTemp: Warning: Priod Handle Invalid
[2019.07.31-07.43.23:235][925]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.23:235][925]LogTemp: Warning: Priod Handle Invalid
[2019.07.31-07.43.24:237][987]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.24:237][987]LogTemp: Warning: Priod Handle Invalid
[2019.07.31-07.43.25:235][ 49]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.25:235][ 49]LogTemp: Warning: Priod Handle Invalid

I’m executing effect on server and trying to read Period on client with GameplayCue.
Maybe period doesn’t synchronized ??

float UX_FunctionLibrary::X_AGE_GetPeriodTimeLeft(UAbilitySystemComponent * W_AbilitySystemComponentReference, const FActiveGameplayEffectHandle W_EffectHandle)
{
FTimerHandle Y_PeriodicTimeHandle = W_AbilitySystemComponentReference->GetActiveGameplayEffect(W_EffectHandle)->PeriodHandle;

	const UGameplayEffect * ActiveEffect = W_AbilitySystemComponentReference->GetGameplayEffectDefForHandle(W_EffectHandle);

	UE_LOG(LogTemp, Warning, TEXT("Effect name = %s"), *(ActiveEffect->GetName()) );
	
	if (Y_PeriodicTimeHandle.IsValid())
	{
		return 1.0f;
	}
	else 
	{
		UE_LOG(LogTemp, Warning, TEXT("Priod Handle Invalid"));
		return 0.0f;
	}
}

Log:

[2019.07.31-07.43.22:235][863]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.22:235][863]LogTemp: Warning: Priod Handle Invalid
[2019.07.31-07.43.23:235][925]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.23:235][925]LogTemp: Warning: Priod Handle Invalid
[2019.07.31-07.43.24:237][987]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.24:237][987]LogTemp: Warning: Priod Handle Invalid
[2019.07.31-07.43.25:235][ 49]LogTemp: Warning: Effect name = Default__GE_PassivEnergyRegen_Effect_C
[2019.07.31-07.43.25:235][ 49]LogTemp: Warning: Priod Handle Invalid

i’m executing effect on server:

283716-effectexec.png

Maybe because there is no prediction period isn’t synchronized??

I’m trying read period on client with GameplayCue.

Hey, i didn’t realize that you had a server running before you edited your answer. Handle is invalid because it isn’t predicted, even if PredictionKey is valid, currently the server doesn’t allow prediction of periodic effects.

I guess you could override the function in a custom AbilitySystemComponent and tweak it so the client predicts the periodic effect as well.