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"

Overlap Triggering Every Tick

How does one go about making Overlap not trigger every tick? To be more specific, I'm trying to have an NPC enemy follow a player, when the player gets within arm distance(Capsule component overlap) it attacks. However every time the player updates within the capsule it triggers again. What I really want is for the enemy NPC to only be able to hit the player every 2 seconds or so and only when they are in the capsule.

Product Version: UE 4.14
more ▼

asked Jan 06 '17 at 03:58 PM in Blueprint Scripting

avatar image

22 5 7 10

avatar image Looniper Jan 06 '17 at 04:22 PM

Just a note, you really shouldn't attach anything that involved to On Tick. Events you won't need to take place more than say 50 or 100 times / second should be set up with Timers.

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

1 answer: sort voted first

Just add a check/bool to keep track of if it attacked, and then delay.

OnBegin Overlap -> Branch (If attackedRecently) -> (False) -> attackedRecently=True -> DoWork -> Delay 2s -> attackedRecently=False OnEndOverlap -> attackedRecently=False

If the NPC can attack more than one player, you will need to make it fancier and add in an array of targets to check if it already hit as well, but the above will work for single target just fine.

more ▼

answered Jan 06 '17 at 04:10 PM

avatar image

136 4 5 13

(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