StartStopAbility

Hamesh

Member
I am trying to understand how the StartStopAbility works for a UCC AI agent. In the tutorial video it mentions that an AI agent is able to use any UCC ability, so I trying to work out how to do this exactly for some of the more complex abilities. For example if an agent is pursuing the player how can I make the agent start to swim when it is in water instead of continuing to run? Do I need to create a seperate script to handle this or is there a more straight forward way? Similarly if the player decides to climb up to get away from the agent, how can I allow the agent to climb after the player using the same ability?
 
In both of those cases you should have the corresponding abilities start type set to automatic so it'll start when there is an object nearby that allows for that type of interaction. This would not be within the behavior tree at all.

Beyond that you can use the parallel task to run multiple branches at once which would allow you to check to run the start stop ability based on other conditions.
 
Hi Justin, I am trying to setup a Vault Object in the UCC/BD integration scene. I have added the Vault Ability to Agent Nolan and set the start type to automatic. I unchecked static on the Vault Object since otherwise when baking the nav mesh it created an un-walkable area around it. Unfortunately though Agent Nolan is simply walking up to the Vault Object and continuing to walk infront of it, instead of vaulting over. I have used the Vault prefab from the Agility demo folder, not changed in any way.

1580904442087.png

How do I get Agent Nolan to Vault?
 

Attachments

  • 1580904152747.png
    1580904152747.png
    51.4 KB · Views: 2
The best way will be to use an off mesh link and start the vault ability, similar to how the jump ability starts. You'll want to subclass NavMeshAgentMovement and add this new subclassed ability with the vault code - located within UpdateOffMeshLink.
 
Oh ok, I didn't realize hand coding would be needed to make the integration work. Won't using an offmesh link make the ability work differently to how it works for the player? Also will the swimming ability also need some coding for it to work for an agent?
 
Won't using an offmesh link make the ability work differently to how it works for the player?
No - the offmesh link would just say that the ability needs to start, it doesn't change the way the ability acts.

Also will the swimming ability also need some coding for it to work for an agent?
If you're only doing surface swimming then you could bake the navmesh on top of the water and then start the swim ability when the character enters the water, but underwater swimming involves 3D pathfinding which is computationally expensive. There are one or two 3D pathfinding solutions on the store but I haven't tried them yet so they aren't integrated with the controller.
 
For the OffMeshLinks, I am trying to determine how I will differentiate between if it is a jump or vault OffMeshLink? I noticed you are checking against LinkTypeJumpAcross for the jump functionality but I couldn't find where this is defined in NavMeshAgentMovement.

Surface swimming is all that I need, but I am thinking that if there isn't a slope leading out of the water then the agent will need to use the Climb From Water ability? If so I am guessing this will also need an offmeshlink setup?
 
For the OffMeshLinks, I am trying to determine how I will differentiate between if it is a jump or vault OffMeshLink? I noticed you are checking against LinkTypeJumpAcross for the jump functionality but I couldn't find where this is defined in NavMeshAgentMovement.
I believe the off mesh link has a custom setting and then you can determine the type by name.

If so I am guessing this will also need an offmeshlink setup?
Yes, that sounds correct.
 
Sorry I cannot find this custom setting on the off mesh link, can you point me where I need to look. Is there an example off mesh link included that I can view?
 
Top