Currently, I have a Main Menu Widget system set up so the player can select a weapon to be attached to the player character skeletal mesh and the gun data is loaded using a dataTable and the GameInstance.
My issue is that the gun is disappearing after loading into the next level / Starting the game. Any ideas?
GUN EQUIP Blueprint Logic located in player charcter BP.
Any help is appreciated, thanks!
You want a save-load game logic. There is an official training from Epic, with a sample project for download.
Ill check it out thank you
I have looked through that video as well as many other sources regaurding Save/Loading but it seems that SaveGame Blueprints cannot save Actors, only simple variables such as Integers, Booleans, Transforms etc…
I have implemented it in my project and it just doesn’t work even though it passes at all potential areas of failure.
Any other ideas?
I can send you more screenshots if needed.
It is true, however, if you want to save your loadout, you want to save a reference to those weapon “classes”. For instance, you can save an array of weapon classes, then you use a “for each loop” to “spawn actor from class” and “attach actor to actor” to attach those weapon “instances” to your player sockets.
If you weapon parent class is BP_MasterWeapon, find a variable type BP Master Weapon class, a purple one.
Hope that makes sense.
Now, if you need to save-load ammo information, the logic is the same, for each weapon you want to store spare ammo, ammo in magazine, in the case of firing weapons. The logic will apply for any other variable you want to save per weapon.
Thank you so much for the help !
So I have most of the gun data structured in a dataTable to communicate with the UMG like this:
So instead of an actor variable, you are saying to replace the Actor with it’s Class reference? Would I be able to replace the Purple Blueprint from the picture above with the Actor part circled below?
Can I save this InstanceReference ID for loading the gun later?
Correct, for instance, from SG Equipped Primary, get a node called “get class”, and then you have it, connect it to the correspondent variable inside the save game blueprint. More than likely, the variable type will be “SGEquippedPrimary class”, a purple one.
Yes, you can, for each weapon class, save the correspondent variable of InstanceReferenceID, keeping the same order in both arrays.
Again thank you so much for your help and patience as I am a first time developer! I have gone ahead and have uttilized the Purple BluePrint reference as a variable:
but I am unsure how to go from load save game reference to → attach to actor? What am I missing? How could I utilize the Instance ID to attach to actor?
Don’t worry, before attach actor, “spawn actor from class”, getting the weapon class as input.
Make sure the Instance ID is set to Editable and “Exposed to Spawn”. That way you can connect your loaded instance ID in the Spawn actor from class.
YESSSS! Got It. THANK YOU !!! TWO THUMBS Up for L.F.A forum Admins!
For anyone coming across this post and needing an answer:
To save and load your characters loadout inbetween levels you will need to use the SaveGame BluePrint, however, you cannot save actors only basic variables as mentioned above. It seems you can use the Blueprent Reference (Purple) instead tho:
I did not end up using the Instance ID, which is a variable creating unique reference numbers for each instance of each created actor in the level. (Pink picture above) Im sure this will be a smart tool to use in the future, but for now L.F.A has got me that much closer to my vision. Thank you!
I am very glad you’ve achieved your goals. Good work.
I wish you success in your journey.