Overlap Timer

Hi everyone, i’m trying to make a really simple game, my trouble is that my player has to choose beteween 2 paths, kinda Y interesection, but I need to let him overlap the choosen path for X seconds to the action to happend (follow spline) can someone show me how to set a timer? I’ve event already StartOverlap that change the color of the object and then get the path and EndOverlap that returns the old color, my timer has to be after change color, wait X seconds, check if it’s still overlapping and then get the path.
I hope u can understand me!

1 Like

below is three examples of how this could be done. for your purposes i would try using method 2 since its simple and will work well with your current setup.

method 1 relies on a gate opening and closing depending on if the player is overlapping. basically we open the gate and start a countdown on begin overlap, then if the gate is still open after the delay your script is run.

method 2 relies on timers. the idea here is you start a timer on begin overlap, then if the timer is still valid by the time its meant to run then it runs if not nothing happens.

method 3 is sort of a brute force approach. on begin overlap we start a delay then when the delay is done we check to see if the player is still overlapping by checking it against every overlapping actor.

oh and do note i put flow control in a few of these examples but its not strictly necessary. the other actor == branch bits are flow control.

Glorious ThompsoN13! I know it should be a silly thing but i’ve been troubling with this half day hehehhe, thnks u very much for several options, the second one works just fine, but i’ll try the gate node for learning!

Haha, sorry took too long… I was actually just making the screen shots for this but ThompsonN13 beat me to it I see. I go to post and I see the question answered already. Funny enough, my method was exactly method 1, I just used a regular delay though (only difference, still works the same) anyway glad it is working.

Ah yea, makes sense, I just whipped something up quick did a few play tests and it seemed fine, I figured since end overlap closed the gate it wouldn’t matter but I didn’t get to the caveat where you leave and come back before the delay finished, that would have been a bug in my system. Well thanks for getting to this for me (this was a question from my YouTube tutorial) I felt like I need to solve the issue.

haha yea that happens to me all the time too. as for the delay the retriggerable is actually useful in this case, it ensures that the player is overlapping continually and not just moving in and out. if they begin overlap again the timer restarts.