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
Enemy
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.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
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!
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.
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.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
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).
And this is the formula for the range,
That will most likely lead to never being within use range, depending on the combatant's radius, colliders and movement.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
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 :(
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.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
That brings another question. Is it possible to have custom ranges in the equipment overriding the ability values?
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.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!