• 🏆 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] Cancelled Building

Status
Not open for further replies.
Level 2
Joined
Sep 23, 2013
Messages
18
Scenario:
1. A neutral hostile barracks with watchtowers around it is destroyed by Player1(computer).
2. A peon(player1) begins constructing barracks on same spot neutral hostile barracks was in.
3. If construction is completed, watchtowers spawn around it.
4. If construction is interrupted/player2(computer) or other players destroys the constructing building, peon(player1) returns to base and a new barracks(player2) is constructed on the spot using peon(player2).

I have established 1,2,3. However at when I arrive at 4, I'm not sure what triggers to use, is it cancelled building?
I tested my map and it goes like this, player 1 destroy barracks, barracks(player1) is being built, player3 destroys constructing barracks, player1 peon stands around, player2 peon begins building barracks. Player1 destroys constructing barracks, nothing happens. It just stops there. :vw_wtf:

Am I doing it right? :O

  • Barracks CLD Cancelled
    • Events
      • Unit - A unit Cancels construction
    • Conditions
      • (Unit-type of (Cancelled structure)) Equal to Barracks
      • (Barracks CLD <gen> contains (Position of (Cancelled structure))) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Cancelled structure)) Equal to Player 1 (Red)
        • Then - Actions
          • Unit - Move Peon 0109 <gen> instantly to (Center of Red Builders <gen>)
        • Else - Actions
          • Unit - Move Peon 0108 <gen> instantly to (Center of Blue Builders <gen>)
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
Scenario:
I tested my map and it goes like this, player 1 destroy barracks, barracks(player1) is being built, player3 destroys constructing barracks, player1 peon stands around, player2 peon begins building barracks. Player1 destroys constructing barracks, nothing happens. It just stops there. :vw_wtf:

in this part ( I don't understand ). All i heard in this part is: destroy,destroy,barracks,barracks,player,destroy,player1,player2. Pls Elaborate, Explain or at least give some screenshots.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
It is difficult to understand you, but I think I've understood from reading it a few times is...

What you want to happen: When the original neutral barracks dies, the killing player may use their peon to build their own barracks at the old location. During the process of building if a player's barracks is killed, the peon is sent back home, and the new killing player may use their peon to build a barracks.

What is actually happening: (I'm guessing that unless you've ordered the computer to cancel building when the construction gets low that it doesn't so) Nothing is happening. Your trigger is never firing because the building dies, it does not get cancelled.

I know nothing of your map so I can't speak to it, but you should definitely look into fixing leaks, and the basics of loops. Right now if the owner of the player is Red, it's sent back to reds base, if it is not red, it is sent to blues base, you refenced in your example teal, I'm fairly certain teal does not want to be sent to blues base. Using a loop will allow you save the region's of red to brown and correctly send the peon home, without 12 long IFs.
 
Level 2
Joined
Sep 23, 2013
Messages
18
oh sorry,

  • Barracks CLD
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Barracks
      • (Barracks CLD <gen> contains (Position of (Dying unit))) Equal to True
    • Actions
      • Set Target_loc_BCLD[1] = (Position of (Dying unit))
      • Unit - Remove (Dying unit) from the game
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Killing unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Unit - Move Peon 0109 <gen> instantly to Target_loc_BCLD[1]
          • Unit - Order Peon 0109 <gen> to build a Barracks at Target_loc_BCLD[1]
        • Else - Actions
          • Unit - Move Peon 0108 <gen> instantly to Target_loc_BCLD[1]
          • Unit - Order Peon 0108 <gen> to build a Barracks at Target_loc_BCLD[1]
  • Barracks CLD Cancelled
    • Events
      • Unit - A unit Cancels construction
    • Conditions
      • (Unit-type of (Cancelled structure)) Equal to Barracks
      • (Barracks CLD <gen> contains (Position of (Cancelled structure))) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Cancelled structure)) Equal to Player 1 (Red)
        • Then - Actions
          • Unit - Move Peon 0109 <gen> instantly to (Center of Red Builders <gen>)
        • Else - Actions
          • Unit - Move Peon 0108 <gen> instantly to (Center of Blue Builders <gen>)
  • Watch Towers CLD
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Barracks
      • (Barracks CLD <gen> contains (Position of (Constructed structure))) Equal to True
    • Actions
      • Set Target_loc_BCLD[2] = (Target_loc_BCLD[1] offset by 350.00 towards 0.00 degrees)
      • Set Target_loc_BCLD[3] = (Target_loc_BCLD[1] offset by 350.00 towards 90.00 degrees)
      • Set Target_loc_BCLD[4] = (Target_loc_BCLD[1] offset by 350.00 towards 180.00 degrees)
      • Set Target_loc_BCLD[5] = (Target_loc_BCLD[1] offset by 400.00 towards 270.00 degrees)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Constructed structure)) Equal to Player 1 (Red)
        • Then - Actions
          • Unit - Create 1 Watch Tower for Player 1 (Red) at Target_loc_BCLD[2] facing Default building facing degrees
          • Unit - Create 1 Watch Tower for Player 1 (Red) at Target_loc_BCLD[3] facing Default building facing degrees
          • Unit - Create 1 Watch Tower for Player 1 (Red) at Target_loc_BCLD[4] facing Default building facing degrees
          • Unit - Create 1 Watch Tower for Player 1 (Red) at Target_loc_BCLD[5] facing Default building facing degrees
          • Unit - Move Peon 0109 <gen> instantly to (Center of Red Builders <gen>)
        • Else - Actions
          • Unit - Create 1 Watch Tower for Player 2 (Blue) at Target_loc_BCLD[2] facing Default building facing degrees
          • Unit - Create 1 Watch Tower for Player 2 (Blue) at Target_loc_BCLD[3] facing Default building facing degrees
          • Unit - Create 1 Watch Tower for Player 2 (Blue) at Target_loc_BCLD[4] facing Default building facing degrees
          • Unit - Create 1 Watch Tower for Player 2 (Blue) at Target_loc_BCLD[5] facing Default building facing degrees
          • Unit - Move Peon 0108 <gen> instantly to (Center of Blue Builders <gen>)
      • Custom script: call RemoveLocation (udg_Target_loc_BCLD[1])
      • Custom script: call RemoveLocation (udg_Target_loc_BCLD[2])
      • Custom script: call RemoveLocation (udg_Target_loc_BCLD[3])
      • Custom script: call RemoveLocation (udg_Target_loc_BCLD[4])
      • Custom script: call RemoveLocation (udg_Target_loc_BCLD[5])
player2 and player3 are allies

I made a spot where there is this neutral barracks with watchtowers
there are two sides, good(computer+players) and bad(computer)
it's kinda like capture the base.
if one group destroys the neutral base, the base rebuilds and is on the side that destroyed it.
since it has a construction time, if ever it is interrupted, the group that destroys it again owns the place.
something like that if you get it :/
 
Last edited:
Level 2
Joined
Sep 23, 2013
Messages
18
The spot where the neutral building is, it's a relatively larger area than just the barracks

sorry about the triggers, fixed it
 
Last edited:
Level 25
Joined
Sep 26, 2009
Messages
2,378
tbh you can simplify the "Watch Tower CLD"
  • Actions
    • Set pl = (Triggering player)
    • For each (Integer LoopInt) from 1 to 4, do (Actions)
      • Loop - Actions
        • Set loc = (Target_loc_BCLD offset by 350.00 towards (90.00 x (Real(LoopInt))) degrees)
        • Unit - Create 1 Watch Tower for pl at loc facing Default building facing degrees
        • Custom script: call RemoveLocation(udg_loc)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • pl Equal to Player 1 (Red)
      • Then - Actions
        • Unit - Move Red_Peon instantly to (Center of Red Builders <gen>)
      • Else - Actions
        • Unit - Move Blue_Peon instantly to (Center of Blue Builders <gen>)
    • Custom script: set udg_loc = null
loc is point variable
pl is player variable
LoopInt is integer variable

As you can see, taking advantage of loops, you don't have to create 4 locations in an array.
 
Last edited:
Level 2
Joined
Sep 23, 2013
Messages
18
So, all is working?

Nope, It doesn't work.. when a constructing building owned by player1 is destroyed, player1's peon just stands there, player2's peon begins constructing, and if that constructing structure is destroyed, nothing happens, nothing builds. I'll try to get screens up

tbh you can simplify the "Watch Tower CLD"
Will work on that.. thank you


dvj4.jpg



j3dh.jpg



7hwp.jpg



8fnk.jpg



as you can see, the red peon just stands there...
 
Last edited:
Status
Not open for further replies.
Top