Animation triggering and NPC Pickup

nathanj

Active member
Hi Justin,

Slowly getting used to the system. really enjoying it but I have some basic questions, I hope you don't mind.

I have an animation triggering from a behaviour tree where an NPC walks up to an item and picks it up off the ground. If the nodes go from Seek to Play the animation is skipped. However, if I add a Wait node in between them the animation is triggered. Likewise, I need to add another Wait node after the Play node (set to the length of the animation) before the rest of the behaviour is able to proceed. I did try using the Wait For State node and set it to Idle but this never worked.

Any idea why I need the Wait node before the Play node? And, I saw you had mentioned that you could wait for an animator event, would this entail sending a unity animation event to a custom UCC or BD event?

The second question is is it possible to simulate a button press for an NPC with UCC Locomotion component? When they play the custom pickup animation I would like to send a Button Down Start Type message to the NPC so they can pick up the item - rather than simply using an OnTriggerEnter.

I hope this isn't too vague,

Thanks in advance.
Nathan
 
I have an animation triggering from a behaviour tree where an NPC walks up to an item and picks it up off the ground. If the nodes go from Seek to Play the animation is skipped. However, if I add a Wait node in between them the animation is triggered. Likewise, I need to add another Wait node after the Play node (set to the length of the animation) before the rest of the behaviour is able to proceed. I did try using the Wait For State node and set it to Idle but this never worked.

Any idea why I need the Wait node before the Play node? And, I saw you had mentioned that you could wait for an animator event, would this entail sending a unity animation event to a custom UCC or BD event?
Is this a UCC AI agent? The Play node in this case shouldn't work at all - it is up to UCC to play the correct animations. Instead of using Play you should start an ability on the UCC character.

The second question is is it possible to simulate a button press for an NPC with UCC Locomotion component? When they play the custom pickup animation I would like to send a Button Down Start Type message to the NPC so they can pick up the item - rather than simply using an OnTriggerEnter.
Yes, if you set your ability to manual you can then use the Start/Stop Ability task.
 
Thanks Justin,

I'm still stuck on this. If I use the Start Stop Ability the item is destroyed/disabled but it's not being added to the players inventory and they are not triggering an animation.

If I used the OnTriggerEnter on the ItemPickup of the collectable item the animation is player and the item is added to their inventory.

I've tried all the different Object detection options but the NPC does not seem to send any data to the Pickup Item script unless OnTriggerEnter is used.

Is there anything I'm missing? - also, was just experimenting with the Ability Index Parameter here, it's normally set yo 11 - but this isn't making any difference.

Edit: After further looking I realised that the pickup animation is not playing but rather the equip item animation from the item abilities (i believe) is being triggered when the player collects the item.

So this solves the animation triggering. However, the issue remains that when the Pickup Item ability is started from Behaviour Designer, the item is destroyed but it's not added to the NPCs inventory. However, the item set is added to the Item Set Manager.

Thanks again, and apologies for the messyness of my thoughts...
Nathan

LocoPU.PNG
 
Last edited:
So this solves the animation triggering. However, the issue remains that when the Pickup Item ability is started from Behaviour Designer, the item is destroyed but it's not added to the NPCs inventory. However, the item set is added to the Item Set Manager.
From this standpoint the AI agent and a player-controlled character is the same so I would double check the items on this page:

 
I finally have most of it working, thanks for your patience and help. Once I understand it it's all very logical and obvious. I can be a bit slow getting to that point, though.

Ok, sorry, one more thing. When I use the Item Pickup the collected item is being destroyed as soon as the ability is initiated. Is there a way to defer the item being destoryed until the animated hand is extended all the way?

In the animation, there is an even OnAnimatorPickupItem that triggers DoItemPickup, and I would expect this to be where the item is destoyed, but it's not. Is there something I can do to delay the item being destroyed?

Hopefully once I get this I'll be more independant and can stop bothering you so frequently.

Again, thanks!
Nathan
 
Last edited:
I finally have most of it working, thanks for your patience and help. Once I understand it it's all very logical and obvious. I can be a bit slow getting to that point, though.
No worries - there's a lot included in UCC and then combine that with Behavior Designer there starts to really be a lot of new concepts.

Ok, sorry, one more thing. When I use the Item Pickup the collected item is being destroyed as soon as the ability is initiated. Is there a way to defer the item being destoryed until the animated hand is extended all the way?

In the animation, there is an even OnAnimatorPickupItem that triggers DoItemPickup, and I would expect this to be where the item is destoyed, but it's not. Is there something I can do to delay the item being destroyed?
Are you using the Pickup Item ability to pick up that item? On line 201 of ItemPickup.cs the object doesn't get destroyed until after DoItemPickup is called. If the Pickup Item ability isn't being used then it will be destroyed immediately.
 
Top