void UGDAttributeSetBase::PreAttributeChange(const FGameplayAttribute& Attribute, float& NewValue)
{
// This is called whenever attributes change, so for max health/mana we want to scale the current totals to match
Super::PreAttributeChange(Attribute, NewValue);
// If a Max value changes, adjust current to keep Current % of Current to Max
if (Attribute == GetMaxHealthAttribute()) // GetMaxHealthAttribute comes from the Macros defined at the top of the header
{
AdjustAttributeForMaxChange(Health, MaxHealth, NewValue, GetHealthAttribute());
}
else if (Attribute == GetMaxManaAttribute())
{
AdjustAttributeForMaxChange(Mana, MaxMana, NewValue, GetManaAttribute());
}
else if (Attribute == GetMaxStaminaAttribute())
{
AdjustAttributeForMaxChange(Stamina, MaxStamina, NewValue, GetStaminaAttribute());
}
else if (Attribute == GetMoveSpeedAttribute())
{
// Cannot slow less than 150 units/s and cannot boost more than 1000 units/s
NewValue = FMath::Clamp<float>(NewValue, 150, 1000);
}
}
i check the value from the OnChangeMoveSpeed, the value on the client can still be more than 1000
eventhough the GameplayEffect Only applied from the server
void UGDAttributeSetBase::PreAttributeChange(const FGameplayAttribute& Attribute, float& NewValue) { // This is called whenever attributes change, so for max health/mana we want to scale the current totals to match Super::PreAttributeChange(Attribute, NewValue);
}
i check the value from the OnChangeMoveSpeed, the value on the client can still be more than 1000 eventhough the GameplayEffect Only applied from the server