Text Actor with Kismet Node

#Kismet
#CustomActor
Modified @ 2024-12-28 15:28:43

A custom text actor that can be manipulated with a kismet node!


This actor is similar to the existing Note actor, but it's movable, visible in-game, and can be manipulated using the included "Modify Kismet Text" node.

NOTE: You may want to edit the value of ObjCategory to something unique, so you can tell these nodes apart from other copies in other mods.

Drew_SeqAct_ModifyKismetText.uc

[RAW] [Download]

/**
 * Node that is meant to modify the contents of a Drew_KismetText.
 */
class Drew_SeqAct_ModifyKismetText extends SequenceAction;
 
var bool bOverride_Text;
var bool bOverride_TextColor;
 
var() string Text<EditCondition="bOverride_Text"|autocomment=true>;
var() Color TextColor<EditCondition="bOverride_TextColor">;
 
function ApplyOverrides(Hat_TextRenderComponent TextComp)
{
    if (TextComp == None) return;
 
    if (bOverride_Text)
        TextComp.Text = Text;
    if (bOverride_TextColor)
        TextComp.TextColor = TextColor;
 
    TextComp.ForceUpdate(false);
}
 
defaultproperties
{
    ObjName = "Modify Kismet Text"
    ObjCategory = "Give me a custom category!"
    // Despite what the comment Epic left might make you believe, it, in fact, does NOT
    // automatically generate the handler name, and you DO need to set this yourself :)
    HandlerName = "OnModifyKismetText"
    bSuppressAutoComment = false
 
    Text = ""
    TextColor = (R = 255, G = 255, B = 255, A = 255)
}
 
Drew_KismetText.uc

[RAW] [Download]

/**
 * Custom note actor that can be modified using the Drew_SeqAct_ModifyKismetText node.
 */
class Drew_KismetText extends Actor
    placeable;
 
var() Hat_TextRenderComponent TextRenderComponent;
 
event OnModifyKismetText(Drew_SeqAct_ModifyKismetText Seq)
{
    Seq.ApplyOverrides(TextRenderComponent);
}
 
defaultproperties
{
    Begin Object Class=Hat_TextRenderComponent Name=TextRenderComponent0
        //this looks pretty well centered
        Translation = (Z = 18)
        TextLimit = 50
        Text = "Text"
        HiddenGame = false
    End Object
    TextRenderComponent = TextRenderComponent0;
    Components.Add(TextRenderComponent0)
 
    //Just as a means to select it
    Begin Object Class=SpriteComponent Name=Sprite
        Translation = (Z = -20)
        Scale = 0.5
        Sprite = Texture2D'EditorResources.S_Note'
        HiddenGame = True
        AlwaysLoadOnClient = False
        AlwaysLoadOnServer = False
        SpriteCategoryName = "Notes"
    End Object
    Components.Add(Sprite)
    Begin Object Class=ArrowComponent Name=Arrow
        Translation = (Z = -20)
        ArrowColor = (R=150,G=200,B=255)
        ArrowSize = 0.5
        bTreatAsASprite = True
        HiddenGame = true
        AlwaysLoadOnClient = False
        AlwaysLoadOnServer = False
        SpriteCategoryName = "Notes"
    End Object
    Components.Add(Arrow)
}