x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

alt text

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.

alt text

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 ?

Product Version: Not Selected
Tags:
timer1.png (24.7 kB)
timer2.png (71.7 kB)
more ▼

asked May 14 '14 at 01:51 AM in Blueprint Scripting

avatar image

DrHobo
276 32 37 54

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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 :)

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

more ▼

answered May 14 '14 at 02:12 AM

avatar image

Shadowriver
37.8k 937 172 1123

avatar image DrHobo May 14 '14 at 05:30 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question