How to put choices in game

Hey I’m new to UE4 and I was wondering how I would incorporate choices into part of a game, which will have consequences later in the game?
For example: (Steal the money) or (Leave it).

Thank you.

You can create a couple structs and a data table to help you do this.

ChoiceOption Struct

  • Name
  • Description

CharacterChoices Struct

  • Title
  • Description
  • Array of ChoiceOption Struct
  • Index of selected choice. (default -1)

Make a DataTable to hold the CharacterChoices Struct. Fill this table with the choices you want available in your game.

In your GameMode create a new Map of CharacterChoices variable. On BeginPlay load the variable with default values of your choices DataTable.

Then you can lookup the choices in your gamemode’s table, and when someone makes a choice you can set the Index of selected choice.

If you include the variable in your save data, then this will become persistent.

there are plenty of ways to do it

it is really a matter of coding style and interaction way (buttons, text, actions etc..)

the general idea behind it is that you take the stuff step by step - and break it to smaller tasks, which you can later learn by order.

for example:

  1. how to create buttons
  2. what are the differences between data storage in singleplayer and multiplayer games
  3. how to save data according to my game style (inside the player class instance / separate class / struct / component…)
  4. how to bind buttons to events

mind, there are many other variations of breaking it down. you should find yours, because there is no ultimate way. good luck with your further development.

Hello, you can use my plugin to create choice based games. It doesnt require blueprint or c++ experience. You just need to create your sequencers and use the plugin to connect them each other with choices. Have a look at it from here;

https://forums.unrealengine.com/unreal-engine/marketplace/1564449-interactive-story-plugin