How-To: Let Players Rebind Chords

Goal: let each player set their own modifier on an action from a settings screen, persisted across sessions, with conflict detection and a display glyph.

Prerequisites
You enabled user settings (How-To: Get the Building Blocks step 3 - the two Project Settings) and apply IMCs via Add Mapping Context With Chord Triggers.

1. Mark the action rebindable

On the UInputAction, set Player Mappable Key Settings -> Class to CrimsonPlayerMappableKeySettings and give it a Name. That Name is the key per-player chord overrides are stored under.

InputAction Details -> Player Mappable Key Settings -> Class = CrimsonPlayerMappableKeySettings -> set Name (e.g. Ability1).
The trigger is auto-injected
You do not have to hand-add a chord trigger for rebindable mappings. Add Mapping Context With Chord Triggers injects a UInputTriggerCrimsonDynamicChord (with an empty DefaultChord, i.e. overrides-only) onto any mapping whose action uses UCrimsonPlayerMappableKeySettings and does not already have one. To also give it a designer default, add the trigger yourself and set both MappingName and DefaultChord.
Verify
The action's Player Mappable Key Settings shows the Crimson class and a non-empty Name.

2. Read and write overrides

Get the UCrimsonInputUserSettings (see How-To: Get the Building Blocks step 3). Write with SetChordRequirement; read the effective value (override, else the inline default) with GetChordRequirementWithDefaults.

Subsystem -> Get Enhanced Input User Settings -> Cast To CrimsonInputUserSettings -> Set Chord Requirement (Mapping Name, Slot, Chord Requirement). Read back with Get Chord Requirement With Defaults.

3. Validate before committing

Before writing a chord, call FindChordConflict (BlueprintPure) so two actions cannot end up on the same key with the same chord. It returns the first conflicting mapping + slot.

cpp
FName ConflictMapping; EPlayerMappableKeySlot ConflictSlot;
if (UserSettings->FindChordConflict(Subsystem, TEXT("Ability1"),
EPlayerMappableKeySlot::First, NewChord, ConflictMapping, ConflictSlot))
{
ShowConflictWarning(ConflictMapping, ConflictSlot);
return; // do not commit
}
UserSettings->SetChordRequirement(TEXT("Ability1"), EPlayerMappableKeySlot::First, NewChord);

ClearChordRequirement removes one override; ClearAllChordRequirements resets them all; HasChordRequirement (BlueprintPure) tests for one.

4. Show the chord glyph

GetChordDisplayTextForAction (BlueprintPure) collapses the whole lookup - active profile -> bound key -> user override (or default) -> formatted text - into one call. Use it for key hints and action bars.

Get Chord Display Text For Action (Input Action, Local Player, Slot) -> Set Text on your key-hint widget. Returns e.g. 'Shift+E' or just 'E'.
Verify
Rebinding the chord updates the persisted value and the glyph; reloading the game keeps the choice (ChordMappings is SaveGame).

See also

  • How-To: Get the Building Blocks - getting the user settings (and the two Project Settings toggles).
  • How-To: Add Modifier-Key Chords - the inline, non-rebindable path.
  • Concept: The Chord System - how overrides win over defaults and how injection works.