Activating abilities immediately
You can have abilities activate immediately upon being given to an actor by adding a property into the ability, such as shown below:
//.h file
UPROPERTY(EditAnywhere)
bool bActivateAbilityOnGranted = false;
//.cpp file
void UMyBaseAbility::OnAvatarSet(const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilitySpec& Spec)
{
Super::OnAvatarSet(ActorInfo, Spec);
if(bActivateAbilityOnGranted)
{
ActorInfo->AbilitySystemComponent->TryActivateAbility(Spec.Handle);
}
}
This allows you to create subclasses of this ability, and simply set the property to true if the ability should activate immediately.
Granting abilities from effects with extra data
For example, if you have an effect which grants a weapon or some other function. If you have different things the ability grants, you can avoid creating many different abilities and effects by storing the configuration information elsewhere. The ability can then read the data from some other location.