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"

AnimMontage doesn't play in custom behavior tree task

I have an attack task that has my AI move to the player's location and plays an AnimMontage for its melee attack. All my code works, but the animation doesn't play. I borrowed some of the code from the PlayAnimation task, which works too. I feel like it might be something I did, but I can't figure out what causing the bug. I'm using the launcher version of 4.7.2. Here's the source code of my class: http://pastebin.com/r28M0Upa

Product Version: Not Selected
Tags:
more ▼

asked Mar 16 '15 at 10:25 PM in C++ Programming

avatar image

vibgyorc6
75 12 19 25

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

1 answer: sort voted first

The crucial bit you've missed from BTTask_PlayAnimation is this:

 // instantiating to be able to use Timers
 bCreateNodeInstance = true;

This is required to have timers notify the right BT node - otherwise your node class instance is a "skeleton" that's being used for all AI using particular BT.

One thing I've noticed while looking through your code: your node will never do a move and play the animation in sequence and it wouldn't be easy to make it that way. I suggest you used the BT structure for this kind of sequencing - combined with decorator conditions it's perfect for the task!

Cheers,

--mieszko

more ▼

answered Mar 17 '15 at 09:16 AM

avatar image

MieszkoZ STAFF
7.3k 225 57 413

avatar image vibgyorc6 Mar 18 '15 at 04:01 AM

Thanks for the help! Unfortunately the animation still doesn't play in my custom task, but I'm not using it anymor, as I realized after I posted this question that I shouldn't have combined MoveTo and PlayAnimation into the same node. That was kinda silly of me. :P I'm now using the built-in MoveTo and PlayAnimation tasks with a custom decorator that checks if my enemy is in melee range. Unfortunately, I've run into another problem. After my character finishes the animation (which works in the built-in task), it defaults back to the T-pose. I'm assuming that's a bug with the task itself. And whether or not it's the engine or just something I did, how might I fix it/workaround it?

avatar image mirsabayu Mar 18 '15 at 06:20 AM

maybe it because when you use the build in play Animation it make the actor to switch the animation mode to not use the animation blueprint. it's a bug, and miezko already recognize it (if what i think of your problem is not wrong). maybe you can fix it yourself. just make a custom playAnimation.(with code that entirely same with the playAnimation task, but on the end of the animation, just call [your USkeletalMesh variable]->SetAnimationMode(EAnimationMode::AnimationBlueprint);

because in the playAnimation task you can see that it use the playAnimation funciton on USkeletalMesh Class, and in that funcition it would set the animation mode to EAnimationMode::AnimationSingleNode. which is would alter the animation settings.

or you can use the AnimationMontage to play. for me, i still use the last one (not upgraded to the 4.7 yet, coz still trying things in the new build).

jejeje. cheers

avatar image MieszkoZ STAFF Mar 18 '15 at 03:57 PM

For reference, this has been fixed on the master branch.

--mieszko

(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