9. Chat Area with Interaction Component {{ currentPage ? currentPage.title : "" }}

Create Chat Area

You have two Options:

  • Make a Child of SP8_Area_Chat.

  • Create a new Blueprint without a Template.

I will explain both!

Make a Child of SP8_Area_Chat

1. Create a new Blueprint and select as Class SP8_Area_Chat.

Do not forget to set the Interaction Profile inside the Blueprint SP8_Area like descriped inside this Tutorial, if you haven’t done it yet!

2. Create a new GameplayTag and call it Area.Types.Chat.

3. Open your new Blueprint and go to the Class Defaults and set your Area Type to your new Gameplay Tag.

Create a new Blueprint without a Template

1. Follow this Tutorial.

2. Add the Interface SP8_BPI_Area_Chat like you added the SP8_BPI_Area.

3. Create a new GameplayTag and call it Area.Types.Chat.

4. Edit the Interface Function SP8 Get Area Type and return your new Gameplay Tag.

5. Edit the Interface Function SP8 Get Area Name and return the Name of your Channel.

I will create a Variable and set Instance Editable and Expose on Spawn to true, so i can edit it inside the Level.

Create Channels

1. First of all we need to drag and drop our new Area Blueprint into our Level.

2. Select your Area inside the Outliner of your Level and set the Area Name to your Channel Name and Area Type to Area.Types.Chat (if not set yet).

3. We need to create for each Area a Channel. So we need to open our GameState and going to do following:

  • Get all Actors with the Interface SP8_BPI_Area_Chat (or your Blueprint Class you are using).

  • Loop trough each Actor and get the Area Name (Function of the Interface) and add each as Channel.

    • I will call the Channel like AREA_<AreaName>, so i don’t make two similar Channels.

  • Important: Visible to everyone should be false, because it should only be visible to the Players inside the Area.

Alternatively you can create them inside the Details Panel of the Game State Chat Component, as long those Channels are not going to be destroyed.

Listen to the Channel

1. With PlayerTemplate Go into your PlayerBP under Class Defaults and set Area Type Chat to your Gameplay Tag Area.Types.Chat.

With PlayerTemplate You are done, because everything is setup.

You can still look the next Points to understand how you can listen to Channels.

2. We should now listen to the Dispatcher AreaEntered on the Interaction Component and do following:

  • First of all check if the Area Type is Area.Types.Chat.

  • Then call the Interface Function SP8_getAreaName on the Area.

  • Now you can add a Listener for a Channel named AREA_<AreaName>.

3. Now we have to do the same with AreaLeft.

Only difference, we have to remove the Listener.

It is simple, if we enter the Area, we are going to start to listen to the Channel of the Area.

If we now left the Area, we will not listen anymore to this Channel.

{{{ content }}}