AI Cover

GuyManDude

New member
Hi guys, sorry if I didn't found the answer in the forums, but I am following the guide to setup the covers for AI and in the documentation states to enable "PredeterminedMoveTowardsLocation" in the cover abilities, I am not seing this option can some one point me out the location?

I dont know what else I am doing wrong but even if the probability of cover is changed to 1 the start cover action allways come as faliure

thanks for the help
 

Attachments

  • cover.png
    cover.png
    49.3 KB · Views: 14
  • covertree.png
    covertree.png
    32.5 KB · Views: 13
  • coverpoint.png
    coverpoint.png
    178.1 KB · Views: 13
PredeterminedMoveTowardsLocation is a property on the Cover ability. You can use the StartCover task to set the location within Behavior Designer.
 
ok so if I am undertanding the "PredeterminedMoveTowardsLocation" is already setup by the "StartCover", if that is so I am not understanding what I am doing wrong, I think the cover point is setup correctly, but when the "StartCover" in the tree starts it always return failure
 
If you place a breakpoint within the StartCover task and step into the TryStartAbility method you should have a better idea of what is causing it to return failure. With that said, you have a start type of Button Down which for an AI agent will never be the case. The start and stop type should be manual.
 
ok so far, I isolated on the the AI in the scene without the player, I isolated only the cover ability, the stop/start type is defined as manual.

made some debug prints
in the "TryStartAbility" method I printing the "ability.CanStartAbility()" bool before the "if ((!ability.IsActive || ability.CanReceiveMultipleStarts) && ability.Enabled && (ignoreCanStartCheck || ability.CanStartAbility())) " check

the "ability.CanStartAbility()" returns false.

ok so I go into the can start Ability and check which condition is returing false

the "CanStartAbilityInternal()" is returns true always
 

Attachments

  • bools.png
    bools.png
    34.5 KB · Views: 3
  • check1.png
    check1.png
    64.2 KB · Views: 3
  • check2.png
    check2.png
    51 KB · Views: 3
If the internal method returns true then it looks like something within the cover ability is returning false. Have you tried debugging there?
 
hey man super thanks for you help, but I am not understanding were you are asking me to debbug, sorry I am a bit slow; I set up a breakpoint in the tree "start cover" and it does find a cover spot but then after the breakpoint is removed the cover spot goes to null

 

Attachments

  • breakpoint1.png
    breakpoint1.png
    33.8 KB · Views: 4
  • breakpoint 2.png
    breakpoint 2.png
    23.9 KB · Views: 4
Instead of a behavior tree breakpoint you should use a C# breakpoint. You can then step into the Cover.CanStartAbility method and determine exactly what is returning false.
 
I am having the same issue. CharacterLocomotion.SingleCast() returns false in DetectObjectAbilityBase. Btw the detection mode is Charactercast
1691515163871.png

And here is a screenshot from character locomotion script. The Physics.CapsuleCast returns false
1691515419629.png
 
Last edited:
Also here is the cover point itself and the character is spawned near it
1691517870573.png


Also VERY rarely I get a log in my console saying "Unable to find cover"
1691518156181.png
 

Attachments

  • 1691518128770.png
    1691518128770.png
    187.5 KB · Views: 1
It looks like the cast is missing the cover object. You could add a Debug.DrawRay just before the capsule cast to visualize where the cast is going. If it looks correct then it's likely a LayerMask issue.
 
It looks like the cast is missing the cover object. You could add a Debug.DrawRay just before the capsule cast to visualize where the cast is going. If it looks correct then it's likely a LayerMask issue.
well here are the debug rays it draws
1691573186282.png1691573270784.png
 
sorry for the long wait, did breakpoints in the CanStartAbilityInternal() and it allways return true, trying to do a breakpoint in the "
if ((!ability.IsActive || ability.CanReceiveMultipleStarts) && ability.Enabled && (ignoreCanStartCheck || ability.CanStartAbility()))" in the ultimate charater controller the breakpoint is not giving me the result of the CanStartAbility, dont know what I am doing wrong, would apreciate more info
 
well here are the debug rays it draws
You should look at it when you're near a cover point. What you want to do is have the capsule cast return a value, so it's modifying the ray origin/direction or the layer mask.

sorry for the long wait, did breakpoints in the CanStartAbilityInternal() and it allways return true, trying to do a breakpoint in the "
if ((!ability.IsActive || ability.CanReceiveMultipleStarts) && ability.Enabled && (ignoreCanStartCheck || ability.CanStartAbility()))" in the ultimate charater controller the breakpoint is not giving me the result of the CanStartAbility, dont know what I am doing wrong, would apreciate more info
Instead of CanStartAbilityInternal what about CanStartAbility? You can step into that method to determine what is returning false.
 
You should look at it when you're near a cover point. What you want to do is have the capsule cast return a value, so it's modifying the ray origin/direction or the layer mask.
okay do the rays look correct now?
1691671810794.png
I have a few questions actually:
1. Am I understanding correctly that in order for agent to take cover it must be looking at one when the StartCover node is activating?
2. Does the coverPoint collider have to be a trigger or jus regular collider?
3. Does the coverPoint collider height affect anything?
4. If there is only one valid cover point on the map and the agent behavior tree Cover node probability is set to 1, should the agent run to the checkpoint or are there any other conditions?
 
Where is the cover point? I don't see anywhere in that screenshot where it looks like the character should take cover.

1. Yes
2. The cover point should be a trigger.
3. No
4. You mean cover point instead of checkpoint, correct? The character will only move to the cover point if that cover point is determined to be valid.
 
That would cause it. In your screenshot you can see the blue line being drawn but the character isn't near a cover point.

There isn't a way to bypass that condition without coding changes. Take a look at Cover.StartAbility - it doesn't a cast and if there's no cover object found then it doesn't start. You will probably want to remove that.
 
Top