[4.9] RPG Companions/Party Members variables

Hello everyone,

I have a design question that I need some advice in. I’m wanting to save my party members into a variable for access in HUD, party menu, equipment, changing who the player is playing as, etc. So my question is where should I store this variable for easy access? I was thinking the playercontroller but after thinking the design further, such as this playercontroller needs to be spawned and harder to access than say a character, I’m not so sure this is the right design.

Just a note is that I was planning on storing the party members in a TArray and will be using C++ and probably blueprint access.

Just looking for some extra advice on this.

Thanks!

If you’re making an RPG, I’d guess you’d not only want this information persistent across level changes, etc., but also between play sessions, right? If so, you’ll probably want/need to create a save directory and write the information to some kind of a data file every time you/the player saves. Then, once the player loads/reloads in, recreating and storing that information possibly in gameinstance or gamestate.

Disclaimer: I haven’t had to do or consider the second part of your question, so this is just based on my understanding of persistence in UE and what I’ve read.

Yeah that is correct and I was planning on going to save that info as well. I’ve messed around with saving/loading data, such as spawn location, and got it to work before.

With that being said, you think it would make more sense to have it in a gameinstance/gamestate then as you mentioned?

I believe those are the way to go, from what I understand, as they are persistent across level changes, etc.

Sounds good and I’ll look into that and see what I can do.

Thanks so much!