Writing Custom Actions (C++)

Other than using built-in actionsarrow-up-right, you can write your own via script (C++).


Actions Base Class

When creating a new class, inherit from AActionActorBase defined in "ActionActorBase.h"

UCLASS(Blueprintable)
class ACustomAction : public AActionActorBase
{
    //[...]

DoAction Method

Then, all you need to do is overriding the “DoAction” method and write your code inside it.

Remember that actions pause the typewriter until they’re completed (for example, waiting for player input or until time has passed).

void ACustomAction::DoAction_Implementation()
{
    //[...]
    //Use inherited and already initialized variables:
    //FActionMarker ActionMarker
    //UTypewriterCore* TypewriterRef
    //FTypingInfo TypingInfo
    
    
    //At the end always call TypewriterRef->CompleteCurrentAction()
    //to signal the typewriter to resume typewriting
}
  • The ActionMarker inherited variable has useful info about your tag, for example the ID or if there are any parameters that come with it (e.g. <playSound=02>).

  • The inherited TypewriterRef references the component that is currently performing the action

  • The TypingInfo inherited struct contains information such as the current typing speed (which you can modify) and time passed inside the typewriter.

circle-exclamation

✅ Done!

Done! With this simple procedure, you can add any Custom Action you want.

P.S. Don't forget to add your Custom Action to an actions Database.