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¶
- Input and camera: how a key reaches an ability.
- Controls: which keys are already taken.
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¶
- Open Project Settings › Project › Gameplay Tags and click Add New Gameplay Tag.
- Name it
InputTag.MyGame.Whistle. Set Source to your own tag source (for exampleMyGameTags.ini; create it with Add New Tag Source if you have none), not XenoCore's. - Click Add New Tag.
2. Create the Input Action¶
- In the Content Browser, open
MyGame/Input, right-click, and choose Input › Input Action. Name itIA_MyGame_Whistle. - Open it. Set Value Type to Digital (bool).
- 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¶
- Open
Input/Mappings/IMC_XenoCore. Click + beside Mappings and pickIA_MyGame_Whistle. - Add a keyboard key (for example G) and a gamepad button. Check Controls first; pick keys nothing else uses.
- 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.
4. Link the action to the tag¶
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¶
- In
MyGame/Abilities, right-click and choose Blueprint Class. Under All Classes, pickLyraGameplayAbility. Name itGA_MyGame_Whistle. - 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.
- 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.
- Open
Game/AbilitySet_XenoCore_Input. Under Granted Gameplay Abilities, add an entry: AbilityGA_MyGame_Whistle, Input TagInputTag.MyGame.Whistle. - 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¶
- Open
UserInterface/Foundation/DT_XenoCore_Actionsand add a row namedWhistle. - Display Name:
Whistle. - Keyboard Input Type Info › Key: the same keyboard key as step 3.
- Default Gamepad Input Type Info › Key: the same pad button as step 3.
- 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¶
- In
MyGame/UI, right-click and choose User Interface › Widget Blueprint (parent User Widget). Name itW_MyGame_WhistlePrompt. - In the Palette, find Lyra's
InputActionWidget(it lives in the project'sContent/UI/Foundation/Widgets) and drag it into a Horizontal Box, with a Text label beside it. - In its Details, set Input Actions to one entry: table
DT_XenoCore_Actions, rowWhistle. - Compile and Save.
- 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 leavesW_XenoCore_HUDLayoutuntouched.
Test it¶
- Open
Maps/L_XenoCore_Gymand press Play. - The HUD shows the keyboard glyph. Press G: the ability runs once, even if you hold it.
- Pick up a gamepad and touch a stick. The glyph switches to the pad button. Press it: it runs once.
- Open the Party screen, switch leader, close the menu, and press it again. It still works.
- 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.
Menu prompts¶
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.