ChatBalloonComponent

Displays a chat balloon and provides a feature to set the related function.

# Properties

[{"index":"boolean AllowAutomaticTranslation (MakerOnly)","0":"Sets whether to automatically translate the value of the Message property."}]

[{"index":"boolean ArrowChatEnabled (Sync)","0":"Sets whether to provide the chat balloon a tail image or not."}]

[{"index":"boolean AutoShowEnabled (Sync)","0":"Sets whether to display chat balloons automatically or not. If the value is true, ShowDuration will make chat balloons visible and HideDuration will make them invisible. This action will be on repeat. If a player's ChatModeEnabled value is true, the automatic chat balloon feature will not work."}]

[{"index":"float BalloonScale (Sync)","0":"Sets the size of the chat balloon."}]

[{"index":"DataRef ChatBalloonRUID","0":"Sets the type of the chat balloon."}]

[{"index":"boolean ChatModeEnabled (Sync)","0":"Decides whether to link with chat. If true, the text entered on the chat window gets displayed as a chat balloon and only works in the Player."}]

[{"index":"boolean EnableProfanityFilter (MakerOnly)","0":"Sets whether a banned words filter will be applied to the Message property."}]

[{"index":"Color FontColor (Sync)","0":"Sets the text color of the chat balloon."}]

[{"index":"Vector2 FontOffset (Sync)","0":"Adjusts the position of the text within the chat balloon."}]

[{"index":"float FontSize (Sync)","0":"Sets the font size in the chat balloon."}]

[{"index":"float HideDuration (Sync)","0":"Decides the amount of time that the chat balloon remains invisible when AutoShowEnabled's value is set to true. After the set time has expired, a chat balloon appears. Defined in seconds."}]

[{"index":"boolean IsRichText (Sync)","0":"Sets whether to use rich text."}]

[{"index":"string Message (Sync)","0":"Decides the content that will be displayed in the chat balloon. A chat balloon will not appear when it's nil or an empty string."}]

[{"index":"float Offset (Sync)","0":"Position offset of the chat balloon. You can adjust the position of the chat balloon up or down."}]

[{"index":"float ShowDuration (Sync)","0":"You can set the duration of the chat balloon. A chat balloon appears and disappears after Delay. Defined in seconds."}]

[{"index":"string TextSpriteSetId (Sync)","0":"This is the Id of the TextSpriteSet entry that will be applied to text."}]

[{"index":"string TextStyleSheetId (Sync)","0":"This is the Id of the TextStyleSheet entry that will be applied to text."}]

##### inherited from Component:

[{"index":"boolean Enable (Sync)","0":"Checks whether Component is activated or not."}]

[{"index":"boolean EnableInHierarchy (ReadOnly) (HideFromInspector)","0":"Displays whether this Component is Enable in the hierarchy. If Entity Enable is false regardless of Component Enable, returns false."}]

[{"index":"Entity Entity (ReadOnly)","0":"The Entity that owns this component."}]

# Methods

##### inherited from Component:

[{"index":"boolean IsClient()","0":"Returns whether the current execution environment is a client or not."}]

[{"index":"boolean IsServer()","0":"Returns whether the current execution environment is a server or not."}]

# Events

[{"index":"ChatBalloonEvent","0":"This event occurs when a chat balloon appears."}]

# Examples

The following is an example of making an NPC that speaks lines at regular intervals. ChatBalloon replaces the dialogue according to the output interval.
    
    
    @Component
    script NpcChatRandomizer extends Component
        @ExecSpace("ServerOnly")
        method void OnBeginPlay()
        local chatBalloon = self.Entity.ChatBalloonComponent
    
        local npcTalks = {}
        table.insert(npcTalks, "NPC Talk 1")
        table.insert(npcTalks, "NPC Talk 2")
        table.insert(npcTalks, "NPC Talk 3")
        table.insert(npcTalks, "NPC Talk 4")
    
        local setMessage = function()
        	local idx = _UtilLogic:RandomIntegerRange(1, #npcTalks)
        	chatBalloon.Message = npcTalks[idx]
        end
    
        local interval = chatBalloon.ShowDuration + chatBalloon.HideDuration
        _TimerService:SetTimerRepeat(setMessage, interval)
        end
    end
    

# SeeAlso

  * UtilLogic
  * TimerService
  * [Making Chat Balloons](/docs?postId=119)