How to make an Armory (weapon selection screen) and use it from the Main Menu

Technically this tutorial isn’t even needed, as the ability to have a Starting Weapon is already built-in and can be set in Begin Play on the Character..
armory_startingweapon

 

However few people asked how to select the starting weapon from something like the Main Menu, so that it can be changed dynamically in-game, so I decided to write this tutorial.

Related: How to add a starting weapon and why it’s related to the save system

 

Preparation

1. Create a new save game, a new ENUM and a new widget
armory_savefile

2. In the ENUM list all the weapons that you want to have in the armory
armory_enum

 

3. In the savegame add that enum
armory_savebpvariable

 

Armory Widget

4. In the Armory widget that you created, add a few buttons for each of the weapons that are in the ENUM and a close button
armory_widget

 

5. Still in the Armory widget, create a new function
armory_widget_newfunction

 

6. Still in the Armory widget, connect the buttons (on clicked/pressed) to do this
armory_widget_blueprint

 

Widget (Main Menu)

7. Open the Main Menu widget and add a button to open the armory widget
armory_newbutton

 

8. Still in the Main Menu widget, add this to its Event Construct and to the button on pressed/clicked
armory_mainmenublueprint

 

Character

9. Now open the Character and create a new function
armory_character_newfunction

 

10. Still on the Character, connect the new function anywhere on Begin Play
armory_character_beginplay

 

 

That’s it!

You can now select any of the weapons from the menu and it will be used as the starting weapon for the character.

armory_done