Download

Setting up a Behavior Task to listen to a montage?

Hey all. I have an enemy NPC using a behavior tree with tasks to find cover, target the player, and begin shooting at the player once they are in cover
In my AnimBP I have a montage that begins to play once the enemy is in cover. This montage has a few sections that do the following- Cover Idle, Take Aim, Shoot…etc.

The issue I am having is that the enemy begins to immediately shoot when they enter the cover which is set from a Blackboard key bool and fires the weapon effects. The montage anims for the enemy to crouch and take aim take a few seconds. Is there a way to constantly check a montages section and only once it hits Shoot- then I can fire the “shoot at player” behavior task?

Things I have tried/am familiar with:

  • Casting from AnimBP or EnemyBP to an event in Blackboard task (apparently this is impossible?)
  • Using a ‘Montage Get Current Section’ in the blackboard task + animbp event graph. Since the firing is set to begin as the enemy is in cover- it only returns the beginning section of the montage
    ^ maybe someone can show me how to set this (or something else) up properly to listen for a specific section in the montage before executing
    -Using anim notifies in the animbp

It keeps coming back around to - I need the BB task to wait for my montage to reach a certain point and then fire the shoot event to the weapon

TLDR;

How would I setup a new bb task to listen to the montage being played? or the proper way to get a Behavior task to listen to a montage.
Maybe I shouldn’t be using a task to shoot at the player at all?

Any help is appreciated! I can add screenshots if needed. Thanks!!