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.
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).
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?
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?
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 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.