Item effects
Module PulseInventoryEffects (PulseInventory + PulseAttributes + Gameplay Ability System). Items act on the character: food and potions that heal, buffs, and stats while an item is equipped. No combat system is needed.
Consumables
Give the item the trait Consumable (FPulseItemTrait_Consumable):
| Field | Meaning |
|---|---|
Effects, EffectLevel | Gameplay effects applied to the user (instant heals, buffs over time) |
Healing | Health restored directly (UPulseHealthAttributeSet) |
UseTime | Seconds the use takes (eating, drinking); 0 = instant |
bCancelOnDamage, CancelTags | Damage or one of the tags on the user cancels the use; nothing is used up |
CooldownTag, Cooldown | Cooldown group (Pulse.Item.Cooldown.*): all items of a group wait together |
Cue | Gameplay cue when the item takes effect |
bConsume | Uses up one item |
Put Pulse Item User (UPulseItemUserComponent) on the pawn next to the ability system. Then:
UseFromInventory(Inventory, ItemId)orUseEquipped(Equipment, Slot)(empty slot = active hotbar slot) on the authority; clients callRequestUseFromInventory,RequestUseActiveHotbarItem,RequestCancelUse.- Results:
Success(instant),Started(takesUseTime),OnCooldown,Busy,NotUsable, … OnUseStarted/OnUseFinished(bCompleted)andGetUseProgress()on every machine for a progress bar; the user hasPulse.Item.State.Usingwhile using.GetCooldownRemaining(Tag)for cooldown displays.- A completed use sends
Pulse.Message.Inventory.ItemUsedon the authority (payloadFPulseItemUsedMessagewithUserandItem; context: the user’s owner asPlayerandInstigator, the item definition asSource, its tags, amount 1), for quests (“drink a potion”) and statistics.
To use consumables through the inventory’s own UseItem / RequestUseItem (a “Use” button in the inventory UI), make the item definitions of class UPulseEffectItemDefinition: its UseItem hands the item to the user’s Pulse Item User.
Stats while equipped
Put Pulse Equipment Effects (UPulseEquipmentEffectsComponent) next to the equipment. It applies, on the authority:
- the trait Equipped Stats (
FPulseItemTrait_EquippedStats): fixed stats (Pulse.Stat.*with a value) and infinite gameplay effects; - the Rolled Stats of the item instance (see Loot).
Hotbar items count only while their slot is active (bOnlyWhileActive). Everything is removed again when the item is unequipped. GetEquippedStat(Tag) sums a stat over all counting items.
The stats are gathered with Pulse::Inventory::GatherItemStats (Items/PulseItemRules.h, shared with the combat stats of PulseCombatInventory): nothing while the item is broken or its hotbar slot inactive, else the stats of every trait the item sees (instance traits first, definition traits they do not override). Own stat traits override FPulseItemTrait::AddEquippedStats (add Pulse.Stat.* values) and, to decide when the stats count, GetStatsOnlyWhileActive (the first trait that answers decides; without an answer the stats count only while active).
Stats become gameplay effects through Project Settings > Pulse > Core > Inventory Effects > Stat Effects: per stat tag an infinite effect with a set-by-caller modifier on that tag. Included: Pulse.Stat.MaxHealth, .MaxShield, .HealthRegen, .MaxStamina, .StaminaRegen (UPulseStatEffect_*). Add own stats with a Blueprint gameplay effect (modifier with Set By Caller magnitude on the stat tag). Stats without an entry are ignored here; other modules can use them (combat stats in PulseCombatInventory).
Cheats
| Command | Does |
|---|---|
PulseInventoryUse <item\|hotbar> | Uses a consumable (adds the two components to the pawn when missing) |
PulseInventoryCancelUse | Cancels the current use |
PulseInventoryStats | Prints health and the stats of the equipped items |