Timer: Pause and unpause question.

I created a blueprint for an NPC character: each character has a collision box and sets a personal timer on EventBeginPlay. My goal is to pause the timer when my player controller enters the character’s collision box and to resume when it leaves.

6219-timer1.png

As you can see, this timer lasts 5 seconds, is looping and calls Jump() at each iteration (actually, it prints a string saying “Jump.”).

When I enter or leave the collision box, OnComponentBeginOverlap() and OnComponentEndOverlap() are called respectively. (They are located on the same EventGraph of the Blueprint’s EventBeginPlay.) Both call a function called Interact() which passes a boolean and calls Pause() or Unpause() for the current timer.

My problem is that the timer never pauses. It keeps triggering every 5 seconds without a hitch even though my script flows through the Interact function (yup, with the glowing flow that highlight the nodes …). I later added some functions to Pause() and Unpause() but nothing goes through them, so there’s a problem with calling those functions here. I assume that all references to objects default to 'self: i.e. the character’s blueprint.

Can anyone see what I’m doing wrong ?

Timer use function pointer (in case of blueprints, function name) as timer identifier, in similar ways in old versions of UE, so you use function name to define what timer you want to operate. For example if you Set Timer with “Jump” function, you can pause this timer with Pause Timer node with “Jump” function name. And yes this means you can run multiple timers in same time one for each function :slight_smile:

Also keep in mind that timer runs inside the object, thats why you got Object arguments too

I’m not familiar with older versions of UE but adding “Jump” to Pause() and Unpause() seems to do the trick. Many thanks.