Enemy Reload Animations play at the same time

Hello,

I’ve working on my AI animations currently in UE5. I’ve just set up my enemies weapon firing including delay between shots, etc.

I’ve put 3 enemies on my test map, all of which have different weapons attached.

My enemies shoot at me fine, until one of them runs out of ammo and triggers the reload blueprint.

In my AnimBP I have it move over to the reload state once IsReloading inside my BP_EnemyBase is true. The problem I’m having is once 1 enemy starts reloading, they all start the reloading animation despite the other characters still having ammo in their guns.

I’ve tried child blueprints to the main one, and confirmed the Is Reloading variable is set to instance editable but I haven’t found a fix for 3 hours now. I’m not sure what setting or box I need to tick in order to have each animBP be unique to each enemy.

Let me know your thoughts.

Thanks in advance


Hey,

I really don’t ‘know’ the answer to this, but I’ll give you a guess to see if it helps…

The top right of your blueprint shows reloading and sets it to truem but further off the screen there is more blueprint that seems to be using the Enemy Weapon as a target. Are all the relevant variables set to instance editable, or is the target of the instance reload effecting all weapons because they are not instance editable?

Hi Matthew,

Thanks for the reply, The Reload Bool is inside the Enemy Blueprint, all my weapons don’t have a variable for reloading… hmm Perhaps that could be the problem?

My reload bool for my player is in my player blueprint So I put it into my Enemy thinking I’d have the same result

I think it might be. The reload should probably be in the weapon, not the enemy, which would account for all enemies reloading at once. Maybe it could be done either way, but there is a vague answer here: Reload System that is probably worth trying to follow.

Matthew

Hey,

If you work with Blueprint Child for Enemies I think you don’t need put the “IsReloading” Variable as public, because the Child can acess the variable, because he have a Base Blueprint for that. I don’t know if this tip is work for you. Also make sure that Variable “IsReloading” is not set to true on each enemy added to the scene.

I’m not expert in Blueprint, but i try to help, check if this things works in yout project :slightly_smiling_face: :wink:

1 Like

That should be fine - each enemy is an “Instance” of that blueprint, so each will have their own version of “isReloading”.

What are the conditions in the circled two items in the AnimGraph?

image

I don’t want to mess with the reload too much as it is working for my player. my player has the reload bool inside the player character

Those are just enter; isReloading, and exit; IsReloadingNOT.

I’ve linked up that value from my Enemy’s Is Reloading in the event graph shown below

It doesn’t show here but, I used a “getActorofClass” node to get my BP_EnemyBase and promoted it to a variable to get EnemyRef.

What if you try “TryGetPawnOwner” and cast that to your enemy instead of using the “Enemy Ref” variable (just in the Eventgraph there)?

1 Like

YEPP, that fixed it.

I always used Get actor of class because i never really knew what to plug into the Cast to BPenemy’s object pin. This makes sense now. Thanks

1 Like