I'm having a problem where my AI's are always targeting the main player, even when there are additional combatants within the active player group. I'm using a grid battle system. I've got three battle AI's attached to the enemy combatants (detailed below.) I'm sure I've missed something but not sure what.

Find Target
- Clear found targets -> then a series of check grid distance nodes at 3/5/10/30/50/100 to find enemies, with success leading to Move Into Distance and failure leading to the next distance check (if all fail it leads to a None node)

Move Into Distance
- Check Grid Distance is Equal 1: success -> Rotate to target; fail -> Check Grid Distance is greater than 1: success -> grid move toward target (if reachable -> rotate to target); fail -> Rotate to target.

Attack Enemy
- Grid Rotate to target -> Check Grid Distance is equal 1: success -> chance fork to determine which sword swing attack to use; else fail in grid distance check -> use all-out-defense ability.
  • Are other targets closer to them, or is the player just the closest target?
    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!
  • Other targets are closer to them. I've got 2 combatants in the active group. Currently they go first. I have one of them (the non-player) move up to moderately close to the enemies and then the other (the player) flee as far as the map allows. The enemies run towards the player. If they end their turn next to the non-player they'll attack them normally before reorienting at the end of their turn towards the player and continuing towards them the following turn.
  • Hm, which battle system type are you using? E.g. using turn based in Classic mode will have the combatants selecting their actions before the movement, so moving one closer doesn't influence it for that turn.

    How's your Check Grid Distance node set up?
    Also, if it's just about finding the nearest enemy, you can use a Get Nearest node instead.
    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!
  • battle system type is Turn based in Multi-turns mode.

    I missed the Get Nearest node! Thanks. That was what I was looking for. =) They are still prioritizing the player over anyone else. Get Nearest is currently set up:

    Found targets -> enabled
    Target -> enemy
    exclude found targets disabled
    ignore height distance disabled
    ignore radius disabled
    nearest offset index 0
    use grid distance enabled
    block diagonal distance 1 disabled
    ignore size cells enabled
    Inverse order disabled
  • Just tested it to make sure, but it's working fine here ...

    Do you have any other grid-move battle AI set up that could be used before this?
    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!
  • No. Just those three battle AI's. they're in that order:
    Battle AI 0: Find Target
    Battle AI 1: Move Into Distance
    Battle AI 2: Attack Target

    Under AI settings, AI controlled is checked. Target Selection Settings has Nearest Target checked, aggression type is always... that's basically it. It doesn't have any move AI's enabled.
  • Wait! I figured it out and fixed it: the distance checks in Move Into Distance were set to clear found targets, so they were ignoring the Find Target battle AI's results. Swapped them to "Keep Found Targets" and enabled "Don't add targets" and now the AI's are attacking the nearest target as I wanted. =)
  • Ah, yeah ... if you clear the targets they're gone :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.