There are lots of ways to do this, this is just one example. But in all of them you’re going to need a way to identify the individual pieces.
I don’t see how the issue is the ID numbers.
Can you post images of your graphs so I can see what you setup is currently? I’m sure there’s just something set up improperly right now, the system works on my machine, we just need to find out where.
Going forward, it’s going to be important that you understand how this system works because any other game save system you have will be based on the same fundamentals.
I completely agree mate, sorry I’m being abit of a dunce about this, I have a slight touch of dyslexia and it makes reading alot of these tutorials tough to catch onto, i do better seeing them in action
If I were designing the system from scratch, and your game is only going to have 5 weapons and 5 armour total through the entire game, and only the player character would ever use them or equip them, and they’re not going to exist anywhere else in the game world or in the UI, what I would probably do is:
Lose the inventory, IDs and booleans from my game save data and instance
Create two enums; one for weapons and one for armour, each with 6 elements, one for each weapon/armour type and one for None.
Add variables of these enums to my game instance and to the game save that are loaded and saved. These will indicate the currently equipped items.
I would build the armour and weapons as components rather than actors.
When an item is equipped, I would call a method that destroyed any the existing component and then used a switch to spawn the new item component (or didn’t spawn a new one for None equipped).
The advantage of this system is simplicity, the disadvantage is you lose a lot of flexibility if your game design changes (you want to add/remove item types, etc).
But fundamentally saving and loading an enum value is no different than saving and loading an integer id.
I’d be tempted to try that, but I’m actually remaking an old ps1 2D game and it had the classic old inventory system. you probly never heard of the game its Blood Omen Legacy Of Kain.
" I would build the armour and weapons as components rather than actors."
This id like to do but i cant work out how to use the master pose function for armour to use things like child actors or other components with.
“OK i deleted al the previous stuff and functions, im gonna retry this again only our page has gotten packed with so much stuff and optional options.so amongst all this stuff what would be the best option for me?”
Build the inventory equip and load system exactly as I have in the blueprints I posted, but make sure you’re always using the class-wide ActiveGameInstance.
Build the game save/load system exactly as I have in the blueprints I posted.
Place the call to LoadGame between SetActiveGameInstance and LoadActiveInventory in your character’s BeginPlay branch:
Yep I double checked all that, i even made sure the pick up items ID numbers matched aswell and still nothing happened.
I’m retryin it all again now, but instead of weapon actors i’m gonna try somehow to use either components or child actors to get the weapon blueprints and not the meshes
and thats how my Game instance is set, as you see the weapon active ID is the same number as the item ID the booleans for equipped and weapon are ticked.
and once again when i start playin the weapon wont equip and wont pass the second branch in the equip function
“thats how my Game instance is set, as you see the weapon active ID is the same number as the item ID the booleans for equipped and weapon are ticked”
Those settings don’t matter anymore. As soon as the game save is loaded they are overwritten with the values in your game save.
“once again when i start playin the weapon wont equip and wont pass the second branch in the equip function”
You have to set the default values in your game save.
Also, if you have an existing game save on the disc, it will load and overwrite the default values. When you make changes to the game you have to delete your existing saves.
ProjectDirectory/Saved/SaveGames
Think about the process your game state goes through:
Game Launches
Game creates Game Instance with default Game Instance values
Game loads the active level and creates Character
Character loads the active Game Instance
Character loads the Game Save; if Game Save exists, loads data from disc; if Game Save does not exist creates new one using default Game Save values
Character overwrites Game Instance data with values from Game Save (Game Instance and Game Save now hold the same data)
Character equips/unequips items, changes Game Instance data (Game Instance and Game Save now hold different data)
Player saves game: Character overwrites Game Save data with values from Game Instance (Game Instance and Game Save now hold same data), writes Game Save to disc
Player exits game
If the Game Save defaults, or the Game Save data loaded from the disc, aren’t what you want then the values used by the Game Instance after the Game Save is loaded won’t be what you want.
You can’t test the game state by looking at your Blueprint defaults; you need to check what the Weapon ID is when you call LoadActiveInventory; you need to see what the ItemData is that is passed to WeaponSpawn when it is called.
I’m not even using the LoadActiveInventory function yet,
I restarted makin all these functions and im startin step by step, before i worry about loading the gear on new levels. first i wanna make sure that using the game instance allows me to equip my gear, and when i start it wont pass the second branch, i have print strings and the game loads and the game instance loads but its not recognizing the gear of its ID, wether its weapon or armour and if its equipped, its not reading any of that even tho i have all that set in the game instance and inventory struct
ok i have the issue of the gear not equipping, i tried switchin up a few of the true/false branches in the equip methods and it fixed that. So now i can equip my gear again through the game instance.
only thing tho is that when i swap levels my armour stays equipped but the weapon doesnt, I’ll worry about that later though.
Next thing I’ll work out tomorrow is the whole saving for quitting the game. we’re bout 50% through lol
OMFG I’m seriously starting to hate this engine. went to bed last night and all the equip functions worked fine, wake up and go on again and today and the armour just wont equip, even tho the stream ar of the function is all goin through fine