I am trying to get 2 AIs to fight each other in a real time battle.
The AIs are basically identical for everything other than the faction:
* they are both using the same Battle AI for attacking (which works against the Player).
* they are both using the same Hunt Move AIs (which works against the Player).
* they belong to 2 separate Factions (one AI is an Ally to the Player, the other AI is Enemy to the Player) with a -1000 Sympathy to each other.
* they both use an Attack Ability with a Target Type = All and target Range= single.

Yet when they are close enough they move toward each other as far as they can but they don't attack each other.
If the Player gets close, the Enemy AI hunts the Player and attacks it. In the meantime the Ally follows the Enemy without doing anything.
These are the Battle Info when they are facing and doing nothing...
Ally
image
Enemy
image
  • Are you using a Real Time Battle Area, i.e. there is an ongoing real time battle in your scene?

    If not and you're using Battle components (or auto start battle when enemies get close to the player), the AI combatans can't start a battle with each other, only an enemy coming close to the player.
    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 30
    I was using Battle components and a Real Time Battle System only.
    As soon as I removed the components and added a Real Time Battle Area instead, they started beating the crap out of each other :)
    Thank you so much for the help!
    Post edited by ChimpLogik on
  • Looks like the problem of AI vs AI/player is happening again, this time though I am using a Real Time Battle Area.

    My AIs attacks were working, but I haven't tested this in few weeks so it's possible I have inadvertently changed something. During this time I also upgraded to Unity 2021.3.3 and latest release of ORK3.
    Now my AIs are moving to the right distance to the target (player or other AI) but then nothing is happening. I've been debugging this for a while but unsuccessfully :( .

    This is the attacker Battle Information and MoveAI Component.

    imageimage
  • Hm, first things to check are your different range settings, e.g. battle range, AI range, etc. (in Battles > Battle Settings, as well as the individual battle system's move AI range).

    Next would be the use ranges for the abilities and items - in real time battles they're usually limited, so make sure that's correct.

    Also, since you're using real time battle areas, make sure your default battle system (or the combatant spawner overrides) is the same battle system as your real time battle area's system. Otherwise, e.g. if that's turn based, the combatants will not take part in real time battles.
    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 June 21
    I checked and my default Battle system = Real Time and matches the real time battle area's system.
    This is what I have for the rest.
    Battles > Battle Settings > Battle Range = 30

    For the attack ability Target Selection Setting > Use Range Setting > Range 0
    Range Type = Template
    Template = Melee

    This is the Melee Range template to get the 2 combatants in close enough contact, and adds the Radius Components of User and Target (this is my I sent Ignore Radius = true in the Template).

    imageimage

    And this is the formula for the range,

    imageimage
    Post edited by ChimpLogik on
  • The formula is basically recreating a use range of 0 without Ignore Radius enabled - or rather of -0.1 due to that initial value.
    That will most likely lead to never being within use range, depending on the combatant's radius, colliders and movement.
    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 June 22
    If Ignore Radius is disabled, does that account for both the User and Target's radiuses?

    I tried setting the melee template this way, but now the attacks happen only before the AI gets on contact with the target (player), no matter the distance from the target.

    The attacks though stop as soon as the AI is in contact, which is not at all what I would have expected :(

    imageimage
    Post edited by ChimpLogik on
  • Ignoring the radius means that the user and target radius is not taken into account. I.e. the range begins directly at the user's position and a target would be in range if it's position is within the range.

    When radius isn't ignored, the range begins at the user's radius edge and (at least) the target's radius edge needs to be in range. I.e. the range is extended by the user and target radius.

    You should use a Maximum Range to limit the use range. The minimum range means that they need to be at least that far away.
    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!
  • Oh I see!! I definitely misinterpreted the purpose of the threshold, I though that was setting the upper an lower limit. My bad ._.'

    That brings another question. Is it possible to have custom ranges in the equipment overriding the ability values?
  • ChimpLogik said: That brings another question. Is it possible to have custom ranges in the equipment overriding the ability values?
    Hm, not directly.

    There are 2 ways to do it:

    1) Use conditional use/affect ranges in your abilities or items.
    E.g. checking if an equipment (or item type) is equipped to use a different range.

    2) You'd need to set up a system that takes equipment into account when determining the ranges.
    I.e. using formulas to calculate the range and having equipment (e.g. via status value bonuses or equipment variables) have an impact on that range calculation.
    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!
  • Thanks for the tip, I'll try door number 2 :)
Sign In or Register to comment.