Making the Game: Messaging System
Sometimes, I need to relay a message to the player, either to alert them of something (like activating a checkpoint, or collecting an Activation Core) or to give them a hint in case they're struggling. For these reasons, I created a system to display a message on screen.
For starters, I created a Text variable on the player called "Message" which will store the message that is to be displayed. To control how long to display the message for, I have a bunch of nodes connected to the player's Event Tick. If the Message is empty (checked against Get Empty Text node), the nodes don't run. If the message isn't empty, but a boolean value called "Message Shown" has not yet been sent, the current message is stored in a variable called "TempMessage" and the bool is set to true. Message Shown being true stops the previous nodes from executing, letting a Delay of 4 seconds finish.
Once the Delay is done, the value of "TempMessage" and "Message" is compared again. This is because the Message might've been replaced with another one. If it has been replaced, the boolean is reset, but the message remains on screen. This allows for the Event Tick to run again. If TempMessage and Message are still the same however, the value of "Message" is set to be empty text.
The value of "Message" is set from other blueprints. For example, whenever the player first collides with a checkpoint, they get a message. This can be a simple "Checkpoint reached" or a more room-specific message. After respawning at the checkpoint a certain amount of times, the player may also get a hint.
The player also gets a message upon picking up an Activation Core.
I am happy with my implementation of the system and how it works, as it will provide an extra visual clue for what the player is currently doing / supposed to be doing.





Comments
Post a Comment