• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Order Structure to Stop Construction

Status
Not open for further replies.
  • Can't put waits in group or force callbacks; the thread crashes when it encounters a wait in either of these, so the actions after the wait are not executed.
  • The 'Do Nothing' command is (unsurprisingly) useless and never needs to be used; simply don't put any actions there.
  • You are leaking a few points, a unit group, and a force (player group) which you should avoid. Here's a good resource to explain what leaking is and how to fix it: Things That Leak
  • Wait has a minimum duration of ~0.27 seconds, so it won't actually wait 0.01 here.
  • The method you're doing is kind of silly. No need to compare the distance to all AI controlled units, just look in a 96 radius around the structure and see if there are any. This means you don't have to do the distance comparison yourself, the unit group getting is doing that internally for you.
  • AntiBuild
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Set TempP = (Position of (Constructing Structure)) //point variable
      • Set Count = 0 //integer variable
      • Custom script: set bj_wantDestroyGroup = true //this cleans the group leak in the next line automatically
      • Unit Group - Pick every unit in (Units within 96.00 of TempP matching ((Owner of (Matching Unit)) controller equal to Computer) and do (Actions)
        • Loop - Actions
          • Set Count = (Count + 1)
      • Custom script: call RemoveLocation(udg_TempP) //cleaning point leak
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Count greater than 0
        • Then - Actions
          • Set TempF = (Player group((Owner of (Constructing structure)))) //Player Group variable
          • Game - Display to TempF the text: |c0000cdf9Possible ...
          • Custom script: call DestroyForce(udg_TempF) //cleaning force leak
          • Wait 0.01 seconds
          • Custom script: call IssueImmediateOrderById(GetConstructingStructure(), 851976)
        • Else - Actions
 
The 'Do Nothing' command is (unsurprisingly) useless and never needs to be used; simply don't put any actions there.
It's not useless in single-line if actions, as the GUI needs something in the "else" field to be able to close the dialog.
It's entirely pointless in a multi-line though.
 
Yes dude I am fully aware of that. Single line ifs are also entirely pointless because the multi ones can be collapsed to take the same visual space.
I know that you're aware, I'm just stating it for readers of the thread.
Single lines are neat for short things, as it remains readable, whereas a collapsed multiline does not. Granted it isn't terribly useful, but it has its moments.
 
Status
Not open for further replies.
Back
Top