Problem with checkpoint

Hello everyone!!! I am developing a game in which the player has to wear special glasses to travel into the past and back into the future. Let me explain how the mechanics work:

I have created a copy of the same world at a certain distance. In this second world, I have a capsule (orange one in the drawing) that controls whether teleportation is possible. If teleportation is possible, the player travels into the past and the capsule is sent into the future. If teleportation is not possible, the player stays in the future.

My problem is that I created a checkpoint system, but it only works in the future. I cannot understand why it does not find the reference to the checkpoint when the player goes to the past.

how the checkpoint system work?

works with two blueprints. The first is a simple box collision that, when the player enters, saves the player’s position in the world to allow respawn at the last checkpoint reached (BP_RespawnPoint). The second is a trigger that brings the player back, called BP_FloorDie.

BP_FloorDie



BP_RespawnPoint

is “LatestRespawnPoint” supposed to be shared by both the future and past checkpoint system?
If so extract it to a “third party” blueprint and pass it in as a reference so that both checkpoints can share the information.

You could also share the position via a material parameter collection though you can only save scalar or vector parameters there so rotation would need to be converted to a vector based on x (not ideal).

but if the checkpoint system are all in one blueprint, why is there a need to create a third party blueprint to pass the variable?

Ah ok, yes if both capsules are in the same bp then the variable should be shared.
Unless they are two separate instances of the the same bp, then each has their own instance of the variable.

Add a breakpoint on the set transform for that parameter (F9) and see if it is triggered during gameplay.

The respawn mechanism consists of a single box trigger which saves my position upon entry and then communicates it to the ‘floor die’. Upon death, it resets my position to the saved location. and yes it’s saves the player location when dies even in the past so now the problem is why is teleporting me far away if the location are correct?

Is “Floor Die” valid when you are setting “Latest Respawn Point”.

Also overlap triggers will not fire if the character starts on them. Perhaps that is the problem.
You would need to do a box raycast on begin play to set this. The overlap is ignored on construction. You need to exit the component and re-enter for it to register.

Does this volume share the player start coordinates?

If so try this solution

Yes, when I overlap the trigger box in the past, the ‘floor die’ variable is valid. I’ve noticed that when I go into the past (when it’s black and white), the function that checks for the player doesn’t recognize the player.

Function That check if is the player that overlaped

try
“get player controller” => “get controlled pawn”
I’ve seen on other forum posts, that get player character in some cases behaves strangely.

It would be better to just add an actor tag to your player and then on overlap check if the overlapping actor has the tag for instance “Player”. No need for complex testing / comparing.

It seems the issue might be the lack of a variable to track which bp_Floor die is being used, as the bp_Floor die is instantiated twice. How can I obtain a reference to the new floor die each time it’s created?

You could to a line cast below the player character or on collision get the reference to the current floor and set it.

i tried to create a reference in the bp_resapawn called “LatestFloorDie” and then i set it when i collide with the bp_floor die but it dosen’t work

The floor has to generate collision hit events. Make sure it’s firing first.

The logic is to proceed to the checkpoint, and then, if you touch the ground, you will simply respawn. so it’s diffucult for me get that variable with collision event

Then take the burden of responsibility away from the floor. Have the floor contact the blueprint with the checkpoints and keep the variable there. The floor does not need to process the logic, just give the signal to the checkpoint bp.

The checkpoint bp should be holding this information.
Then the floor instance doesn’t matter.

how can i give that signal?

Either by reference or you could bind an event dispatcher.

so i resolved by using the gamemode to respawn the player with a function that takes the value of the last checkpoint and it worked

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.