UCC AI isn't attacking with weapon

appminis

Member
I think right now the most confusing thing getting AI to Use a weapon.

My behavior tree is indicating success in Seeing the Player, Aiming at the Player, and Start Stop Use Attack:
https://gyazo.com/aa80919bb80dfbe5cd1e6d4baaa3767d

But the enemy just stands there (rotates slightly towards player).

He never uses his bow.

Here are the BD settings:

9123c84c44639ecbbde9f75eca4750ea.png

770f9cd6d41e1ac17dfb7319e58fcd0b.png

51f92ba2858c9c00f185066aaa733107.png


And the Item/Inventory setup on the AI:
25f1309b4fcc8ecf40241bc8441b5e1b.png


AI Abilities:
25d99a7a452b128e8a34b36f7270e067.png
 

Justin

Administrator
Staff member
What Fire Type are you using for the bow? Instead of using Charge and Hold like in the bow setup video try using a type of Charge and Fire. This should prevent the stop ability from needing to be called.
 

appminis

Member
Unfortunately that didn't help.
Is there a way to verify that an AI/NPC has a weapon equipped/properly?

I tried to follow most of what is in the BD Integration demo for UCC, but I must be missing something.
 

appminis

Member
Actually, I see that the "Aim" ability is active:
2c4e5efd5b67566b059d6e4dd8c59a04.png


But as you can see, the "Use" ability doesn't say Active.

In Behavior Designer, it does show the Use action in the affirmative:

6ea3b817554b0b555b826bfde52968be.png
 

Justin

Administrator
Staff member
I am creating a sample scene that'll have the bow firing. I am attempting to do it by having the agent use the bow's runtime pickup and that is exposing some issues so it looks like it'll require an update to get this scene completely working.
 

appminis

Member
I am creating a sample scene that'll have the bow firing. I am attempting to do it by having the agent use the bow's runtime pickup and that is exposing some issues so it looks like it'll require an update to get this scene completely working.

That would be great, thanks Justin -
Would be ideal to have the option to have the bow equiped by default as well, to make sure the issue doesn't lay in missing a step for items equipped my the AI's default loadout.

Thx!
 

appminis

Member
One error that does keep cropping up is this:

EventHandler.GetActionList error: target object cannot be null.
UnityEngine.Debug:LogError(Object)
Opsive.UltimateCharacterController.Events.EventHandler:GetActionList(Object, String) (at Assets/Opsive/UltimateCharacterController/Scripts/Events/EventHandler.cs:152)
Opsive.UltimateCharacterController.Events.EventHandler:UnregisterEvent(Object, String, Action`1) (at Assets/Opsive/UltimateCharacterController/Scripts/Events/EventHandler.cs:613)
Opsive.UltimateCharacterController.FirstPersonController.Items.FirstPersonPerspectiveItem:OnDestroy() (at Assets/Opsive/UltimateCharacterController/FirstPersonController/Scripts/Items/FirstPersonPerspectiveItem.cs:925)

It happens after I exit play mode. Can't pinpoint the source.
 

Justin

Administrator
Staff member
I think that I have that one fixed, along with the bow with AI. The bow with AI required a decent amount of changes so it'll be in the next version.
 

appminis

Member
So I wasn't just an idiot? Good to know! :)

Any idea when the next version will be available? I'm actually developing this next game from scratch using UCC (fulltime developer), so it would be great to be part of a Beta group or some way to get the absolute latest versions.

Might be worth setting up a Discord? Being just released, I imagine there will be lots of bugs so could be helpful to get those reports asap from those of us that are using this extensively from day one.
 
Last edited:

appminis

Member
Just checking in on this - I'm sure you're swamped since release. Its just a bit of a roadblock for me at the moment. Thanks!
 

appminis

Member
Is there any particular change I need to make this work now with the latest version? I see now that "Use" is Active, but he still won't fire. Perhaps something specific with the bow setting? Thanks!
 

Justin

Administrator
Staff member
Did you also update the Behavior Designer tasks? The only setting that you should need to change is changing the fire type to charge and fire. In the BD demo scene AgentNolan now has an arrow attachment location that you can use.
 

appminis

Member
Oh, I didn't see any update for Behavior Designer. I bought that on the Asset Store, and UCC on Opsive - is that Task update for BD pending Asset Store approval?
 
LocalLookSource fires from the feet =/ unless you're setting the position to where the camera should be in code. Or there's some other integration class that's included.

Add tracers. Different issue it seems, but should help in the future.
 

Vahalla

Member
I am having this issue as well I made it work months back I forgot what I had to do to make them attack, was there any solution to how to make the ai choose the equipment that is equipped, i have one with a sword, one with a fireball, both do not attack, the sword is visible
 

Justin

Administrator
Staff member
If they are running around you in circles you should check the stopping distance on the NavMeshAgent. If that is set to being large enough look at the behavior tree and see what task is currently active. From there you should have a better idea of what is wrong.
 
Top