• 🏆 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!

[Trigger] Building problem...

Status
Not open for further replies.
Level 19
Joined
Sep 4, 2007
Messages
2,826
Doesn't seem like I'm getting help from the AI section so I'll try here.
Hello! I'm currently trying to implement an AI for my version Dawn of New Empires v1.16. The AI system here is supposed to make each time a worker is trained to build shelters at Shelter61, Shelter62 and Shelter63.
The problem is that after the first AI worker has built an building the second trained unit doesn't continue nor the third one. How matter I try to change the trigger they keep building the first one and stop... Any help please?
I'm only testing this trigger on 1 player at the moment and it seems like all the previous AI triggers work fine till the AI begins to build the second building.
I might change to offset but that has to wait till I've figured this out.
  • Build Shelters
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Owner of (Trained unit)) controller) Equal to Computer
          • ((Trained unit) is A peon-type unit) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AIBuildValue[(Player number of (Owner of (Trained unit)))] Equal to 1
        • Then - Actions
          • Set AIBuildingPlacement[AIBuildValue[(Player number of (Owner of (Trained unit)))]] = Shelter61 <gen>
          • Set AIBuildingQueue[AIBuildValue[(Player number of (Owner of (Trained unit)))]] = |Cffff0000Shelter
          • Unit - Order (Trained unit) to build a AIBuildingQueue[(Player number of (Owner of (Trained unit)))] at (Center of AIBuildingPlacement[AIBuildValue[(Player number of (Owner of (Trained unit)))]])
          • Set AIBuildValue[(Player number of (Owner of (Trained unit)))] = (AIBuildValue[(Player number of (Owner of (Trained unit)))] + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AIBuildValue[(Player number of (Owner of (Trained unit)))] Equal to 2
        • Then - Actions
          • Set AIBuildingPlacement[AIBuildValue[(Player number of (Owner of (Trained unit)))]] = Shelter62 <gen>
          • Set AIBuildingQueue[AIBuildValue[(Player number of (Owner of (Trained unit)))]] = |Cffff0000Shelter
          • Unit - Order (Trained unit) to build a AIBuildingQueue[(Player number of (Owner of (Trained unit)))] at (Center of AIBuildingPlacement[AIBuildValue[(Player number of (Owner of (Trained unit)))]])
          • Set AIBuildValue[(Player number of (Owner of (Trained unit)))] = (AIBuildValue[(Player number of (Owner of (Trained unit)))] + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AIBuildValue[(Player number of (Owner of (Trained unit)))] Equal to 2
        • Then - Actions
          • Set AIBuildingPlacement[AIBuildValue[(Player number of (Owner of (Trained unit)))]] = Shelter63 <gen>
          • Set AIBuildingQueue[AIBuildValue[(Player number of (Owner of (Trained unit)))]] = |Cffff0000Shelter
          • Unit - Order (Trained unit) to build a AIBuildingQueue[(Player number of (Owner of (Trained unit)))] at (Center of AIBuildingPlacement[AIBuildValue[(Player number of (Owner of (Trained unit)))]])
          • Set AIBuildValue[(Player number of (Owner of (Trained unit)))] = (AIBuildValue[(Player number of (Owner of (Trained unit)))] + 1)
        • Else - Actions
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
Shouldn't Set AIBuildingPlacement[AIBuildValue[(Player number of (Owner of (Trained unit)))]] = Shelter61 <gen (and all the rest of them) be Set AIBuildingPlacement[(Player number of (Owner of (Trained unit)))] = Shelter61 <gen.

Also at the third if/then/else you didn't raise your counter's value.
 
Level 19
Joined
Sep 4, 2007
Messages
2,826
It still doesn't work... :(
I've updated the trigger.
  • Build Shelters
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Owner of (Trained unit)) controller) Equal to Computer
          • ((Trained unit) is A peon-type unit) Equal to True
          • AIBuildValue[(Player number of (Owner of (Trained unit)))] Less than or equal to 3
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AIBuildValue[(Player number of (Owner of (Trained unit)))] Equal to 1
        • Then - Actions
          • Set AIBuildingQueue[(Player number of (Owner of (Trained unit)))] = |Cffff0000Shelter
          • Unit - Order (Trained unit) to build a AIBuildingQueue[(Player number of (Owner of (Trained unit)))] at (Center of Shelter61 <gen>)
          • Set AIBuildValue[(Player number of (Owner of (Trained unit)))] = (AIBuildValue[(Player number of (Owner of (Trained unit)))] + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AIBuildValue[(Player number of (Owner of (Trained unit)))] Equal to 2
        • Then - Actions
          • Set AIBuildingQueue[(Player number of (Owner of (Trained unit)))] = |Cffff0000Shelter
          • Unit - Order (Trained unit) to build a AIBuildingQueue[(Player number of (Owner of (Trained unit)))] at (Center of Shelter62 <gen>)
          • Set AIBuildValue[(Player number of (Owner of (Trained unit)))] = (AIBuildValue[(Player number of (Owner of (Trained unit)))] + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AIBuildValue[(Player number of (Owner of (Trained unit)))] Equal to 3
        • Then - Actions
          • Set AIBuildingQueue[(Player number of (Owner of (Trained unit)))] = |Cffff0000Shelter
          • Unit - Order (Trained unit) to build a AIBuildingQueue[(Player number of (Owner of (Trained unit)))] at (Center of Shelter63 <gen>)
          • Set AIBuildValue[(Player number of (Owner of (Trained unit)))] = (AIBuildValue[(Player number of (Owner of (Trained unit)))] + 1)
        • Else - Actions
 
Level 19
Joined
Sep 4, 2007
Messages
2,826
  • Set AIBuildValue[(Player number of (Owner of (Trained unit)))] = (AIBuildValue[(Player number of (Owner of (Trained unit)))] + 1)
This should work...
That is a really good question. :D I don't know why my reputation is changing color... I only have 2 rep yet... Doesn't make sence at all. :(
 
Status
Not open for further replies.
Top