Armour and level swap

In this image of your game instance, WeaponActive? and ArmourActive? are false, and the inventory array is empty.

Is there anywhere that you populate these variables?

When you use the Game Save, these default values in Game Instance become irrelevant.

This is what my GameInstance looks like:

http://images.gigasightmedia.com/GMT_graphics/UE4Tutorials/BPInventoryPersist/029-BP-MyGameInstanceDefaults.png

Notice the default values are set, and the inventory is populated.

http://images.gigasightmedia.com/GMT_graphics/UE4Tutorials/BPInventoryPersist/032-BP-MyGameInstance-Variables.png

The eyes next to the variable names are open and green; meaning external blueprints can edit these values (open eye); and the tooltip has text (green).

http://images.gigasightmedia.com/GMT_graphics/UE4Tutorials/BPInventoryPersist/033-BP-MyGameInstance-Inventory.png

The ActiveArmourID corresponds to an armour item; and the WeaponID corresponds to a weapon item.

And my Game Save looks like this:

http://images.gigasightmedia.com/GMT_graphics/UE4Tutorials/BPInventoryPersist/028-BP-MySaveDefaults.png

Again, the defaults are set and the inventory is populated.

http://images.gigasightmedia.com/GMT_graphics/UE4Tutorials/BPInventoryPersist/030-BP-MyGameSave-Variables.png

The variables are the same, just listed in a different order.

http://images.gigasightmedia.com/GMT_graphics/UE4Tutorials/BPInventoryPersist/031-BP-MyGameSave-Inventory.png

The inventory is basically identical to the one in the Game Instance.


The Game Save will be more important when you have the save system active.

My meshes and actor classes are blank and you’ll need to populate them for the equipment to show up in the game graphically; but you can always check the data by printing the set values to the log/screen. If you’re getting all the way to SetArmour and SetWeapon with the proper data and you need help with the spawns, that would be questions for a different post; the spawning and attach methods are copied from what you showed me when we started, there’ve been no changes there.

But you’re saying the branches in LoadActiveInventory fail, yes?

You’re saying that the weapon loads, but not the armour? What do the weapon graphs look like?

Are you just using the Game Instance data now? Where is the weapon data coming from if the Game Instance marks WeaponActive? as false and has nothing in the inventory? The spawn methods are different; the weapon spawn is hard coded with a class, maybe the inventory load is failing for both but it looks like weapon is working because of that?

Do you ever call EquipWeapon or EquipArmour? They will only work if the character currently doesn’t have an active weapon and armour (notice the first branch comes from WeaponActive? and ArmourActive? being false; I did that because that’s how you had the logic setup at the start; my guess was you wanted to force players to unequip existing items before equipping new ones - is that not what you want?)

I’m pretty sure everything I built is in the images on this page; is there something else you’re not finding?

Can you show me all the graphs you build for this, as they exist now? Including the BeginPlay execution in your character.

Are you saving all your defaults on the save instance and not the game instance?

Right now I have them set on both.

But as I’ve said, when you implement the save system your game save values will overwrite the game instance values when you load the save; so the game instance default values won’t matter.

And if you have any game saves on disc that have the wrong data, they will override the game save defaults when the game save is loaded from disc - so you need to delete the save files if you change your defaults.

do you use skype or discord?

I don’t, sorry.

Ok i tweaked some things and followed your last pics of your instances and i managed to get weapons and armour (only have 1 armour set atm till i make more so cant test the variations of that yet)
but there is one thing, I’m not sure how but so far the saving is working, the items stay in my inventory when i stop and start thegame and when i open new levels. But the “problem” is um, i havent implemented the active weapons and armour variables into the save instance yet so not sure how this is happening lol

I’ll have to make a few other armour and weapon pieces now before i can test all ,this.
so good new mate you’ll be safe from me… for awhile lol

If the values don’t exist in the GameSave, the GameInstance values will keep its defaults. If the default values in the GameInstance are the correct values the system will work as if it’s loading the save.

:slight_smile:
Good luck!