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"

Trigger box breaks on AI entry

Hey, I have a simple trigger box that takes damage when the player is overlapping it, the blueprint logic is below for reference: alt text

Everything works fine until something else (ie. AI) overlaps the trigger box, this breaks my code.

The collision settings for the trigger volume are below: alt text

Thanks in advance for any help.

Product Version: UE 4.21
Tags:
more ▼

asked Mar 25 '19 at 02:49 PM in Blueprint Scripting

avatar image

AnthonyRCP
6 1 1

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

2 answers: sort voted first

Found the fix. Made another cast inside the loop with a reference to the player character, all working now.

alt text

solution.png (294.5 kB)
more ▼

answered Mar 26 '19 at 04:17 PM

avatar image

AnthonyRCP
6 1 1

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

Not sure exactly what you mean by it "breaks", that could be many things some clarification would help. BUT from what I can see, you will certainly have a bug where if the player enters the trigger box and begins taking damage, if an AI enters then leaves the trigger box the player will stop taking damage even if he is still within the trigger volume. The reason for that is because you don't specify an actor for the "End Overlap" event. So any actor (even an AI actor for example) could cause the "End Overlap" event to trigger upon exiting the volume. Cast to your third person character for the end overlap like you did for begin overlap and it will resolve that issue. If you are having another issue please clarify because I don't know from the screen shots what exactly would be "breaking" other than what I mentioned above.

more ▼

answered Mar 25 '19 at 11:33 PM

avatar image

Nebula Games Inc
4.9k 27 9 14

avatar image AnthonyRCP Mar 26 '19 at 03:24 PM

I didn't see that issue, but l have added the cast to the end overlap too , thanks. My problem is when anything else enters the trigger volume while my character is already in there, by break l mean the code stops working. Nothing happens. The player doesn't take damage and l can't understand why.

The blueprint simulation continues repeating the code while the AI stays in the trigger volume as expected, but the player doesn't take damage and I've checked my "TakeDamage" function, works fine.

alt text

examplesim.png (493.9 kB)
(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