• 🏆 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] Buildings close together

Status
Not open for further replies.
Level 12
Joined
Jul 11, 2007
Messages
642
Hmm... this is suppost to make buildings only be built close together... what's wrong?
  • Buildings close together
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units within 500.00 of (Position of (Triggering unit))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to (Owner of (Constructing structure))
              • (Unit-type of (Picked unit)) Not equal to Main Builder
            • Then - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of (Triggering unit)) Equal to Player 1 (Red)
                • Then - Actions
                  • Game - Display to Player Group - Player 1 (Red) for 2.00 seconds the text: Must build building...
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
                    • Then - Actions
                      • Game - Display to Player Group - Player 2 (Blue) for 2.00 seconds the text: Must build building...
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Owner of (Triggering unit)) Equal to Player 3 (Teal)
                        • Then - Actions
                          • Game - Display to Player Group - Player 3 (Teal) for 2.00 seconds the text: Must build building...
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
                            • Then - Actions
                              • Game - Display to Player Group - Player 4 (Purple) for 2.00 seconds the text: Must build building...
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
                                • Then - Actions
                                  • Game - Display to Player Group - Player 5 (Yellow) for 2.00 seconds the text: Must build building...
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
                                    • Then - Actions
                                      • Game - Display to Player Group - Player 6 (Orange) for 2.00 seconds the text: Must build building...
                                    • Else - Actions
              • Unit - Kill (Constructing structure)
 
Level 5
Joined
Dec 17, 2007
Messages
145
What's it doing? What isn't it doing? Does it work at all? You need to provide more information.

Also, this trigger is needlessly massive. You can say "Game - Display to Player (Owning Player of Triggering Unit) for 2.00 seconds the message: "blah". You don't need that psychotic if/then statement. Also, you probably aren't getting messages because you're displaying messages to player groups, not individual players.

So do this:
  • Else-Actions
  • Game - Display to Owning Player of Triggering Unit for 2.00 seconds the text: "Text here".
Instead of that stupid If/Then chain.

NOTE: My GUI action may not be exactly how it's written in the editor. I never code with GUI any more, so I'm foggy, but it should be something along those lines nontheless.
 
Level 6
Joined
Feb 2, 2005
Messages
205
As far as i understand it, it should look for other buildings nearby, if there is no building the current constructed building should be destroyed.

Note:
count is a integer variable
tmplocation is a point variable

  • TrickyTrigger
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Set count = 0
      • Set tmplocation = (Position of (Triggering unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 512.00 of tmplocation matching (((Picked unit) is A structure) Equal to True)) and do (Actions)
        • Loop - Actions
          • Set count = (count + 1)
      • Custom script: call RemoveLocation(udg_tmplocation)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • count Less than or equal to 1
        • Then - Actions
          • Unit - Kill (Constructing structure)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Your Message here
        • Else - Actions
This should work, didn't test it.
 
Last edited:
Level 12
Joined
Jul 11, 2007
Messages
642
Ok, I didn't have time to explain earlier. It is a very simple idea - sort of like in command & conquer 3.

All buildings must be build close to another existing building that is owned by the same player as the unit building it. MUST BE A BUILDING, NOT A UNIT. That is why I had the
  • (Unit-type of (Picked unit)) Not equal to Main Builder
I would make one of those for every unit (Is there an easier way?). Also, I made all buildings have no pathing requirements, so buildings are essentially custom made. It really looks like a real castle.​


So, I changed that trigger to try and make it work better, and got this:
  • Buildings close together
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Set Count = 0
      • Set TP = (Position of (Triggering unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 300.00 of TP) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to (Owner of (Picked unit))
              • (Unit-type of (Picked unit)) Not equal to Main Builder
            • Then - Actions
              • Set Count = (Count + 1)
            • Else - Actions
      • Custom script: call RemoveLocation(udg_TP)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Count Less than 1
        • Then - Actions
          • Unit - Kill (Constructing structure)
          • Game - Display to (Player group((Owner of (Triggering unit)))) for 4.00 seconds the text: You must build buil...
        • Else - Actions
I ran across the same problem... No matter what I do, where I place a building, it does what it's suppost to do if I place it near - it lets me build it....
 
Last edited:
Status
Not open for further replies.
Top