Player character switching?

Since we can build a camp and recruit a new NPC for now, I’m start thinking mabye we can make a system that switch a different character on the camp, so if you died, you wont need to crate a new character and go back the world all over again, but instead, have one of your members continue the journey that the last character left, and of course, you can switch the character any time once you back on the camp,

You guys have already played the game call “State of Decay 2” right? it has a stystem that you can switch a different character on the game, after relationship become good enough, and I thought this system make zombie survival game pretty good,

So, what’s on your minds? guys? I wonder how hard to make this stystem…

1 Like

This wouldn’t be trivial to implement, but it’s not impossible either.

You’d need to write two functions, convert npc_to_player and convert_player_to_npc, or more likely player::serialize_as_npc and npc::serialize_as_pc. players and npcs both inherit class character, so that wouldn’t be too hard, I expect. Then you’d have to add a menu or something to let you switch, which would serialize[1] the player as an NPC and the NPC as the player, and then deserialize them.

I’d start with just the serialize_as functions and a debug menu option to make the switch when you save and reload the game, since that would be easiest to test. When you got that working, you could move it to an in-game menu option within the camp manager dialogue.

Good luck implementing this.

[1] serialize means convert to a JsonObject which can then be saved or loaded; deserialize means convert from a JsonObject.

1 Like