Setting up the abilities array

In Chapter 3, Exploration and Combat, we created a character class info for learned abilities, which was done in FCharacterClassInfo.h, which is an array used to hold an array of abilities for each character that inherits a class. We need to extend this array so that it is adopted by any game character to hold abilities that they learn throughout the game. To do this, open GameCharacter.h by navigating to Source | RPG. In class RPG_API UGameCharacter : public UObject, add a public UPROPERTY to learned abilities and allow it to be editable anywhere:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = CharacterInfo)
  TArray<FString> LearnedAbilities;

Next, open GameCharacter.cpp located in the same folder, and set ...

Get Building an RPG with Unreal 4.x now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.