Permanent thread:Yes this is a ugly solution for controlling the ACU.
If you programm a attack function, then this attack function must break if the ACU is at low health or far away from the base.
If you don't break the attack function then we never reach the "go home" etc functions from the commander behavior thread.
Or your attack function can handle low health etc. then you only need one combined ACU move/attack function that can attack and run home on low health.
Triggers:If the ACU gets a buildorder it will execute the build until end.
While building, the ACU is not inside the ArmyPool platoon and can't get another buildorder.
In case you break the building with your custom functions inside the commander behavior thread, then you can resume the building with forking the platoon.WatchForNotBuilding function.
(Thats the task from the 2nd part of the behavior thread called "--Call platoon resume building deal")
ACU eco role:If the ACU is not available for eco building then automatically engineers will do the job. They have just a lower priority then the ACU for the same buildings.
So you can use the ACU for attacking from the start if you want.
In my
AI the ACU builds only t1 energy until the first T2 energy building is present.
After this the ACU is free to do anything like enhancing, attacking or hiding.
Specific AI behavior:Thats easy, you have this already in some builders.
Like the commander initial builder you can add the "PlatoonAddBehaviors" to every platton.
For example this air platton:
- Code: Select all
Builder {
BuilderName = 'AntiAirHunt',
PlatoonTemplate = 'AntiAirHunt',
PlatoonAddBehaviors = { 'AirUnitRefit' },
BuilderType = 'Any',
BuilderData = {
Location = 'LocationType',
NeverGuardEngineers = true,
},
BuilderConditions = {
{ UCBC, 'PoolGreaterAtLocation', { 'LocationType', 4, categories.AIR * categories.MOBILE * categories.ANTIAIR } },
},
},
And the corresponding Platoon Template 'AntiAirHunt':
- Code: Select all
PlatoonTemplate {
Name = 'AntiAirHunt',
Plan = 'InterceptorAI',
GlobalSquads = {
{ categories.AIR * categories.MOBILE * categories.ANTIAIR, 5, 100, 'attack', 'none' },
}
}
The Builder BuilderName = 'AntiAirHunt', is building a platoon with the template called PlatoonTemplate = 'AntiAirHunt',
The PlatoonTemplate is adding the main thread (
AI plan) for this platton called Plan = 'InterceptorAI',
Thats the normal behavior of any platton.
In additional the builder will add a 2nd programm thread to the unit/platoon called: PlatoonAddBehaviors = { 'AirUnitRefit' },
This way we have 2 threads running, the first is the "InterceptorAI" for attacking and the second is "AirUnitRefit" for repair/refuel.
[Edit]
If you create your own PlatoonTemplate then you can add as
AI plan every function you want.
Then you don't need the PlatoonAddBehaviors and you only have 1 thread running.