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"

How to stop the Move_To task from executing when the AI pawn is dead?

I am developing a zombie shooter game where waves of zombies run towards me in a closed environment. I am using the Behavior Tree to do this, with a vision check Service that results in either a Move_To task towards the player and if the zombie is in range to attack, then the attack task (custom task) is executed. When the zombie dies, a death animation plays followed by destroying that actor. The problem is, while the death animation is playing, the zombie is still moving towards me. I have even kept a check on the health of the zombie as a blackboard decorator for the Move_to node but it doesn't seem to work. What must I do so that the zombie stays stationary when the death animation is playing? In other words, I don't want the Move_To node to execute when the zombie is dying.

Product Version: UE 4.13
Tags:
more ▼

asked Jan 02 '17 at 06:39 AM in Blueprint Scripting

avatar image

sidwakesup
10 1 4 5

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

2 answers: sort voted first

You can use this to stop logic of your AI when you play animation:

https://docs.unrealengine.com/latest/INT/BlueprintAPI/AI/Logic/StopLogic/index.html

also you can change walking speed in movement component to 0 before playing dead animation :)

more ▼

answered Jan 03 '17 at 08:12 AM

avatar image

JaroMast
349 25 12 31

avatar image sidwakesup Jan 03 '17 at 11:21 AM

Of course! Why didn't I think of walk speed before. I tried setting up the stop logic node but I failed to do that. I didn't know how to give a brain component reference. And the documentation isn't that helpful either. Anyway I got it working by setting walk speed to 0. Thanks a lot!

avatar image Midsoft Inc. Apr 12 '17 at 07:50 PM

Yes, the thing is that even when you set the max walk speed to 0, the zombie won't move towards you, but it will rotate towards you and this is another problem. The Stop Logic node is useful, but if you set it up in a player controller (as you should do) and you have 2 actors in the map with the same AI controller and you kill one, the other one will "die" as well, so...

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

This seems to work well to halt the movement:

     UPawnMovementComponent* mc = this->GetMovementComponent();
     if (mc != nullptr)
         mc->Deactivate();

I assume there is an equivalent in Blueprints.

more ▼

answered Sep 13 '17 at 06:23 PM

avatar image

Greg G
1

(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