Saving and loading doesn't work in trigger box

Hi,

Currently I have a save button that works on a key press like so, this works fine,
image

This BP trigger box does not seem to save the data (Helath and stamina upgrades) however it does save the location and the player spawns in the triggr box when selecting play.

I think the problem is because I load into the trigger and it immediately saves again before the other variables like health and stamina upgrades can be loaded, is there any way to combat this?

ok turns out I was correct with the loading part, adding a delay after the overlap event fixed it but surely there is a better way? Everytime I reach a checkpoint and reload that save I will spawn at the checkpoint and it will save again but that can cause issues. What is the best way to handle a situation like this as the checkpoint should only really work once?

BeginOverlap should only be called on the TickGroup == Physics_Update which should happen after the first BeginPlay round of calls
as long as the object starts inside the trigger volume the overlap has already happened so BeginOverlap shouldn’t fire.
does this happen if you Start a PIE with your player character inside the Checkpoint_Trigger_Volume?

on the subject of “How do I make it so my Overlap only happens once” aside from changing the collision profile, you could just chuck a bool at it

if( !bHasBeenUsed )
{
    // do stuff
    bHasBeenUsed = true; // this can be a serialized bool so it is saved as well.
    // disable Collision
}

then to be doubly sure in the BeginPlay

if( bHasBeenUsed){
    // disable collision
}

if you do want to be able to ping-pong between these trigger volumes and have them function then you can give each Trigger Volume an index, and then have your character hold the index of the last one that was used. In this approach you wouldn’t disable the trigger volumes collision.

1 Like

Hi, yes it occurred in PIE, I have however resolved the issue after some BP scripting. Luckily I already have a decent save system so I created a map with the parent actor and a bool to check the state. On the level BP I then add actors that have been used and find what actors have been used

on the checkpoint actor itself I then do this, at the end of this I just do various checks and cast to the gamestate to call the dispatcher.

This way I can easily add more in the level and then just copy the code on other levels, here’s the end result. I can’t see anything wrong with this at the moment but I’m open to suggestions and/or improvements :slight_smile: .