- Joined
- Aug 3, 2004
- Messages
- 2,906
I have the following trigger that deals with custom AI. The issue is that it is not counting units in production. In the standard AI editor there is an option to count incomplete units as well. Is there a way to do this with triggers?
To be clear it is supposed to stop at 15 Footmen, but is makes extra because it doesn't count in production.
To be clear it is supposed to stop at 15 Footmen, but is makes extra because it doesn't count in production.
-
AI Unit Composition
-
Events
-
Time - Every 1.00 seconds of game time
-
-
Conditions
-
Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Race of (Player((Integer A)))) Equal to Human) and (((Player((Integer A))) controller) Equal to Computer)
-
-
Then - Actions
-
-------- Unit Production Structures --------
-
Set AI_Human_Barracks = (Units owned by (Player((Integer A))) of type Barracks)
-
Set AI_Human_Workshop = (Units owned by (Player((Integer A))) of type Workshop)
-
Set AI_Human_Sanctum = (Units owned by (Player((Integer A))) of type Arcane Sanctum)
-
Set AI_Human_Aviary = (Units owned by (Player((Integer A))) of type Gryphon Aviary)
-
Set AI_Human_Altar = (Units owned by (Player((Integer A))) of type Altar of Kings)
-
-------- Support Structures --------
-
Set AI_Human_Hall = (Number of living Town Hall units owned by (Player((Integer A))))
-
Set AI_Human_Keep = (Number of living Keep units owned by (Player((Integer A))))
-
Set AI_Human_Castle = (Number of living Castle units owned by (Player((Integer A))))
-
Set AI_Human_Lumber = (Number of living Lumber Mill units owned by (Player((Integer A))))
-
Set AI_Human_Blacksmith = (Number of living Blacksmith units owned by (Player((Integer A))))
-
-------- Unit Count --------
-
Set AI_Human_Footman = (Number of living Footman units owned by (Player((Integer A))))
-
Set AI_Human_Knight = (Number of living Knight units owned by (Player((Integer A))))
-
Set AI_Human_Rifleman = (Number of living Rifleman units owned by (Player((Integer A))))
-
Set AI_Human_Mortar = (Number of living Mortar Team units owned by (Player((Integer A))))
-
Set AI_Human_Machine = (Number of living Flying Machine units owned by (Player((Integer A))))
-
Set AI_Human_Gryphon = (Number of living Gryphon Rider units owned by (Player((Integer A))))
-
Set AI_Human_Priest = (Number of living Priest units owned by (Player((Integer A))))
-
Set AI_Human_Sorceress = (Number of living Sorceress units owned by (Player((Integer A))))
-
Set AI_Human_Engine = (Number of living Siege Engine units owned by (Player((Integer A))))
-
Set AI_Human_Breaker = (Number of living Spell Breaker units owned by (Player((Integer A))))
-
Set AI_Human_Rider = (Number of living Dragonhawk Rider units owned by (Player((Integer A))))
-
Set AI_Human_Hero_A = (Number of living Paladin units owned by (Player((Integer A))))
-
Set AI_Human_Hero_B = (Number of living Archmage units owned by (Player((Integer A))))
-
Set AI_Human_Hero_C = (Number of living Mountain King units owned by (Player((Integer A))))
-
Set AI_Human_Hero_D = (Number of living Blood Mage units owned by (Player((Integer A))))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Melee AI of (Player((Integer A)))) Equal to Normal AI
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Current research level of 1 for (Player((Integer A)))) Equal to 1
-
-
Then - Actions
-
-------- HEAVY GROUND --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in AI_Human_Altar) Greater than 0
-
((Player((Integer A))) Food used) Less than or equal to (((Player((Integer A))) Food cap) - 5)
-
AI_Human_Hero_C Less than 1
-
((Player((Integer A))) Available free Heroes) Greater than 0
-
-
Then - Actions
-
Unit - Order (Random unit from AI_Human_Altar) to train/upgrade to a Mountain King
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in AI_Human_Barracks) Greater than 0
-
((Player((Integer A))) Current gold) Greater than or equal to 135
-
((Player((Integer A))) Food used) Less than or equal to (((Player((Integer A))) Food cap) - 2)
-
AI_Human_Footman Less than 15
-
-
Then - Actions
-
Unit - Order (Random unit from AI_Human_Barracks) to train/upgrade to a Footman
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions
-
-
Custom script: call DestroyGroup(udg_AI_Human_Barracks)
-
Custom script: call DestroyGroup(udg_AI_Human_Workshop)
-
Custom script: call DestroyGroup(udg_AI_Human_Sanctum)
-
Custom script: call DestroyGroup(udg_AI_Human_Aviary)
-
Custom script: call DestroyGroup(udg_AI_Human_Altar)
-
-
Else - Actions
-
-
-
-
-