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"

Simple Collision Question

I have a simple collision question. I have an actor with a sword (player). I have an enemy. If I want the enemy to take damage when the sword hits them? How would I do that? alt text I am in the enemy event graph. I think i have it done mostly correct except for one issue. If the boolean "is attacking" turns true during the overlap, it wont process. How do I get the overlap to only fire when the boolean is true?

JapanMan = Player

Product Version: UE 4.18
screenshot-302.png (117.6 kB)
more ▼

asked Oct 30 '18 at 07:29 PM in Blueprint Scripting

avatar image

11 3 7

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

1 answer: sort voted first

I would have the overlap event on the sword. Then you just need on overlap apply damage to the other actor pin. Ill try to elaborate more later at work now though

more ▼

answered Oct 30 '18 at 07:57 PM

avatar image

10.1k 33 10 25

avatar image xGameSlave Oct 30 '18 at 09:01 PM

I just want to point out that it has to be a specific component on each. idk if that matters. Thank you!

avatar image ThompsonN13 Oct 30 '18 at 10:09 PM

why would you need a specific component on each? that just seems like it would limit your functionality. as long as your hitting the enemy it shouldnt really matter but if thats what your looking to do then you would be best to better describe what your looking to do. it looks like you want the sword to only interact with a hitbox, usually you would just use the characters collision or the mesh.

anyways below is an example of what your attempting to do. when the weapon overlaps with something you check if the player is attacking, if yes then you see if the overlap was an enemy, if it is an enemy then you get their hit box and make sure the component the weapon hit was the hitbox, if thats true then you finally apply damage.

personally i find it a bit restrictive but thats just me. it also really depends on your game i suppose.

alt text

capture.png (134.0 kB)
avatar image xGameSlave Oct 30 '18 at 10:33 PM

The reason i need that is because there are other collision boxes the player cant see in game that activate different things in the actor, a simple overlap would mean the player could hit the enemy from very far away. I see what you did, you have the branch check FIRST that the player is attacking. Interesting.

avatar image ThompsonN13 Oct 30 '18 at 10:50 PM

the isAttacking check is just so the overlap cant occur when the player is just walking around. you could also disable collision on the sword when not attacking which would accomplish the same thing. i actually had a melee system before that worked on line traces and used anim notifies to determine when to begin tracing the weapons path, the result being it could only apply damage when it was in the powerstroke of the swing.

(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