• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

AI Training Problem

Status
Not open for further replies.
Level 25
Joined
May 11, 2007
Messages
4,651
  • Like
Reactions: Kam
I do not understand why this is not working. Right now the AI trains 12 footmen and then stops. The standard AI files controls building structures and heroes. After a hero dies it is not revived. Neither of these two is intended.

  • Train Units
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set AI_Players = (All players controlled by a Computer player)
      • Player Group - Pick every player in AI_Players and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Race of (Picked player)) Equal to Human
            • Then - Actions
              • -------- Unit Type Groups --------
              • Set AI_Footmen_Group = (Units owned by (Picked player) matching ((((Matching unit) is alive) Equal to True) and (((Unit-type of (Matching unit)) Equal to Footman (New)) or (((Unit-type of (Matching unit)) Equal to Footman (New - RS)) or ((Level of AI Footman for (Matching unit)) E
              • Set AI_Paladin_Group = (Units owned by (Picked player) matching ((((Matching unit) is alive) Equal to True) and (((Unit-type of (Matching unit)) Equal to Paladin) or ((Level of AI Paladin for (Matching unit)) Equal to 1))))
              • Set AI_Harasser_Group = (Units owned by (Picked player) matching ((((Matching unit) is alive) Equal to True) and (((Unit-type of (Matching unit)) Equal to Harasser) or ((Level of AI Harasser for (Matching unit)) Equal to 1))))
              • Set AI_Engine_Group = (Units owned by (Picked player) matching ((((Matching unit) is alive) Equal to True) and (((Unit-type of (Matching unit)) Equal to Siege Engine) or (((Unit-type of (Matching unit)) Equal to Siege Engine (Barrage)) or ((Level of AI Engine for (Matching unit))
              • Set AI_Bulwark_Group = (Units owned by (Picked player) matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Bulwark)))
              • -------- Structure Type Groups --------
              • Set AI_Castle_Group = (Units owned by (Picked player) matching (((Unit-type of (Matching unit)) Equal to Castle) and ((Level of AI Construct for (Triggering unit)) Equal to 1)))
              • Set AI_KeepCastle_Group = (Units owned by (Picked player) matching ((((Unit-type of (Matching unit)) Equal to Keep) or ((Unit-type of (Matching unit)) Equal to Castle)) and ((Level of AI Construct for (Matching unit)) Equal to 1)))
              • Set AI_Barracks_Group = (Units owned by (Picked player) matching (((Unit-type of (Matching unit)) Equal to Barracks) and (((Level of AI Construct for (Matching unit)) Equal to 1) and ((Level of AI Train for (Matching unit)) Equal to 0))))
              • Set AI_Blacksmith_Group = (Units owned by (Picked player) matching ((Unit-type of (Matching unit)) Equal to Blacksmith))
              • Set AI_LumberMill_Group = (Units owned by (Picked player) matching ((Unit-type of (Matching unit)) Equal to Elven Lumber Mill))
              • Set AI_Factory_Group = (Units owned by (Picked player) matching ((Unit-type of (Matching unit)) Equal to Gnomish Factory))
              • Set AI_Shipyard_Group = (Units owned by (Picked player) matching ((Unit-type of (Matching unit)) Equal to Shipyard (Human)))
              • -------- Unit Type Integers --------
              • Set AI_Footmen = (Number of units in AI_Footmen_Group)
              • Set AI_Paladin = (Number of units in AI_Paladin_Group)
              • Set AI_Harasser = (Number of units in AI_Harasser_Group)
              • Set AI_Engine = (Number of units in AI_Engine_Group)
              • Set AI_Bulwark = (Number of units in AI_Bulwark_Group)
              • -------- Structure Type Integers --------
              • Set AI_Castle = (Number of units in AI_Castle_Group)
              • Set AI_KeepCastle = (Number of units in AI_KeepCastle_Group)
              • Set AI_Barracks = (Number of units in AI_Barracks_Group)
              • Set AI_Blacksmith = (Number of units in AI_Blacksmith_Group)
              • Set AI_LumberMill = (Number of units in AI_LumberMill_Group)
              • Set AI_Factory = (Number of units in AI_Factory_Group)
              • Set AI_Shipyard = (Number of units in AI_Shipyard_Group)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Melee AI of (Picked player)) Equal to Normal AI
                • Then - Actions
                  • -------- HEAVY GROUND --------
                  • -------- Footman 22 --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AI_Footmen Less than 12
                      • AI_Barracks Greater than 0
                      • ((Picked player) Food used) Less than or equal to (((Picked player) Food cap) - 2)
                      • ((Picked player) Current gold) Greater than or equal to 210
                    • Then - Actions
                      • Set AI_Barracks_Group_Train = (Random unit from AI_Barracks_Group)
                      • Set AI_Train_Point = (Position of AI_Barracks_Group_Train)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Current research level of Refined Smithing for (Picked player)) Equal to 0
                        • Then - Actions
                          • Unit - Order AI_Barracks_Group_Train to train/upgrade to a Footman (New)
                        • Else - Actions
                          • Unit - Order AI_Barracks_Group_Train to train/upgrade to a Footman (New - RS)
                      • Unit - Add AI Train to AI_Barracks_Group_Train
                      • Unit - Create 1 Dummy for (Picked player) at AI_Train_Point facing Default building facing degrees
                      • Unit - Add AI Footman to (Last created unit)
                      • Unit - Add a 18.00 second Generic expiration timer to (Last created unit)
                      • Custom script: call RemoveLocation (udg_AI_Train_Point)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AI_Footmen Greater than or equal to 12
                      • AI_Footmen Less than 22
                      • AI_Paladin Greater than or equal to 6
                      • AI_Barracks Greater than 0
                      • ((Picked player) Food used) Less than or equal to (((Picked player) Food cap) - 2)
                      • ((Picked player) Current gold) Greater than or equal to 210
                    • Then - Actions
                      • Set AI_Barracks_Group_Train = (Random unit from AI_Barracks_Group)
                      • Set AI_Train_Point = (Position of AI_Barracks_Group_Train)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Current research level of Refined Smithing for (Picked player)) Equal to 0
                        • Then - Actions
                          • Unit - Order AI_Barracks_Group_Train to train/upgrade to a Footman (New)
                        • Else - Actions
                          • Unit - Order AI_Barracks_Group_Train to train/upgrade to a Footman (New - RS)
                      • Unit - Add AI Train to AI_Barracks_Group_Train
                      • Unit - Create 1 Dummy for (Picked player) at AI_Train_Point facing Default building facing degrees
                      • Unit - Add AI Footman to (Last created unit)
                      • Unit - Add a 18.00 second Generic expiration timer to (Last created unit)
                      • Custom script: call RemoveLocation (udg_AI_Train_Point)
                    • Else - Actions
                  • -------- Paladin 12 --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AI_Paladin Less than 12
                      • AI_KeepCastle Greater than 0
                      • AI_Barracks Greater than 0
                      • AI_Blacksmith Greater than 0
                      • AI_LumberMill Greater than 0
                      • ((Picked player) Food used) Less than or equal to (((Picked player) Food cap) - 4)
                      • ((Picked player) Current gold) Greater than or equal to 370
                      • ((Picked player) Current lumber) Greater than or equal to 30
                    • Then - Actions
                      • Set AI_Barracks_Group_Train = (Random unit from AI_Barracks_Group)
                      • Set AI_Train_Point = (Position of AI_Barracks_Group_Train)
                      • Unit - Order AI_Barracks_Group_Train to train/upgrade to a Paladin
                      • Unit - Add AI Train to AI_Barracks_Group_Train
                      • Unit - Create 1 Dummy for (Picked player) at AI_Train_Point facing Default building facing degrees
                      • Unit - Add AI Paladin to (Last created unit)
                      • Unit - Add a 45.00 second Generic expiration timer to (Last created unit)
                      • Custom script: call RemoveLocation (udg_AI_Train_Point)
                    • Else - Actions
                  • -------- Harasser 4 --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AI_Harasser Less than 4
                      • AI_KeepCastle Greater than 0
                      • AI_LumberMill Greater than 0
                      • AI_Factory Greater than 0
                      • ((Picked player) Food used) Less than or equal to (((Picked player) Food cap) - 3)
                      • ((Picked player) Current gold) Greater than or equal to 290
                      • ((Picked player) Current lumber) Greater than or equal to 110
                    • Then - Actions
                      • Set AI_Factory_Group_Train = (Random unit from AI_Factory_Group)
                      • Set AI_Train_Point = (Position of AI_Factory_Group_Train)
                      • Unit - Order AI_Factory_Group_Train to train/upgrade to a Harasser
                      • Unit - Add AI Train to AI_Factory_Group_Train
                      • Unit - Create 1 Dummy for (Picked player) at AI_Train_Point facing Default building facing degrees
                      • Unit - Add AI Harasser to (Last created unit)
                      • Unit - Add a 16.00 second Generic expiration timer to (Last created unit)
                      • Custom script: call RemoveLocation (udg_AI_Train_Point)
                    • Else - Actions
                  • -------- Siege Engine 3 --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AI_Engine Less than 3
                      • AI_Castle Greater than 0
                      • AI_Blacksmith Greater than 0
                      • AI_Factory Greater than 0
                      • ((Picked player) Food used) Less than or equal to (((Picked player) Food cap) - 3)
                      • ((Picked player) Current gold) Greater than or equal to 320
                      • ((Picked player) Current lumber) Greater than or equal to 140
                    • Then - Actions
                      • Set AI_Factory_Group_Train = (Random unit from AI_Factory_Group)
                      • Set AI_Train_Point = (Position of AI_Factory_Group_Train)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Current research level of Barrage for (Picked player)) Equal to 0
                        • Then - Actions
                          • Unit - Order AI_Factory_Group_Train to train/upgrade to a Siege Engine
                        • Else - Actions
                          • Unit - Order AI_Factory_Group_Train to train/upgrade to a Siege Engine (Barrage)
                      • Unit - Add AI Train to AI_Factory_Group_Train
                      • Unit - Create 1 Dummy for (Picked player) at AI_Train_Point facing Default building facing degrees
                      • Unit - Add AI Engine to (Last created unit)
                      • Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
                      • Custom script: call RemoveLocation (udg_AI_Train_Point)
                    • Else - Actions
                  • -------- Bulwark 4 --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AI_Bulwark Less than 4
                      • AI_KeepCastle Greater than 0
                      • AI_Factory Greater than 0
                      • AI_Shipyard Greater than 0
                      • ((Picked player) Food used) Less than or equal to (((Picked player) Food cap) - 3)
                      • ((Picked player) Current gold) Greater than or equal to 350
                      • ((Picked player) Current lumber) Greater than or equal to 135
                    • Then - Actions
                      • Set AI_Shipyard_Group_Train = (Random unit from AI_Shipyard_Group)
                      • Set AI_Train_Point = (Position of AI_Shipyard_Group_Train)
                      • Unit - Order AI_Shipyard_Group_Train to train/upgrade to a Bulwark
                      • Unit - Add AI Train to AI_Shipyard_Group_Train
                      • Unit - Create 1 Dummy for (Picked player) at AI_Train_Point facing Default building facing degrees
                      • Unit - Add AI Bulwark to (Last created unit)
                      • Unit - Add a 20.00 second Generic expiration timer to (Last created unit)
                      • Custom script: call RemoveLocation (udg_AI_Train_Point)
                    • Else - Actions
                • Else - Actions
              • Custom script: call DestroyGroup (udg_AI_Footmen_Group)
              • Custom script: call DestroyGroup (udg_AI_Paladin_Group)
              • Custom script: call DestroyGroup (udg_AI_Harasser_Group)
              • Custom script: call DestroyGroup (udg_AI_Engine_Group)
              • Custom script: call DestroyGroup (udg_AI_Bulwark_Group)
              • Custom script: call DestroyGroup (udg_AI_Castle_Group)
              • Custom script: call DestroyGroup (udg_AI_KeepCastle_Group)
              • Custom script: call DestroyGroup (udg_AI_Barracks_Group)
              • Custom script: call DestroyGroup (udg_AI_Blacksmith_Group)
              • Custom script: call DestroyGroup (udg_AI_LumberMill_Group)
              • Custom script: call DestroyGroup (udg_AI_Factory_Group)
              • Custom script: call DestroyGroup (udg_AI_Shipyard_Group)
            • Else - Actions
      • Custom script: call DestroyForce (udg_AI_Players)
 
Status
Not open for further replies.
Top