• 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.

Ordering Building to Cancel Construction Doesn't Work

Status
Not open for further replies.
Level 10
Joined
Apr 4, 2010
Messages
509
The ALLOW and DENY messages show, but canceling doesn't work. The triggers check if the building is being build on Grass Trim, if it is not being build on Grass Trim, the building should cancel. Test map below.
  • Only Build On Trim Grass
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Set Fence_Unit = (Constructing structure)
      • Set Fence_TempPoint[0] = (Position of Fence_Unit)
      • Set Fence_TempPoint[1] = (Fence_TempPoint[0] offset by 45.26 towards 45.00 degrees)
      • Set Fence_TempPoint[2] = (Fence_TempPoint[0] offset by 45.26 towards 135.00 degrees)
      • Set Fence_TempPoint[3] = (Fence_TempPoint[0] offset by 45.26 towards 225.00 degrees)
      • Set Fence_TempPoint[4] = (Fence_TempPoint[0] offset by 45.26 towards 315.00 degrees)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain type at Fence_TempPoint[1]) Equal to Cityscape - Grass Trim
          • (Terrain type at Fence_TempPoint[2]) Equal to Cityscape - Grass Trim
          • (Terrain type at Fence_TempPoint[3]) Equal to Cityscape - Grass Trim
          • (Terrain type at Fence_TempPoint[4]) Equal to Cityscape - Grass Trim
        • Then - Actions
          • Game - Display to (All players) for 0.00 seconds the text: ALLOW
        • Else - Actions
          • Custom script: call IssueImmediateOrderById (udg_Fence_Unit, 851976)
          • Game - Display to (All players) for 0.00 seconds the text: DENY
      • Custom script: call RemoveLocation (udg_Fence_TempPoint[0])
      • Custom script: call RemoveLocation (udg_Fence_TempPoint[1])
      • Custom script: call RemoveLocation (udg_Fence_TempPoint[2])
      • Custom script: call RemoveLocation (udg_Fence_TempPoint[3])
      • Custom script: call RemoveLocation (udg_Fence_TempPoint[4])
 

Attachments

  • Cancel.w3x
    16.3 KB · Views: 80
No prob. I actually asked DSG why adding a wait timer before the function call fixed it, and this is what he told me:
 

Attachments

  • Capture.PNG
    Capture.PNG
    5.6 KB · Views: 81

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
What I said applies for order events and not construction events although likely something similar is happening (event fires before the building finishes initialization so cannot be cancelled).

For what you are after doing you should be using the Unit Issued Point Order event so you can deny the structure as it is ordered instead of when construction starts.
 
Status
Not open for further replies.
Top