Achievements #

Read more about the Achievements system in Hiro here.

Get all achievements #

Get all achievements with progress accumulated by the player.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
FHiroOnAchievementsGet OnAchievementsGet;
OnAchievementsGet.AddDynamic(this, &AMyActor::OnAchievementsGet);
FOnError OnError;

HiroClient->AchievementsGet(Session, OnAchievementsGet, OnError);

void AMyActor::OnAchievementsGet(const FHiroAchievementList& AchievementList)
{
    UE_LOG(LogTemp, Log, TEXT("%s"), *AchievementList.ToJson());
}

Claim achievements #

Claim one or more achievements which have completed their progress.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
FHiroAchievementsClaimRequest Request;
Request.Ids = {TEXT("achievement_1"), TEXT("achievement_2")};
Request.ClaimTotalReward = true;

FHiroOnAchievementsClaim OnAchievementsClaim;
OnAchievementsClaim.AddDynamic(this, &AMyActor::OnAchievementsClaim);
FOnError OnError;

HiroClient->AchievementsClaim(Session, Request, OnAchievementsClaim, OnError);

void AMyActor::OnAchievementsClaim(const FHiroAchievementsUpdateAck& AchievementsUpdateAck)
{
    UE_LOG(LogTemp, Log, TEXT("%s"), *AchievementsUpdateAck.ToJson());
}

Update achievement progress #

Update one or more achievements with the same progress amount.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
FHiroAchievementsUpdateRequest Request;
Request.Ids = {TEXT("achievement_1"), TEXT("achievement_2")};
Request.Amount = 1;

FHiroOnAchievementsUpdate OnAchievementsUpdate;
OnAchievementsUpdate.AddDynamic(this, &AMyActor::OnAchievementsUpdate);
FOnError OnError;

HiroClient->AchievementsUpdate(Session, Request, OnAchievementsUpdate, OnError);

void AMyActor::OnAchievementsUpdate(const FHiroAchievementsUpdateAck& AchievementsAck)
{
    UE_LOG(LogTemp, Log, TEXT("%s"), *AchievementsAck.ToJson());
}