Armour and level swap

It’s still saying the ActiveGameInstance is empty?
If the Cast fails, are you still trying to run the sequence, or does the execution line stop there?

The LoadActiveInventory function worked before, didn’t it?

Something I forgot to mention earlier, with this game save/load setup it’s important to set the default values in the GameSave object properly. Your other option is the have the “DoesSaveGameSlotExist” fail branch end the execution there rather than creating a new save.

with this game save/load setup it’s important to set the default values in the GameSave object properly.

which values is that?

ok i did some test and print strings, the load function and instance function are both loading when i start the game.
the errors are still appearing over the load functions

so i switched the variables in the game instance and save instance for active weapon/armour and their ID’s to match the first weapon and armour ill have and when i started my last save the character loaded with the gear equipped.
but once again when i stopped that error was still appearing

from what i can gather the variables for inventory, active weapon/armour and weapon/armour active ID seem to not be passing the info to each other either during the save or when loading the game up.

“which values is that?”

All of the variables in your game save object need to have default values applied.
Just like you did for the default values in the Game Instance.

“so i switched the variables in the game instance and save instance for active weapon/armour and their ID’s to match the first weapon and armour ill have and when i started my last save the character loaded with the gear equipped. but once again when i stopped that error was still appearing”

The errors you showed me indicated that the ActiveGameInstance was null; are you getting different errors now?

If the cast to MyGameInstance fails, does execution stop there? Does it keep going?

Can you verify that the game save object has the same slot name each time in SaveGameToSlot, LoadGameFromSlot, and DoesSaveGameExist? Same player index?

I had an error in my LoadActiveInventory method; I was using a local variable to store the ActiveGameInstance (called MyActiveGameInstance); and then I modified the structure so I wasn’t repeatedly getting and casting the game instance, but didn’t change that variable to the class variable ActiveGameInstance.

Long story short: make sure you are using the ActiveGameInstance available to the whole class (My_Character), not the local variable within the Load method.

That might be what’s happening.

The error is here:

http://images.gigasightmedia.com/GMT_graphics/UE4Tutorials/BPInventoryPersist/013-BP-LoadActiveInventory.png

“MyActiveGameInstance” should be “ActiveGameInstance”

I’ll double check the load active instance when I get home from work.

As to the variables those Boolean and integers are all either at default untucked an the integers are all at 0

yep the game instance is a proper variable not a local variable
and all the variables in my save instance and game instance are the same and the error still coming up

can i ask what engine version are you using?

I’m using 4.13 release.

What errors are you getting?

If the booleans are false and the active IDs are 0, doesn’t that mean no weapon or armour are active and they shouldn’t be equipping anything?

Is your inventory variable populate in the game save?

I just installed 4.13, I’m gonna retry this again and see if it works on this version.

yea they were all default, shouldnt they be? so when gaming and im changing various weapons and armour the game remembers which gear it was on the same

yea i had an inventory Variable in both my save instance and game instance

btw mate whats the function for that “destroy active weapon” function?

“yea they were all default, shouldnt they be?”

You have to decide what the default values should be. They have default values assigned by the editor, but they may not be what you want them to be.

The default values should be whatever you want the game to start with when there is no save game already. When the game first starts, when the player starts a new game, the load function will try to load a save game; but no save game exists, so it creates a default game save using the default values, and then loads those into the game.

When there is a game save to load, whatever values that have been set to that save game will be loaded.

The inventory exists, but have you populated it with the starting item data? If the array is empty, even if you have Weapon/Armour Active as true and have active weapon and armour ids, there’s no ItemData for it to load.

I have made so many changes the last few days that it now wont let me equip my gear again and wont pass the branch to verify the ID even tho i have the game instance inventory set with their id numbers and info

http://images.gigasightmedia.com/GMT_graphics/UE4Tutorials/BPInventoryPersist/027-BP-DestroyActiveWeapon.png

I placed it there as a cleanup method; if the SpawnWeapon method is passed an ItemData that is either not equippable, or not a weapon, calls destroy active weapon to set the ActiveWeaponID to a default value representing an empty item (0), and it sets WeaponActive? to false. Finally, if there is an actor loaded into the Weapon, it destroys that actor.

The empty item id can be whatever you want, I just use 0 as a habit to reflect an empty item.

“even tho i have the game instance inventory set with their id numbers and info”

The game instance defaults are overwritten when you load the game save. You have to make sure the game save inventory, id numbers, and booleans are set properly.

Are you verifying that the values coming into your inventory load function are correct?

Yep Iv set the booleans and id’s is every comination, i set the item info in the inventory struck in one or both the save instance and game instance,
I spent 8hrs last night just tryin to be able to equip my weapons and armour again and it wont let me do any of it lol
this is drivin me insane

everytime i press the button to spawn the weapon it wont pass the first branch,
even though the weapon is still saved in my inventory

I wonder if something like this might stop those loading issues

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?

-my game has about 5 different weapons and 5 different sets of armour.
-i have a setup for adding items to inventory and saving them in their through different levels.
-i have a save system that saves and loads the destroyed items in different levels.
-No other character in the game is gonna use the same weapons i have, (was the main reason i originally chose to spawn actor and delete actor of class, since no one else will have them.
-my spells,items and abilities are all gonna have a similier cast type so i’ll worry bout that later.

since a big issue seems to be the integer ID numbers, is there another way around this without them?