Lyra - how to fix "invalid ability system component was retrieved for Actor " error?

Hi there! Mb you did encounter this as well?

I’m trying to create Lyra Bot and when I’m calling SendGameplayEventToActor with tag from BTtask it does not trigger respective Ability. When I use bots from Lyra without creating new character based on LyraCharacterWithAbilities Class everything is ok - I will just add new ability to AbilitySet that bot has set tags and it works. But when I’m using any onther character it says in logs “SendGameplayEventToActor invalid ability system component was retrieved for Actor…” and does not trigger ability.

I’ve tried reparent my character to virtually all posiible combinations of Lyra Pawns or Characters with no result. The chain of tags, AbilitySet, works only with given bots.
How do I create my bots from scratch? It seems to me I’m copying all structure as reference viewer shows for given by Epic bots but “ability system component” is always invalid. What should I do? Do you know video, resource where experience is created from scratch - there is a lot of functionality that I don’t need in the default bot and experience.

1 Like

Invalid ability system component was retrieved for Actor. Because PawnData usually empty for spawn classes of LyraCharacters. So you need on begin play call SetPawnData for LyraPlayerState. This code show your how added AbilitySet from DataSet:

MARK_PROPERTY_DIRTY_FROM_NAME(ThisClass, PawnData, this);
PawnData = InPawnData;

for (const ULyraAbilitySet* AbilitySet : PawnData->AbilitySets)
{
if (AbilitySet)
{
AbilitySet->GiveToAbilitySystem(AbilitySystemComponent, nullptr);
}
}

If ABilitySet not exist LyraAbilitySystemComponent will be invalid…