Skip to content

Add an input action with a prompt

Designer · 40 min · No code

Result: a new button, Whistle, that runs a gameplay ability once per press, plus a glyph on the HUD that shows the right key for keyboard or gamepad.

Before you start

How a key reaches an ability

XenoCore uses Lyra's input chain. Five pieces, each in its own asset:

# Piece Sample Decides
1 Input Action Input/InputActions/IA_XenoCore_QuestTracker That the action exists, and when it fires (its triggers)
2 Mapping context Input/Mappings/IMC_XenoCore Which keys and pad buttons fire it
3 Input tag (gameplay tag) InputTag.XenoCore.QuestTracker The name that links the action to an ability
4 Input config Input/InputData_XenoCore Action ↔ input tag
5 Ability set entry Game/AbilitySet_XenoCore_Input Which ability to run for that input tag

The on-screen glyph is a sixth, separate piece: a row in a CommonUI action table (UserInterface/Foundation/DT_XenoCore_Actions) that says which key to draw. It does not read the mapping context. You keep the two in agreement yourself.

IMC_XenoCore is added by the XenoCore plugin at priority 2, above Lyra's IMC_Default at 1. Both are added by the plugin's own Game Feature Data. Don't lower it: other contexts that share keys would start winning. When two contexts map the same key, the higher priority wins only if its action consumes the key; otherwise both fire. Its contexts only apply in Game input mode, so a menu switches them all off.

Steps

1. Create the tag

  1. Open Project Settings › Project › Gameplay Tags and click Add New Gameplay Tag.
  2. Name it InputTag.MyGame.Whistle. Set Source to your own tag source (for example MyGameTags.ini; create it with Add New Tag Source if you have none), not XenoCore's.
  3. Click Add New Tag.

2. Create the Input Action

  1. In the Content Browser, open MyGame/Input, right-click, and choose Input › Input Action. Name it IA_MyGame_Whistle.
  2. Open it. Set Value Type to Digital (bool).
  3. Under Triggers, click + and choose Pressed. Save.

Fails silently: a one-shot action with no trigger fires every frame

With no trigger, a held key fires the action on every frame. An ability that ends straight away then starts again on the next frame, so one tap runs it five or six times. Every one-shot action needs the Pressed trigger. Abilities that stay active for a montage are protected, which is why some Lyra actions get away without one.

3. Map the keys

  1. Open Input/Mappings/IMC_XenoCore. Click + beside Mappings and pick IA_MyGame_Whistle.
  2. Add a keyboard key (for example G) and a gamepad button. Check Controls first; pick keys nothing else uses.
  3. Save. This edits a shipped asset; note it for template updates.

A shared key is decided by priority, silently

If Lyra's IMC_Default or another context maps the same key, only the higher-priority context gets it. The other action simply stops working. Nothing warns.

Open Input/InputData_XenoCore. Under Ability Input Actions, add an entry: Input Action IA_MyGame_Whistle, Input Tag InputTag.MyGame.Whistle. Save.

Every party pawn data points at this one input config, so this covers all characters.

5. Create the ability

  1. In MyGame/Abilities, right-click and choose Blueprint Class. Under All Classes, pick LyraGameplayAbility. Name it GA_MyGame_Whistle.
  2. Open it and click Class Defaults:
    • Lyra › Ability Activation › Activation Policy: On Input Triggered.
    • Tags › AssetTags (Default AbilityTags): add a tag such as Ability.MyGame.Whistle. Tag relationship rows (for example "no whistling during dialogue") can only reach an ability that has an ability tag.
  3. In the graph: Event ActivateAbility → your effect (play a sound, print a string to start) → End Ability.

End the ability

An ability that never calls End Ability stays active, and the next press is ignored.

6. Grant it with the input tag

Every playable body, the player's and each party member's, gets its input abilities from one shared set, Game/AbilitySet_XenoCore_Input. Its pawn data lists it beside that body's own set.

  1. Open Game/AbilitySet_XenoCore_Input. Under Granted Gameplay Abilities, add an entry: Ability GA_MyGame_Whistle, Input Tag InputTag.MyGame.Whistle.
  2. Save.

That is the only grant. Do not also add it to AbilitySet_XenoCore_Hero or AbilitySet_XenoCore_PartyMember: those hold each body's non-input abilities, and a second grant gives that body the ability twice.

Leader-only actions

Interact and its X action are granted only to whoever is leader, from AbilitySet_XenoCore_Interact (the party's Leader Only Ability Set). Put an action there instead if a companion's body must not have it at all.

AbilitySet_XenoCore_Input is a shipped asset; note your row for template updates. To keep it in your own content, make your own ability set and add it to the Ability Sets of each pawn data you use: Characters/VRoid/PawnData_XenoCore_Party_VRoid (shared by all seven VRoid members), Game/PawnData_XenoCore_Player and each Characters/Party/PawnData_XenoCore_Party_*.

7. Add the glyph row

  1. Open UserInterface/Foundation/DT_XenoCore_Actions and add a row named Whistle.
  2. Display Name: Whistle.
  3. Keyboard Input Type Info › Key: the same keyboard key as step 3.
  4. Default Gamepad Input Type Info › Key: the same pad button as step 3.
  5. Save.

The glyph can lie

The row's keys are typed in, not read from IMC_XenoCore. If you change the mapping later and forget the row, the HUD shows a key that does nothing. Change both together.

Keyboard key icons

Lyra's keyboard data has icons only for mouse buttons. XenoCore adds a keycap icon for 81 keyboard keys (letters, digits, F-keys, arrows, modifiers, punctuation) in UserInterface/Input/CommonInput_XenoCore_Keyboard, named by Project Settings › Game › XenoCore UI › HUD › Keyboard Key Icons. A key outside that set draws its prompt text with no key, and nothing is logged. To add one, add a texture and a row to that data asset.

8. Put the glyph on the HUD

  1. In MyGame/UI, right-click and choose User Interface › Widget Blueprint (parent User Widget). Name it W_MyGame_WhistlePrompt.
  2. In the Palette, find Lyra's InputActionWidget (it lives in the project's Content/UI/Foundation/Widgets) and drag it into a Horizontal Box, with a Text label beside it.
  3. In its Details, set Input Actions to one entry: table DT_XenoCore_Actions, row Whistle.
  4. Compile and Save.
  5. Add it to the HUD through one of the HUD's slots, for example HUD.Slot.XenoCore.BottomCenter, with an Add Widgets action. See Add a HUD element. This leaves W_XenoCore_HUDLayout untouched.

Test it

  1. Open Maps/L_XenoCore_Gym and press Play.
  2. The HUD shows the keyboard glyph. Press G: the ability runs once, even if you hold it.
  3. Pick up a gamepad and touch a stick. The glyph switches to the pad button. Press it: it runs once.
  4. Open the Party screen, switch leader, close the menu, and press it again. It still works.
  5. Open the menu and press it: nothing happens while the menu is up.

If it doesn't work

Nothing happens

Check the chain in order: the tag in the input config and the ability set entry are the same tag; Activation Policy is On Input Triggered; no higher-priority context takes the key.

It fires several times per press

The action has no Pressed trigger.

It works until I switch leader

The ability was granted in a set only some bodies receive (AbilitySet_XenoCore_Hero, or one party member's pawn data). Grant it in AbilitySet_XenoCore_Input.

It fires twice per press

The ability is granted twice to the same body: in AbilitySet_XenoCore_Input and in AbilitySet_XenoCore_Hero or AbilitySet_XenoCore_PartyMember. Keep only the AbilitySet_XenoCore_Input row.

The glyph shows the wrong key, or nothing on keyboard

The row's keys don't match the mapping, or the row has no keyboard key.

To show an action in a menu's footer instead, use a CommonUI button: set its Triggering Input Action to your table row, and tick Display In Action Bar on the button. Without that tick, the key works but no glyph is drawn. A button that must not take space can sit in a 0×0 Size Box with Render Opacity 0; don't collapse it, because a collapsed button still draws its glyph but refuses the press.

Going further