so i am using the level streaming but the question is see i have a checkpoint system and gameinstance and i teleport player when game start to the last location checkpoint and on my peresistant level blueprint i have event begin play and load stream what can i add there for me to check first depend on last location then load that stream and then spawn the player so he doesnt spawn in air
If you want to be able to exit the game, the start again, and have consistent checkpoint information, you have to put it in the save game.
Save game is exactly the same as game instance, but it lives between games.
Here’s something about save games:
Hello yes i forgot about this i do have a savegame i used that but the problem is
I dont know what to add between the load stream level and event begin play
So that i check first where last checkpoint then load level based on that checkpoint that it is inside it
And then spawn player
You have to update your checkpoint system a little. You need to know two things:
Name of last running level
Player start tag ( player starts can have tags, so you can have more than one per level ).
So, this stuff need to be in your checkpoint.
Game begins ( beginplay persistent level, level BP maybe ), and you open up the save game to find where the player last was.
Once you have the level name you can stream it.
Then have a loop ( with delay ) until you can see the right player start, then spwn your player
Here my bit of BP for starting the new level ( in 2 parts ):
So you can see the wait for the player start, and then spawn and possess. Then the save game write because now we’ve switched levels.
Those are my checkpoint bp and level streaming bp
You probably need to change things a bit. Basically everytime you have a checkpoint, you need to put it in the save game. It’s a lot easier if you write macros to write to the save game, that way it can be a single node every time you do it.
You need to put stuff in the persistent to find out where the player was from the savegame and then load that level and put them at the correct player start. You can’t do it with a overlap, because you don’t have a player.
Is this making sense.
If you streaming and checkpoint system is working with the game instance, it’s only a bit of a tweak to get it working with the save game, because they’re basically the same thing.
I do have a player and in my save game i am storing lastlocation as variable and feeding it to my checkpoint bp as u can see in the image so basically i am getting the location the player last was but my problem would be how can i load the correct level based on my lastlocation variable in my peresistant level blueprint i have there only event begin play and connected to load stream level which works but not works with if i go to level 2 and lunch game again i get lunched in the air
You need to store the level name as well as the location. Then in the persistent you have everything you need to do the job.
You can’t tell from location alone which level the player was in. Because all levels have the same coordinate system.
Alright so you mean i should make a variable called level to load in my save game bp but once i do that could you tell me what kind of blueprints i have to add on top of what i have now
Yes, you need to do that. When you checkpoint, put the location and level to load in the save game.
Then, in persistent, it’s bascially the code I gave you above. Tell me if you get stuck…
EDIT: Don’t worry if you can’t find some of those node, they’re functions of mine. So the movement stuff and ‘mojo’ thing don’t matter, that’s just post processing.