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"

My main character has a collision box in front of it and I want it to damage the enemy AI when the AI is in the boxes volume and the player presses the attack button (Melee, not a projectile)

My main character has a collision box in front of it (box moves with character), I want it to damage the enemy AI, when the AI is in the boxes volume and the playable character presses a delegated button, (Melee attack, not a projectile) I have the apply damage node completed too

Anyone know how to set damage to an AI, when (in the collision box and button is pressed)

Thank you

Product Version: UE 4.21
Tags:
more ▼

asked Nov 19 '18 at 07:03 AM in Blueprint Scripting

avatar image

Mitraton
1 1 1

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

3 answers: sort voted first

This is my blueprint so far if you care to elaborate on it, (Ignore the print string, thats for testing)

AI is the AIs health and destruction when health is lower than 1,

Player is where Im having the collision problem,

I only want the player to attack the AI when both; AI is in the collision box and the player pressed the buttonalt text

ai.jpg (115.9 kB)
player.jpg (135.0 kB)
more ▼

answered Nov 19 '18 at 07:52 AM

avatar image

Mitraton
1 1 1

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

Hi, I suppose you could create a boolean variable in your character, something like "bIsAttacking" that you would set to true on key pressed and false on key released. Then on overlap, check if the boolean is true, if it is, apply damage, if not, do nothing.

more ▼

answered Nov 19 '18 at 02:02 PM

avatar image

ZazarLaLiche
213 2 3 5

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

to create the setup you describe you just need to think out the steps logically. you want the attack to be initiated from a attack input so you make that the event. then you want to get the actors that are overlapping your collision volume, so we get the collision volume then use the get overlapping actors node which returns all actors overlapping or you can set it to look for a specific class if you like. then we need to apply damage to each enemy so we use a for each loop which basically says for every enemy thats overlapping do the thing, in this case we want to apply damage so we use the node for that.

thats really it. pretty simple. this is of course for a aoe attack as it will hit every enemy in the volume.

alt text

capture.png (94.5 kB)
more ▼

answered Nov 19 '18 at 02:45 PM

avatar image

ThompsonN13
10.1k 33 9 23

(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