Skip to content
Tuxedo CatSTUDIO
Menu

Quick Start: C++

Review draft. This source page has not completed website editorial and release-specific verification.

Include SkillComponent.h, SkillProfile.h, and SkillDirectorTypes.h. Obtain the component from the Actor that owns it; Skill Director has no world registry or subsystem.

const FGameplayTag Authority =
FGameplayTag::RequestGameplayTag(FName(TEXT("Skill.Psyche.Authority")));
int32 Effective = 0;
if (SkillComponent->TryGetEffectiveSkillValue(Authority, Effective))
{
// Use Effective as a numeric input to the consuming system.
}
const FSkillMutationResult Global =
SkillComponent->GrantGlobalXP(250, FName(TEXT("QuestReward")));
const FSkillMutationResult PerSkill =
SkillComponent->GrantSkillXP(Authority, 80, FName(TEXT("SkillUse")));
const FSkillMutationResult Investment = SkillComponent->SpendSkillPoint(Authority);
const FSkillMutationResult Applied = SkillComponent->SetModifier(
FName(TEXT("Example.ExternalCondition.Authority")), Authority, -2,
FName(TEXT("Example.ConditionIntegration")));
const FSkillMutationResult Removed = SkillComponent->RemoveModifier(
FName(TEXT("Example.ExternalCondition.Authority")));

Each mutation returns FSkillMutationResult, with Changed, NoChange, or Rejected status and a structured reason. XP/threshold values are int64; Skill values and modifier amounts are int32.

Native delegates can be observed and removed with the returned handle:

FDelegateHandle EffectiveHandle = SkillComponent->OnEffectiveSkillValueChanged().AddLambda(
[](const FEffectiveSkillValueChangedEvent& Event)
{
// The component already contains the committed value here.
});
// Remove the handle when this observer is no longer valid.
SkillComponent->OnEffectiveSkillValueChanged().Remove(EffectiveHandle);

Component-local persistence uses the core snapshot API:

FSkillPersistenceSnapshot Snapshot;
FSkillPersistenceValidationResult CaptureResult;
if (SkillComponent->CapturePersistenceSnapshot(Snapshot, CaptureResult))
{
const FSkillPersistenceValidationResult Validation =
SkillComponent->ValidatePersistenceSnapshot(Snapshot);
if (Validation.IsValid())
{
const FSkillPersistenceRestoreResult Restore =
SkillComponent->RestorePersistenceSnapshot(Snapshot);
}
}

Restore replaces runtime state transactionally and emits SkillStateRestored after commit. Optional SaveGame adaptation is owned by DirectorBridge and is responsible for Actor participation and aggregation; core snapshots do not identify Actors.