Hat selection allows the player to choose a specific hat for the character to wear by choosing it in the main menu.
Difficulty works the same way.
The way I am planning on handling the changes are using simple “ChangeOnInt”
Having the player select No Hat in the menu, for example, would set the Integer “HatSelection” to 0.
The player blueprint would have a “ChangeOnInt” that reads “HatSelection” and sets the hat mesh accordingly.
0 = none
1 = adventurer’s hat
Etc.
Difficulty would work a similar way.
Normally I pass data between blueprints via casting, however, this time that is not possible, as I wish to allow the player to choose these in the main menu, before any level / the player has loaded.
Any help would be greatly appreciated. I’ve read up on Blueprint Interfaces and other ways but can never get it to work correctly.
Most online games use their database for this and since unreal doesn’t really have anything reliant which will stay the same over different character, controller, game modes and level the next best thing I found was a save game.
The performance of this node is incredible and it works pretty much like a normal BP in terms of setting and getting variables. You just have to load it first.
I’m on my mobile right now so I can’t really link a few nice tutorial videos like I’d want to but I will try to do so later today
There are classes that stay alive between level changes. For example the GameInstance. I guess you could set the Hat Enum there and after you startet the game you get it back from the GameInstance and Spawn the Mesh for the player. You can also use a savegame.
That should be pretty easy. Create a new Blueprint and search for “GameInstance” as parent class. Now go into the Project Settings where you normaly set the Standard CharacterBP and so on, and at the bottom you find this:
I already created a BP of the GameInstance class as you see “MyGameInstance”. Inside that BP i created a Bool Variable called “Test”.
Now inside my CharacterBP i just rightclicked and searched for “Game Instance”. I found the node “Get Game Instance”. After casting this to my custom Game Instance Class BP, i was able to get the Test Bool.
And as far as i know, this GameInstance stays alive as long as the game is on. It will be the same over LevelChanges etc. So you could save a variable for the GameTime there. If you also want to save a Variable if the player closes the game, you would need to use SaveGames.