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)
asked Nov 19 '18 at 07:03 AM in Blueprint Scripting
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 button
answered Nov 19 '18 at 07:52 AM
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.
answered Nov 19 '18 at 02:02 PM
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.
answered Nov 19 '18 at 02:45 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here