How to Add Custom and Parameterized Actions to Convai AI NPCs in Unreal Engine 5

By
Convai Team
May 25, 2026

Key Takeaways

  • Custom Actions in Phase 2 let you wire any Blueprint logic to a named action the LLM can trigger from natural language. The structure is: event fires, action executes, Handle Action Completion gets called.
  • Handle Action Completion must be called on every execution path including On Interrupted. Without it the AI stalls and will not execute further actions or dialogue.
  • Parameters let actions receive dynamic input from the player. A String parameter on a Print action means the character prints what the player asked for, not a hardcoded string.
  • Choices constrain what values a parameter can take. Add one choice per animation variant and the LLM will only select from that list. Unsupported requests fall to the default case.
  • Animation Montages are required for animations being triggered by Convai. Adjust blend in and blend out to at least one second for smooth transitions on MetaHuman characters.
  • This is Phase 2 of the Convai Actions series. Watch Phase 1 first for Default Actions setup before starting here.

Phase 1 of the Convai Actions series covered the four default navigation behaviors: Move To, Follow, Stop Moving, and Wait For. Those work out of the box with zero Blueprint scripting.

Phase 2 is where things get interesting. Custom Actions let you wire any behavior you want to a named action the LLM can trigger conversationally. The player says something. The LLM maps the intent to your action. Your Blueprint executes it. The character does it, not just talks about it.

This tutorial covers the full Phase 2 workflow: adding a simple Print action to understand the structure, adding a String parameter to make it dynamic, triggering animations through montages, and using parameter choices to select between multiple animation variants with a single action definition.

Watch the full tutorial below:

Also read: Phase 1 Blog: How to Make AI NPCs Act on Your Commands in Unreal Engine 5 with Convai

What Do You Need Before Starting?

  • Phase 1 completed: your character has Enable Actions checked and the NavMesh is set up. Watch the Phase 1 tutorial first if you have not done this.
  • A Convai-powered MetaHuman or character already integrated with the plugin. See the installation documentation and the MetaHuman integration tutorial if you are starting from scratch.
  • The Convai Unreal Engine plugin installed and your character connected to a Convai character ID.

How Do You Add a Custom Action and Wire It in Blueprint?

The Phase 2 action structure has three parts: declare the action, implement the Blueprint handler, and call Handle Action Completion when the action finishes. This tutorial starts with a Print action to make the structure clear before adding anything complex.

Step 1: Declare the Action

  • Select your character and click Edit Blueprint
  • Select the Convai Chatbot Component in the Components panel
  • In the Details panel, navigate to Actions and check Enable Actions
  • Click the + icon to add a new action
  • Give it a name. For this example: Print
  • Add a short description. Keep it concise. Long descriptions add LLM context cost without improving behavior for simple actions.
  • Compile the Blueprint

Step 2: Create the Action Handler

  • Right-click in the Event Graph and search for Create Convai Action Handler
  • Select the Print action from the dropdown and click Create
  • Unreal drops an event node named Print into the graph. Every action uses an event with the same name as the action.

Step 3: Implement the Action and Call Completion

  • Between the Print event node and the Handle Action Completion call, add your Blueprint logic. For Print, add a Print String node with the text you want on screen.
  • After the logic, call Handle Action Completion on the BP Convai Chatbot Component
  • Set Is Successful to true
  • Set Auto Report to false for simple actions that do not need to send a message back to the AI
  • Compile and save

With this in place, ask the character: "Hey, can you print?" The character responds verbally and simultaneously executes the Blueprint logic. In the demo, the print string appears on screen while the character says it has been triggered.

Also read: How to Use Dynamic Context in Convai to Build AI Characters That React in Real Time

Why Is Handle Action Completion Critical?

Handle Action Completion is how your Blueprint tells the Convai system that an action has finished. Every action handler must call it, on every execution path.

If you do not call it, the AI gets stuck. It continues waiting for the current action to finish before it will process anything else. No new actions, no dialogue, nothing. The character goes silent until Handle Action Completion is called or the session resets.

The function takes two inputs:

  • Is Successful: whether the action completed as expected
  • Delay: how many seconds to wait before advancing to the next action in the queue. Useful for sequenced actions where timing matters.

Auto Report is a separate toggle. When enabled it sends a context message back to the LLM letting it know the outcome. For simple actions like Print you can leave it off. For failure cases it is worth enabling so the character can respond naturally to the failure.

Use Mindview to verify that action completion signals are reaching the LLM correctly on each turn. If the character goes silent after an action, Mindview shows whether the completion event was registered.

How Do You Add Parameters to Make Actions Dynamic?

A hardcoded Print action prints the same string every time. A parameterized Print action prints whatever the player asked for. Parameters are what make actions feel like the character is actually listening to the request rather than following a preset script.

Adding a String Parameter

  • Navigate back to the Print action in the Chatbot Component Details panel
  • Click the + icon next to Parameters
  • Give the parameter a name. For this action: text
  • Add a short description if helpful. For LLM context efficiency, keep it brief or leave it empty.
  • Set the Type to String

Reading the Parameter in Blueprint

  • In the Blueprint handler, drag from the input pin and search for Get Param As String
  • Set the Name field to match your parameter name: text
  • Wire the output string into your Print String node
  • Compile and save

Now when the player says "Print your name on the screen" the LLM reads the player's intent, fills the text parameter with the character's name, and the Blueprint prints it. The character is no longer printing a hardcoded string. It is printing what the player asked for.

In the demo, the character is asked to print its name, then responds and prints it on screen. When asked again more openly, the character reflects on what to print and chooses something itself, then prints it. The parameter gives the LLM genuine creative latitude within a defined action structure.

How Do You Trigger Animations Through Convai Actions?

Printing text is a clean example for learning the structure. The real power shows when actions trigger animations. This is where Prompt-to-Action becomes visible to the player: the character does not describe the action. It performs it.

Preparing the Animation Montage

Convai Actions trigger animations through Animation Montages, not raw animation assets. This is required because montages give you control over blend transitions and interruption handling.

  • Import your animation asset into the Content Browser
  • Right-click the animation, select Create, then Create Anim Montage
  • Open the montage and check the Blend In and Blend Out values. Set both to 1 second. The default 0.25 seconds is too fast for most MetaHuman character transitions.
  • Save the montage

Adding the Dance Action

  • In the Chatbot Component Actions list, add a new action named Dance
  • Compile the Blueprint
  • Right-click in the Event Graph, search for Create Convai Action Handler, select Dance, and click Create
  • Uncheck Auto Report
  • Drag the character's body skeleton into the graph
  • Add a Play Montage node and select your dance montage
  • Connect Handle Action Completion to the On Completed pin
  • Connect Handle Action Completion also to the On Interrupted pin. This is required in case another montage gets triggered on the same character before this one finishes.
  • Compile and save

Ask the character: "Can you show me one of your dance moves?" The character responds verbally and immediately starts the animation. In the demo, the voice was also updated between Phase 1 and Phase 2 because the previous voice felt too slow for a character with this level of energy.

Also watch: Convai Actions Phase 1: Default Navigation Actions

How Do You Handle Multiple Animations With One Action Using Parameter Choices?

Suppose you have three dance animations: a groove, a disco, and a G-style. Creating a separate action for each means duplicating the action name, description, and Blueprint handler logic three times. That does not scale.

The correct approach is one Dance action with a parameter that selects between the three. Parameter choices constrain the LLM to only select from the options you define, which means the Blueprint handler always receives a known value.

Setting Up the Dance Parameter With Choices

  • In the Dance action settings, click + next to Parameters
  • Name the parameter type
  • Set the Type to String
  • Click + next to Choices and add one entry per animation: groove, disco, g-style
  • Adding choices tells the LLM that the parameter value must be one of these three strings. If the player requests a dance that is not in the list, the LLM still tries to select the closest match, which is why the fallback case matters.

Blueprint Logic: Switch on the Parameter Value

  • In the Dance Blueprint handler, use Get Param As String with the name type
  • Add a Switch on String node
  • Add a case for each of the three choices: groove, disco, g-style
  • For each case, call Play Montage with the corresponding animation montage
  • Connect Handle Action Completion to both On Completed and On Interrupted for each case
  • Add a Default case as a fallback for any value that does not match the choices

Setting Up the Failure Fallback

The default case handles requests the character cannot fulfill. Wire it up like this:

  • Call Handle Action Completion with Is Successful: false
  • Enable Auto Report so the character receives the failure context and can respond naturally
  • Add a note to the auto-report message. Something like: "That dance style is not available". The character will use this to form its verbal response.
  • Add a Delay node of 1.5 seconds before Handle Action Completion so the character has time to respond before the next action in the queue processes

In the demo, the player asks for a ballet dance. The character cannot do ballet. The fallback fires, auto-report notifies the AI, and the character responds: "Ballet is not really my thing. I'll leave that to people with actual grace." The action system handled an unsupported request cleanly without breaking the experience.

How Does This Connect to Prompt-to-Action and Dynamic Context?

Everything in Phase 2 depends on the same Dynamic Context pipeline that powers Phase 1. When a player speaks a command, Dynamic Context  assembles the current scene state, the available action templates, and for parameterized actions, the list of valid choices. All of this reaches the LLM at once.

The LLM does three things simultaneously: generates the verbal response, selects the action to execute, and fills in the parameter values. The player hears the character speak and sees it move at the same time. That is what makes Prompt-to-Action feel natural rather than sequential.

For a single Dance action with three choices, the LLM reads the player's request, maps the intent to the Dance action, checks the choices list, selects the matching variant, and returns the parameter value to the Blueprint handler. The Blueprint plays the right montage. The whole thing happens in the time it takes the character to start speaking.

If the action selection feels wrong or the character picks the wrong animation variant, check Mindview to see exactly what action templates, parameter choices, and scene context reached the LLM on that turn. Wrong selections almost always trace to a description that is too vague or a choices list that does not match what the player actually said.

What Comes Next:

Phase 3 takes this further with typed parameters: actor references that resolve to scene objects, Number parameters for durations and quantities, Bool parameters for on/off states, and constrained Enum parameters that map directly to UENUM types in your project.

See the full Phase 3 Parameterized Actions documentation and the complete Convai Actions reference for the full system overview.

Sign up at convai.com to create AI characters and deploy them across games, simulations, virtual worlds, and training applications. For questions and support, the Convai Developer Forum is the fastest place to get help.

Frequently Asked Questions

How do you create a custom action for a Convai AI NPC in Unreal Engine?

Select your character, open the Convai Chatbot Component in the Details panel, check Enable Actions, click + to add a new action with a name and description, compile, then right-click in the Blueprint Event Graph and search for Create Convai Action Handler. Select your action, click Create, implement your logic, and call Handle Action Completion at the end.

What is Handle Action Completion and why do you need to call it?

Handle Action Completion tells the Convai system that an action has finished. You must call it on every execution path including On Interrupted. Without it the AI stalls and will not execute further actions or dialogue. Set Is Successful to true or false and optionally enable Auto Report to send the outcome back to the LLM as context.

How do you add parameters to a Convai custom action in Unreal Engine?

In the action settings under the Convai Chatbot Component, click + next to Parameters. Name it and set the Type (String, Number, Bool, Reference, or Enum). In your Blueprint handler, use Get Param As String (or the matching type accessor) and pass the parameter name to retrieve the value the LLM selected.

How do you use parameter choices to limit which options an AI NPC can pick?

In the parameter settings, click + next to Choices and add one entry per valid option. The LLM will only select from this list. Requests outside the list fall to the default case in your Blueprint Switch on String node. Wire the default case to Handle Action Completion with failure and enable Auto Report so the character can respond naturally to the unsupported request.

How do you trigger animation montages from Convai Actions in Unreal Engine?

Import your animation, right-click it, select Create > Create Anim Montage. Adjust blend in and blend out to one second each. In your Blueprint action handler, drag the character body skeleton, call Play Montage with your montage, and connect Handle Action Completion to both On Completed and On Interrupted. See the Phase 2 Custom Actions documentation for the full setup.

How does Prompt-to-Action work with parameterized Convai actions?

When a player speaks, Dynamic Context assembles the scene state, available action templates, and parameter choices, then passes everything to the LLM. The LLM maps the intent to the action, selects the parameter value from the choices list, and returns it to the Blueprint handler, which executes the matching logic.

What is the difference between Custom Actions Phase 2 and Default Actions Phase 1 in Convai?

Phase 1 Default Actions cover built-in navigation: Move To, Follow, Stop Moving, Wait For. Zero Blueprint scripting required. Phase 2 Custom Actions let you define any named action and wire it to Blueprint logic. Phase 3 Parameterized Actions add typed parameters for actor references, numbers, strings, and constrained enum choices.