Conditions, costs and rewards
PulseCore uses the condition, cost and reward lists of Pulse Foundation (FPulseConditionList, FPulseCostList, FPulseRewardList; see the page “Conditions, costs and rewards” of the Pulse Foundation docs) and adds entries for its own data: items, equipment, loot, attributes, combat and interactions. Every list of every Pulse plugin can use them: a door that needs a key, a skill that costs items, a quest reward that rolls a loot table, a dialog choice that needs a sword in the hand.
Where PulseCore uses the lists
| Where | Lists | Context |
|---|---|---|
| Interactable component (Interaction system) | Conditions, Costs | The interactor is Player and Instigator, the owner of the component Target, the component Source. |
| Recipe (Crafting) | Conditions | The crafter is Player and Instigator, the owner of the station Target, the recipe Source, the rounds Amount; FPulseCraftingContext is the extra data. |
| Loot table entry (Loot) | Conditions | Player, Tags and Source of the roll; FPulseLootContext is the extra data. |
| Melee and ranged ability, weapon trait (Combat and inventory) | AttackCosts, Costs | The attacker’s avatar is Player and Instigator, the weapon, attack or shot Source; FPulseAttackCostExtra (the ability’s spec handle) is the extra data. |
Conditions
| Condition | Category | Module | Passes when |
|---|---|---|---|
Has Item (FPulseCondition_HasItem) | Items | PulseInventory | The player has Count items of Item, or items with ItemTag; with bIncludeEquipped equipped stacks count too, with bIncludeLent lent stacks (items a skill lends, see lent items). It uses nothing up. |
Has Equipment (FPulseCondition_HasEquipment) | Equipment | PulseInventory | Something is equipped in Slot (or in any slot when it is empty); with Item or ItemTag it must be that item. |
Loot Level (FPulseCondition_LootLevel) | Loot | PulseInventory | The level of the loot roll is at least MinLevel and at most MaxLevel (0 = no upper limit). Outside of loot rolls the level is 0. |
Attribute Value (FPulseCondition_AttributeValue) | Attributes | PulseAttributes | An attribute of an actor of the context compares to Value (health >= 50). For the player it uses the pawn, player state or controller that has an ability system. |
Alive (FPulseCondition_Alive) | Combat | PulseCombat | The actor is alive (for the player: its pawn); with bAlive off, when it is dead. |
Cooldown (FPulseCondition_InteractCooldown) | Interaction | PulseAbility | Seconds have passed since the interactable component (the Source of the context) last completed an interaction. Line while it waits: Text (“Ready in {Seconds} s”). |
Pulse Foundation adds the general ones (All Of, Any Of, Not, Context Tags, Actor Has Tags, Actor Tag Query, Actor Is Class, Compare Amount, Blueprint Condition). Conditions that need the inventory or ability system of a player that is not on this machine answer Unknown on clients; the server decides.
Costs
| Cost | Module | Pays |
|---|---|---|
Items (FPulseCost_Items) | PulseInventory | Takes Count items of Item, or items with ItemTag, from the player’s inventory first and, with bIncludeEquipped, then from equipped stacks (a quiver). Refunds give an Item back (items that do not fit are dropped at the pawn; without a player at the Location of the context, e.g. a destroyed building piece); a cost by tag gives back RefundItem, if set. Lent stacks never pay. The take is one change per holder (inventory, equipment), applied together: one event pass each, all or nothing. With FPulseItemCostExtra as extra data of the context the cost pays from (and refunds into) that inventory instead of the player’s first one. The lines show icon, what the player has and what it costs. |
Weapon Item (FPulseCost_WeaponItem) | PulseCombatInventory | Takes Count from the stack of the weapon that granted the attack (bombs, throwing knives). Only for attacks; elsewhere it costs nothing. |
Fraction of the cost context scales the item count (payment stages of a building, a part refund); payments round up, refunds round down (see Pulse Foundation).
Rewards
| Reward | Module | Grants |
|---|---|---|
Give Items (FPulseReward_GiveItems) | PulseInventory | Count items of Item into the player’s inventory; with bDropWhenFull what does not fit is dropped at the pawn. |
Take Items (FPulseReward_TakeItems) | PulseInventory | Takes items like the Items cost, without a check (a quest that takes the letter it asked for); lent stacks stay. |
Roll Loot Table (FPulseReward_RollLoot) | PulseInventory | Rolls Table with Level and the tags, source and player of the context, puts the drops into the player’s inventory (with their random stats) and drops the rest with bDropWhenFull. |
Heal (FPulseReward_Heal) | PulseAttributes | Heals an actor of the context by Amount (for the player: the actor with the ability system). |
Rewards are granted on the authority.
Helpers for own entries
Pulse::Inventory (PulseInventory, Conditions/PulseInventoryConditions.h) has the functions the item entries use:
| Function | What it does |
|---|---|
CountPlayerItems(Context, Item, ItemTag, bIncludeEquipped, bOutFound, bIncludeLent) | Items of the player in inventory (and equipment), lent stacks only with bIncludeLent; bOutFound is false when the player has neither here. |
TakePlayerItems(Context, Item, ItemTag, Count, bIncludeEquipped) | Takes items, inventory first, never lent stacks; returns how many. |
IsLent(Traits) | Whether the instance traits of a stack mark it as lent (FPulseItemTrait::IsLent). |
GivePlayerItems(Context, Item, Count, bDropWhenFull) | Adds items, drops the rest at the pawn (without a player at the Location of the context); returns how many were added. |
MatchesItem(Definition, Item, ItemTag), GetItemEntryName(Item, ItemTag) | Whether a definition is the item (or has the tag), and its name for lines. |
Pulse::Attributes::FindContextAttributeActor finds the actor of the context that has an ability system. Write own entries in C++ by deriving from FPulseCondition, FPulseCost or FPulseReward (Pulse Foundation); they show up in every list with their category.