In this example we’re making a rock that can talk to the player and offer random hints where to find coins.
Here is the initial setup in the viewport. This is an actor blueprint.
The first scripting is to set everything up so we don’t have to always create a widget and cast to the ThirdPersonCharacterBP every time we need to. Notice I also added a text variable (light pink) caled talking_array. I clicked on the pill shaped icon in the right and turned it into an array. Once I compiled my blueprint I could add as many sections to the array that I wanted. Here I added four clues and the last section just acknowledges the player found all the coins already so no new clues are needed.
Above is the overlap event. If the player has less than the required amount of coins, a random section of the array is sent to the player’s text variable. If the required amount is found, then that only the last part of the array is sent to the player. Then the widget is called up.
Here are the ThirdPersonCharacter variables. These are her so that in the widget we can cast to them and bind them to the widget text (below).






