Armour and level swap

I never had to do that with the inventory array, all the pick up and add to inventory tutorials i followed didnt say anything about it.
so in the instance blueprint do i have to add each item that will be in the inventory array with that “element” value thats under the variables default value?

yep its goin no farther than the branches, like you suggested tho perhaps i have to add the stuff to the inventory in the game instance blueprint, since that array probly needs that stuff in it to set not only the items, but it might give the items their active ID aswell

Hmm ok i just entered the swords info and the sword equipped!! woohoo
when i saved and reopened the level tho, it didnt keep the weapon equipped, but ill redo this tutorial of yours again and perhaps that will sort all these issues out, i’ll let ya know how it all goes when i implement this all,
thanks for this help, i know im a bit of a pain noob lol

It won’t keep the weapon equipped after saving the level within the editor; but if you are playing the game and load a new level it will keep the equipment when you move to the new level.

Stopping your game session and then restarting is like exiting the game and then reloading the game. In order for that to persist you’ll need to implement a game save system.

https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Blueprints/index.html

When you save your game, take the values in your game instance and set them to corresponding values in the game save object.

When you load your game, take the values from the game save object and set the corresponding values in your game instance.

Saving the level in the editor isn’t like saving your game when you play.

hmmm iv got a save system that saves the items in my inventory, ill have to tweak that abit to save what i have equipped aswel then :stuck_out_tongue:

If it’s saving the inventory in your character, remember to change it to use the one in your game instance.

Then just add the active booleans and the active ids from the game instance as well, and you’re good.

When all is said and done, you should be getting rid of the inventory and all other redundant variables in MyCharacter and in your widget. Only keep what you’re actually using.

lol ill work on this tutorial and get all these functions workin, then i’ll torture you on which variables go where to be able to save it all lol
:stuck_out_tongue:

Sounds good.
If you think this answered your question, please be sure to accept an answer so other people searching for the same thing will know it’s been resolved and can find an answer for their projects.

If you have an issue with the game save, it’s probably good to file a new question.

And you can always message me for more info, or add a comment to this thread and I’ll see it.

Good luck!

He bro I set up some function of this and so far when i use the reopen level node my character is still wearin the weapons n armour so it all seems to be workin atlast for that function, Huge thanks again for that again mate i owe ya big time

Which variable do i have to put in my save function to let this stuff follow on when i stop the game and restart it

Any data you want to persist between game sessions needs to be stored in your game save.
For the system I designed for you, you need to keep all of the variables we built into the game instance in the game save as well. The GameInstance data persists between levels, and the save game data persists between game sessions.
When you save the game, copy the current values from the Inventory, Armour/WeaponActive? and ActiveArmour/WeaponID in the game instance into your game save. When you load the game copy from the game save to the game instance.

lol you mean i gotta remake all those functions for the save instance aswell!!
oh fudge on a crispy lol

No, not at all.

You just have to create duplicate variables within your save game object and, within your game save function, assign the values in your game instance to the duplicate variables in the game save object.

Do the reverse within your load game function.

Since you’ve already got a game save object, and presumably game save and game load functions, all you have to do is create 5 variables in your game save object and set/get their values within the game save and game load methods.

Every time you add a variable you need to save for your game (character experience, current level, current stats, active quests, completed quests, whatever) you just want to add a duplicate variable to your game save so it can be saved to disc and loaded in the new session; and make sure you update those variables when you save/load the game.

but if those vaiables are already assigned to the game insance hot will the save variables know they are part of the ones from the game instance?

im being a noob again arent i lol

even more confusing cause i have 2 save/load functions atm :stuck_out_tongue:

that function saves my characters location and the items/pickups destroyed that i add to my inventory

and the second is the save i use to actually save those pickup items in my inventory

ue4 just doesnt give much info on this of what kind of variables are made and used and where :frowning:

“hot will the save variables know they are part of the ones from the game instance?”

It won’t, and they aren’t.

When you save the game, you have to:

  1. Retrieve your game instance
  2. Get the values you want to save from the game instance
  3. Set the values you want to save in the game save
  4. Save the game save

When you load the game you have to:

  1. Read the game save from disk
  2. Retrieve your game instance
  3. Get the values from the game save
  4. Assign those values to the variables in your game instance.

It’s the exact same process you did below to save your inventory value in the character, you’re just using the inventory value in the game instance instead of in the character.

You’ll have to do the same thing with the booleans, and with the active ids.

"ue4 just doesnt give much info on this of what kind of variables are made and used and where :frowning: "

Deciding what variables are used and where is the essence of game design. There is no way Epic can tell you what variables are used and where for every game. Those decisions are different for every game.

lol you realize if i could drop a homer simpson emoji right now i would :stuck_out_tongue:

so would those variables i made for game instance, if i duplicated them in game instance bp, where would i set them in my save function? and load function?