Conditions, costs, rewards and grants
Every rank of a skill says what it needs, what it costs and what it gives:
| Part of a rank | Type | What it does |
|---|---|---|
Conditions | Pulse conditions (FPulseConditionList) | Must pass to unlock the rank. Checked on the server, and on clients for UI. |
Costs | Pulse costs (FPulseCostList) | Checked with the conditions, paid all or nothing when the rank is unlocked, given back on a refund. |
Rewards | Pulse rewards (FPulseRewardList) | Given once when the rank is unlocked. |
Grants | UPulseSkillGrant objects | Applied while the skill has the rank (abilities, effects, tags, attribute modifiers), also on the skill itself. |
Conditions, costs and rewards are the lists of Pulse Foundation (page “Conditions, costs and rewards” of its docs). Every list of every Pulse plugin offers the same entries: Has Item and Items of Pulse Gameplay, Quest Finished of Pulse Quest, Skill Rank of Pulse Skill and so on. A skill needs no bridge to cost an item or to need a quest.
The context
The entries of a rank get the context of Pulse::Skill::MakeContext (Conditions/PulseSkillConditions.h):
| Field | Value |
|---|---|
Player | The owner of the skill component (usually the player state). |
Instigator | The avatar of its ability system (the pawn); without an ability system the owner. |
Target | The same actor as Instigator, so the Attribute entries of Pulse Foundation reach the attributes of the player (a player state reaches the attribute source of its pawn). |
Source | The skill definition. |
Tags | The skill tag. |
Amount | The rank that is unlocked or refunded. |
Extra | FPulseSkillContext: component, ability system, owner, skill, tree and rank, and (C++ only) StateView. |
Entries that need the skill component find it with Pulse::Skill::GetContextSkillComponent(Context): from the extra data, else on the actors of the player. So the skill entries also work in the lists of other plugins (a quest that needs a skill rank, a dialog choice that costs skill points).
The read paths of Skill Rank, Level, Points Spent In Tree and Skill Points (its check and its cost line) look at FPulseSkillContext::StateView first (Pulse::Skill::GetContextState): when it is set, they read that plain state (ranks, points, levels and the trees it is read against) instead of the component. The rules of Pulse::Skill set it to check an unlock against a state without a component (CheckUnlock with a Pulse::Skill::FStateView). The view counts only during that check: a copy of the context kept past it (a Blueprint condition, a cached context, a message) reads no view (GetContextState returns null) and falls back to the component. Payments and rewards still go through the component; the component itself never sets a view.
Unlocking, refunding and rewards
- Unlock: the conditions are checked first. The first one that does not pass is the failure: its line is the message, the reason is
Pulse.Skill.Failure.Levelfor a Level condition andPulse.Skill.Failure.Requirementfor any other. Then the costs: a cost that cannot be paid fails withPulse.Skill.Failure.Cost(“Not enough …”). On the server the unlock is one exchange (Pulse::Skill::MakeUnlockExchange): the conditions, costs and rewards are checked again (a reward that cannot be given fails withPulse.Skill.Failure.Rewards), the costs are paid, the rank is set, then the rewards are given; a step that fails while running takes back the steps before it. The events fire after all of it. - Refund and reset: the costs give back what the current asset says (
Refundof every cost), so changing a cost after release changes what players get back on a respec. Rewards are not taken back. - Tuning: the costs of a rank go through
Pulse.Tuning.Costof PulseFoundation with the kindPulse.CostKind.Skillin the tags (a difficulty makes skills cheaper or dearer). The unlock reads the factor once, pays with it and keeps it with the rank (GetCostFactor, saved), so a refund gives back what was paid, also after the difficulty changed. - Rewards come once per rank: the first real unlock of a rank gives them, on the authority. A refund keeps them, and unlocking the rank again gives nothing, so a respec cannot be repeated for rewards. The component keeps the highest rewarded rank per skill (
GetRewardedRank, saved with the skills, known on the owning client too); the node view model shows no rewards for a rank that gave them before.SetSkillRankand loading a save give no rewards.
In the details panel the three lists are cards of the Pulse editor kit (Pulse Foundation, page “Editor kit”): each entry shows its type in the color of its category and the values you changed. The entries of Pulse Skill have the category Skills (conditions), Costs and Rewards.
Entries of Pulse Skill
Conditions
| Entry | Struct | Description |
|---|---|---|
| Skill Rank | FPulseCondition_SkillRank | A skill has at least MinRank, also a skill of another tree. |
| Level | FPulseCondition_SkillLevel | A progression has at least MinLevel (empty Progression = the default progression). Fails with Pulse.Skill.Failure.Level. |
| Points Spent In Tree | FPulseCondition_SkillTreePoints | At least MinPoints of a pool were spent in a tree (tiers). An empty Tree is the tree of the skill that is unlocked. |
Attributes (Strength 10, a mana cost, gold) are the Attribute condition and cost of Pulse Foundation (FPulseCondition_Attribute, FPulseCost_Attribute, page “Attributes” of its docs): the attribute is a Pulse.Stat tag, read and paid through the attribute source of the player, with the Pulse Attributes component or with GAS (the Pulse GAS Attributes component maps the tags to the attributes of your attribute sets). A refund gives the amount back. Old Attribute entries of Pulse Skill load as these entries; pick the attribute again as a tag.
Until the attribute is picked again, such an entry always passes and costs nothing. Data Validation (and the Pulse Check) reports every rank with an Attribute condition or cost without an attribute (also a condition inside Any Of, All Of or Not), and a loaded skill logs a warning once. Check the amounts too: a value left at its old default loads as the new default, so a cost of 1 becomes Amount 10 and a condition “at least 1” becomes Value 0 (“at least 0”). The old MinValue is now Value.
Every condition has a Text: the line the UI shows. Empty describes the condition (“Level 5”, “Archery 2”). Tags of the player (the old “Owned Tags” requirement) are Actor Has Tags of Pulse Foundation on the Player or the Instigator, whichever actor has the ability system.
Costs
| Entry | Struct | Description |
|---|---|---|
| Skill Points | FPulseCost_SkillPoints | Amount points of a pool (empty PointTag = the default pool). The points move from available to spent and back on a refund. |
Rewards
| Entry | Struct | Description |
|---|---|---|
| Skill Points | FPulseReward_SkillPoints | Adds Amount points to a pool. As a level reward it can take the points from the curve AmountByLevel. |
| Experience | FPulseReward_Experience | Adds Amount experience to a progression, with SourceTag; bApplyModifiers lets the experience modifiers scale it. |
| Skill Tree | FPulseReward_SkillTree | Adds a tree to the skill component. Skill trees are not saved, so the reward adds it again after loading (Reapply). |
| Skill Rank | FPulseReward_SkillRank | Raises a skill to Rank if it is lower, without costs and prerequisites (the skill must be in a tree of the component). |
The rewards also work in the reward lists of other plugins: a quest that gives skill points, an achievement that adds a skill tree.
Built-in grants
| Class | Display name | Description |
|---|---|---|
UPulseSkillGrant_Ability | Grant Ability | Gives an ability. Level = rank (or a fixed Level). DynamicSpecTags are added to the spec, e.g. input tags. bActivateOnGrant activates it once, for passives. When the rank changes, only the spec level changes, so an active ability is not cancelled. |
UPulseSkillGrant_GameplayEffect | Grant Gameplay Effect | Applies a gameplay effect with the rank as level. Use Infinite effects: instant effects cannot be removed and are applied again whenever the grants are applied (respawn, load). |
UPulseSkillGrant_Tags | Grant Tags | Adds loose gameplay tags, replicated by default. |
UPulseSkillGrant_AttributeModifier | Grant Attribute Modifier | Adds a modifier to an attribute of the player through the attribute contract of Pulse Foundation (Pulse::Attributes::Modify): Target (the value of a stat, or Min, Max and Rate of a pool), Op (Add, or Multiply: 0.1 = +10 %), Magnitude at rank 1 plus MagnitudePerRank for every rank above, EffectTag and Visibility. Works without an ability system. The source key is the skill and the rank the grant is in (Pulse::Skill::MakeGrantSourceKey: Skill:<skill tag>:<rank, 0 for every rank>:<index>); the modifier is not saved and comes back after a respawn, a load or a reset of the attributes. A new rank replaces it with the new magnitude. With GAS the attribute needs a Modifier Effect in the attribute map. |
Grants that need an ability system (RequiresAbilitySystem, true by default: abilities, effects, tags) are applied only while the skill component has one. The others (attribute modifiers, the grants of PulseSkillInventoryBridge) are applied also without GAS.
Grants are Abstract, Blueprintable, EditInlineNew UObjects that get an FPulseSkillContext. They belong to the asset and are shared by every player: never store per-player state in them; use the context and the handles. The grants of a skill stand in a frame of cards with + Add; the built-in ones have the categories Abilities, Effects, Tags and Attributes. Give your own classes a category and, if one fits, an icon of the editor style:
/** Spawns a companion that follows the player while the skill is unlocked. */
UCLASS(meta = (DisplayName = "Companion", Category = "Summons", CardIcon = "Icons.Star"))
class UMySkillGrant_Companion : public UPulseSkillGrant
Inventory (PulseSkillInventoryBridge)
Items as conditions, costs and rewards of a rank are the entries of Pulse Gameplay: Has Item, Items and Give Items. The separate PulseSkillInventoryBridge plugin adds what only skills do with items:
| Class | Kind | Description |
|---|---|---|
UPulseSkillGrant_Item | Grant | Lends items while the skill is learned (bound: no drop, no transfer). Lent items never pay item costs and count for Has Item only with bIncludeLent. |
UPulseSkillGrant_InventorySize | Grant | More inventory columns/rows per rank. |
UPulseSkillGrant_WeightLimit | Grant | More carry weight per rank. |
See the plugin’s README for details.
Building (PulseBuildSkillBridge)
The separate PulseBuildSkillBridge plugin unlocks building pieces of Pulse Build:
| Class | Kind | Description |
|---|---|---|
UPulseBuildSkillGrant_UnlockPieces | Grant | Unlock Build Pieces: the player may build its pieces and the pieces of its catalogs from the rank on; the build menu shows them. Works without an ability system. |
See “Skill integration” in the Pulse Build docs.
Writing your own
A condition, cost or reward
Write it as a Pulse condition, cost or reward in C++ (derive from FPulseCondition, FPulseCost or FPulseReward, see the Pulse Foundation docs), or in Blueprint with Blueprint Condition and Blueprint Reward. It shows up in the lists of every plugin. To know the skill, read the extra data of the context:
EPulseConditionResult FMyCondition_SkillTier::Evaluate(const FPulseContext& InContext) const
{
const FPulseSkillContext* skill = InContext.GetExtra<FPulseSkillContext>();
if (!skill || !skill->Skill)
return EPulseConditionResult::Passed; // not in a skill rank
return MyGame::GetTier(skill->Skill) <= MaxTier ? EPulseConditionResult::Passed : EPulseConditionResult::Failed;
}
Conditions run on the server when a rank is unlocked, and on clients for UI. On clients only replicated data is available; return Pulse::Conditions::GetMissingDataResult(Context) when the data is missing there. Pay and Refund of a cost and Grant of a reward only run on the authority.
Grant
Override Apply and Remove, and UpdateLevel if the grant can change its level in place (the default removes and applies again). Return false from RequiresAbilitySystem if the grant works without GAS, and true from NeedsReapply when what it applied is lost (the component asks when an attribute source of its owner is ready, its modifiers changed or the pawn of a player state changed, then removes and applies the grant again). Store everything you need to undo in the handles:
void UMySkillGrant_Companion::Apply_Implementation(const FPulseSkillContext& Context, FPulseSkillGrantHandles& Handles) const
{
AActor* companion = SpawnCompanion(Context);
Handles.Objects.Add(companion);
}
void UMySkillGrant_Companion::Remove_Implementation(const FPulseSkillContext& Context, FPulseSkillGrantHandles& Handles) const
{
for (UObject* object : Handles.Objects)
{
if (AActor* companion = Cast<AActor>(object))
{
companion->Destroy();
}
}
}
Grants only run on the authority. Remove can be called with a null AbilitySystem if it was destroyed; then only clean up what is in the handles. In Blueprint, create a class with the parent Pulse Skill Grant and override the functions; it then shows up in the grant cards of the skill asset.