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"

AI melee combat?

Hello friends! I'm working on a third person game and I need AI melee combat. I'm currently following these tutorials and have made it to part 7, everything is working fine but now I need to implement melee combat instead of ranged shooter combat, and since I'm a complete noob, I don't know how to proceed. I've managed to make it so that my line trace for the attack is much shorter, and so that my enemy only does damage when in line trace range. I've tried to make it so that the line trace doesn't do damage, but instead casts to my AIs blueprint and fire an event to do damage, but that hasn't worked. So, long story short, my basic questions are 1) how do I apply an attack event to do damage? 2) How do I apply my attack animation? 3) Can I get my AI to stand still and do the event/animation, and when that's done, continue to follow the player?

Sorry if this is badly phrased, I'm literally just learning scripting all in all and have never written a line of code in my life, so all of the terms are still a little fuzzy to me.

Product Version: UE 4.10
Tags:
more ▼

asked Apr 17 '16 at 03:53 PM in Blueprint Scripting

avatar image

norabrora
31 10 8 14

avatar image norabrora Apr 18 '16 at 03:19 PM

Okay, so, I got the animation running, but just once. I think this is because I'm only setting my boolean that I use in the AIs anim bp to true, and never reset it after the event/damage has executed.

I tried doing this through my behaviour tree attack task by simply setting the boolean to false once the event fired, but then it didn't play the animation at all. I tried putting in a sequence before casting to the AIs bp and firing the event, so that I first cast the event and then set the boolean to false, but had the same problem with the animation not firing at all. Lastly, I tried to set the boolean to false through the BTT again. I put the boolean right after the event (cast from AIs bp). But instead of using the 'as Enemy AI' output from the cast node, I tried making a variable reference to the AI. But the weird part is that when I tried to set that up in my behaviour tree (in the attack task, set the enemy to that blueprint) nothing happened, even though it looks like I should be able to specify it. Somebody knows what I'm doing wrong? I've included screenshots where you can see my variable inside the attack task event graph, and then in my behaviour tree where I'm supposed to be able to specify the blueprint (the dropdown shows the blueprint I want to target=, but when I click it, nothing happens ('spider' is still just set to 'none').

alt text

![alt text][3]

alt text

bttattack.png (124.8 kB)
attacktask.png (22.6 kB)
whyyyy.png (26.3 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I figured it out! Instead of trying to uncheck the boolean in the BTT I unchecked it in the anim BP and now the animation runs just as it should.

more ▼

answered Apr 18 '16 at 05:12 PM

avatar image

norabrora
31 10 8 14

(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