So I’m trying to make an attribute/stat system that I can use to pass between maps and gamemodes (starting from the overworld and transitioning to the battle scene and back). I want to make it so that I can change the stat variables in one map/gamemode and have them stay that when when returning to the other. So far I have a basic system in both maps/game modes however I realised that storing them in their respective character BPs wont work so I have opted for storing all of my stat variables in a savegame BP. The picture below is my BP for showing the stats in a widget when in the overworld of the game:
The Second picture is what I am aiming for, in the input node I have a variable with a reference to the save game BP and I am getting the new variables from the save game. This is when I get this error:
I have tried casting to the save game object but obviously that’s just redundant and doesn’t change anything. I dont really understand what it means by the number of arguments or what “delegates” are.Help is much appreciated, I have been banging my head on this for the past week now and still can’t get it to work.
Anything you save in a GameInstance class will be persisted from the moment the game starts until the moment the game ends. You should look into that! You can create your own GameInstance class, and then change it in your ProjectSettings → Maps and Modes → Game Instance class (last option).
Would I be able to save that instance when I exit the game? Since I’m going for a JRPG type game I need to be able to save these variables and come back to them so the player doesnt lose any progress.
Well, if you want the variables to be saved when you exit the game, then yes you do need them to be saved using the SaveGameToSlot node. Now that i look at your question properly, you might be getting that error, because your CastFailed pin, when you’re casting to the ThirdPersonCharacter, doesn’t return anything and it should (just return 0 or something).
I might not have worded my question very well. The image which has me casting to thirdpersonBP is the BP I currently have, this doesnt work for what I want as I can not pass the variables stored in it between levels. The second picture is my attempt at trying to use the SaveGame class in the BP, which is returning the error
So in the end I have scrapped this method and switched over to using a save struct for my variables and have managed to get the structBP to communicate with the the widget. I wasn’t well educated on the use of save game classes and assumed I would only need one set of variables in the savegameBP which wasn’t true. I have a Struct for the saved variables and a struct for my players variables which will set and get eachother on save/load.