The NPC Army component handles the offense and defense behavior and strategies of a NPC faction.
When setting up a map, make sure that each faction slot has a NPC Army component.
Army Unit Management:
- Faction ID: The faction ID that this component belongs to.
- Check Army Reload: The duration of a timer that allows the faction each time to gather units needed to form an army, create needed units for the faction army or place buildings that allow to create these units.
- Army Units: A list that defines how should the army of the faction be built. Each slot includes a “Prefabs” list which you need to fill based on priority. The “Amount Per Hundred” defines the amount of units from this slot to create from the total army units.
- Default Attack Range: This is the “Attack Range” in the “Attack.cs” component for the army units when the faction is not attacking or defending.
- Non Attack Units Ratio: This defense how many units that don’t have the Attack component this faction will have in relation to the total amount of units (between 0 and 1). This allows to limit the amount of civilians that the faction creates.
- Max Non Attack Units: Maximum amount of civilian units that can not be surpassed even if the above value hasn’t been reached.
- Can Attack: If true, this faction can launch attacks on other factions. if false, it will only defend.
- Set Target Reload: The time needed before a faction picks a target.
- Randomly Pick Target: If true, then the faction will randomly pick a faction to be its target. If false, then the faction will pick the weakest faction to attack.
- Army Power Ratio: When a faction is attacking another faction, this determines how strong the army must be in comparison to the enemy’s army. The Army Power is defined by a sum of all the damage points that a unit can cause to another unit.
- Min Army Power: The minimum army power that the faction must have in any case (peace, defense or attack).
- Attack Time: The timer used to give orders or change orders for the units that are carrying the attack.
- Healers Rati: Between 0 and 1 and represents the ratio of the faction’s healers that will go with the army units while attacking.
- Converters Ratio: Between 0 and 1 and represents the ratio of the faction’s converters that will go with the army units while attacking.
- Attacking Support Range: This is the “Attack Range” in the “Attack.cs” component for the army units when the faction is attacking.
- Surrender Army Power: If the army power goes below this value while the faction is attacking, then the faction will surrender and stop the attack.
- Defense Units Ratio: When a faction is defending against other factions, this determines how strong the defense army must be in comparison the enemy’s attacking army.
- Defense Ratio: The timer that checks the defense state of the faction: whether it should keep defending or not and sets the defense orders for army units.