I’ve got a map with multiple triggers in it that are used kind of like checkpoints.
But I need to get the time between trigger activation, so for instance the time between trigger 1 activating and trigger 2 and so on, how do I do this?
I’ve got a map with multiple triggers in it that are used kind of like checkpoints.
But I need to get the time between trigger activation, so for instance the time between trigger 1 activating and trigger 2 and so on, how do I do this?
You can store the total level time in your game mode or a level blueprint. In one of these, create a “Time” float variable. Under the event tick, add the Delta to that “Time.” So every frame will add the change in time to your time giving you the total time passed.
When your player activates a trigger, you can call an event that will store that variable into another, or add the current time to an array. When the second checkpoint is triggered, store that value again to a variable or add it to the array with the first. Then you can get that value and compare it to the previous one.
Can you please show me what this looks like as a BP?
So I did this in the Game Mode blueprint. Sorry for the mess, i thought the Prints might make it easier to follow. So the event tick stores and updates the total time. I created a simple Input event in the player that casts to the game mode and runs the Checkpoint Activated event (you can do this through your triggers). the event will store the latest checkpoint time and compare it against previous checkpoint times if there are any and prints the difference.
Evan massively appreciated, but just to clarify can I please ask what the other BPs look like ie player input event.
I’m afraid I’m not very good at coding
Is there not an easier way perhaps using the level bp without using additional events other than the trigger onbegin overlaps?
Here ya go, so this is a very simple checkpoint will look for the Game Mode, and ask it to run its Checkpoint Activated Event and then destroy itself so that it isn’t triggered more than once.
You can completely drop the even tick part, the engine already keeps track of the time played so you can replace the total time float with the “Game Time in Seconds” node