edited March 2022 in ORK Support
My enemy AI is having a strange behavior.
Its MoveAI is set to Hunt but does not seem to ever detect my player as a target, yet if I get within attack range with my player, the enemy starts attacking it through its BattleAI. While this happens, the MoveAI still doesn't find any target..
And as soon as I get out of attack range, the MoveAI ignores my player again (and goes back to the scene origin 0,0,0)
image
The BattleAI does not clear the target and consists only of one node.
image
And the MoveAI detection should see my player Combatant...
image
I've been spending the better part of the day trying different combinations but without any success. Any idea what could cause this?
Post edited by ChimpLogik on
  • Try disabling the Use Raycast option in the move detection - if it's working with it turned off, the raycast setup is your issue.

    Since you don't use a child object or offset on the user's side for the raycast, I suspect the raycast is simply blocked by the ground.
    I'd recommend to use an offset on both user and target and also limit the layer mask to layers that should block the sight, e.g. ground and level architecture stuff.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited March 2022
    I've tried both disabling the Raycast and keeping it with an offset on both user and target but the issue is still there. I also tried excluding the ground Layer just in case but it didn't change the outcome :(

    Not sure if it is relevant, but my Attack Ability has 2 battle animations: Move To Target + Attack and I noticed an odd behavior when I change the Move To Target schematic:

    1) If I use a Change Position node the AI goes to the "Starting Object" and eventually goes back to 0,0,0 with no Target detected by the Move AI Component.
    image

    2) If I use my custom Movement Component schematic, the AI always detect a Distance to the "Starting Object"<1 (no matter the actual distance) so it always skips the <i>Move To Target battle animation and goes straight to the Attack one.
    Eventually it also goes back to 0,0,0 with no Target detected by the Move AI Component.
    image
    Post edited by ChimpLogik on
  • Is your combatant prefab set up in a way that the root isn't the moving game object?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited March 2022
    No, the combatant game object and the root move together.

    Since the player gets attacked by the AI, I tried adding this component to the AI game object in case I could catch the Ability target(s) but targets is always empty :O

    public class ORKCombatantTarget : MonoBehaviour
    {
    public bool checkTargets = true;
    public List<GameObject> targets = new List<GameObject>();

    void Update()
    {
    if(checkTargets)
    {
    targets.Clear();
    GetThisCombatantTarget(this.gameObject);
    }
    }

    public void GetCombatantTarget(GameObject combatantObject)
    {
    if (ORKComponentHelper.GetCombatant(combatantObject) != null)
    {
    Combatant combatant = ORKComponentHelper.GetCombatant(combatantObject);
    for (int i = 0; i < combatant.SelectedTargets.Count; i++)
    targets.Add(combatant.SelectedTargets[i].GameObject);
    }
    }
    }

    I'm not quite sure where to look now...
    Post edited by ChimpLogik on
  • That code tries to get the individual target selections (see Battles > Target Settings).
    You can access the current action of a combatant (while it's being performed) via:
    combatant.Actions.Current
    This gives you access to targets of the action.

    As for the distance - how's the radius setup of your combatants?
    Also, I assume this is in real time battles, is there any timeout between the enemy's action selection, e.g. via the AI decision time or the combatant's real time AI timeout?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited March 2022
    I used combatant.Actions.Current and when my AI combatant attacks, it now shows the right target :)

    While going though the battle system options, I found the cause of the Hunt MoveAI not working.
    In Battles> Battle System >Real Time >AI Settings > Move AI Settings, the checkbox Allow Move AI was not checked. As soon as I checked it, it started working!
    Thank you for pointing me in the right direction, it really helped :)
    Post edited by ChimpLogik on
  • Ah ... yeah, now that you mention it, your screenshot from the move AI's component even states it as Can Use: false :D
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.