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

[Solved] Cancel every training and research in building

Status
Not open for further replies.
Level 24
Joined
Jun 26, 2020
Messages
1,852
I don't think if exist a direct solution, I just can think using "Replace <unit> with (Unit-Type of <unit>)" but that create an another different unit of that building, so if you have it stored in a variable or hashtable, so you have to re-assign it, if not, so you won't have problem.
 
I think i've got a solution for this one. :)

As we know, there are 7 slots in each building for either unit training, researches or hero revivals.
So we need to order each building to Cancel whatever it's doing 7 times.

I looked up the order ID for the Cancel order. So now we can order the building to cancel whatever it's doing.


  • Unit Group - Pick every unit in (GroupBuildings) and do (Actions) //The group of the buildings that you want to cancel whatever they're doing!
    • Loop - Actions
      • Set VariableSet Building = (Picked unit) //A Temp variable cuz the dumbass custom script needs it as an argument!
      • For each (Integer A) from 1 to 7, do (Actions) //Loop that sumbitch 7 times, as my lucky number!
        • Loop - Actions
          • Custom script: call IssueImmediateOrderById(udg_Building, 851976) //Order the dumb building to cancel //equal to pressing ESC 1 time
I tested this already and it worked. :)
 
Level 24
Joined
Jun 26, 2020
Messages
1,852
If you wanna do that for just one player, if @MN Lahmar said is true, just do this.
  • Set Temp_Group=Units Owned by "Your Player"
  • Unit Group - Pick every unit in Temp_Group and do (Actions)
    • Loop - Actions
      • Set Temp_Unit=(Picked Unit)
      • If (All conditions are true) then do (Then actions) else do (Else Actions)
        • If - Conditions
          • Temp_Unit is a structure Equal to true
        • Then - Actions
          • For each "Your integer" from 1 to 7, do (Actions)
            • Loop - Actions
              • Custom script: call IssueImmediateOrderById(udg_Temp_Unit, 851976)
        • Else - Actions
  • Custom script: call DestroyGroup(udg_Temp_Group)
 
Status
Not open for further replies.
Top