• 🏆 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] Combine Buildings (Fix)

Status
Not open for further replies.
Level 2
Joined
May 21, 2013
Messages
17
Combine Buildings

Hello,

Posted is a trigger used to combine 8 of the same buildings and 1 center building, into 1 building itself.

The build is like this:

X X X
X Z X
X X X

When all of the X buildings have been upgraded or built to level 4 properly placed around the center building, they will combine into 1 big building. For some reason the trigger is not working. If you have any questions or need more information please ask! Any help?

  • Create Lumber Factory
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Lumber Mill Lvl 4
    • Actions
      • Set TempGroup = (Units within 196.00 of (Position of (Triggering unit)) matching ((((Unit-type of (Matching unit)) Equal to Repair Factory) or ((Point-value of (Matching unit)) Equal to 50)) and ((Custom value of (Matching unit)) Equal to 0)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Greater than or equal to 1
        • Then - Actions
          • Set TempUnit = (Random unit from TempGroup)
          • Set TempPoint = (Position of TempUnit)
        • Else - Actions
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Set TempGroup = (Units within 192.00 of TempPoint matching (((Unit-type of (Matching unit)) Equal to Lumber Mill Lvl 4) and ((Custom value of (Matching unit)) Equal to 0)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Equal to 8
        • Then - Actions
          • Unit - Remove TempUnit from the game
          • Unit Group - Pick every unit in TempGroup and do (Unit - Remove (Picked unit) from the game)
          • Unit - Create 1 Dummy [Charm Transmute] for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Hero - Create |cff8080c0[Item]|r|cffe38d1a Lumber Factory 6|r and give it to (Last created unit)
          • Hero - Order (Last created unit) to use (Last created item) on TempPoint
        • Else - Actions
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Custom script: call RemoveLocation (udg_TempPoint)
 

Attachments

  • Lumber Factory Triggers.png
    Lumber Factory Triggers.png
    42.4 KB · Views: 94
Last edited:
Level 2
Joined
May 21, 2013
Messages
17
The center building is a repair factory/repair unit, and the 8 buildings built around the outside of it are lumber mills (lvl 4's), and when all 8 of the mills are level 4 around the center building, I want all 9 of the buildings to be removed and the new level 6 mill to take its place being constructed.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
ok what u have to do then is every time a lvl 4 mill is built add it to a unit group and increase an integer. Make sure this integer is for this only. Then when the integer hits 9 u set a boolean to true then do a group loop and remove the buildings in the unit group.
then after the group loop use an ite and for the condition check for the boolean. if it is true then place the mil lvl 6 were u want.
 
Level 2
Joined
May 21, 2013
Messages
17
Yeah I have been reading through that. I am not new to map making, just have been having this bug in a map of ours lately.. That trigger has been working for the last few versions and suddenly stopped working.. No one can seem to get it!

But yeah if you don't mind posting the new trigger that would be greatly appreciated! Thanks mate
 
Level 2
Joined
May 21, 2013
Messages
17
Every time they upgrade/construct 8 regular sized level 4 mills placed around the repair factory/unit it will change. No limit on how many
 
Level 2
Joined
May 21, 2013
Messages
17
Attached here is a screenshot of the before and after.

After all 8 of those buildings are upgraded around the middle building, they are ALL removed and the new building replaces them in the same place.

Left = 8 buildings around 1 building

X X X
X Z X
X X X

Right = New building

And yes, the middle building can be placed before or after the surrounding buildings are placed.
 

Attachments

  • Before & After (Mills).png
    Before & After (Mills).png
    924.9 KB · Views: 118
Level 29
Joined
Oct 24, 2012
Messages
6,543
here u go it works.
Umm only thing is that if they have to be in range of the main building u need to add a condition so that will happen. As of right now u can build them anywere in the map and it will trigger it.

There can only be one main building per player. I initialize the unit groups in the variable editor so it works.
u need to change the upgrade list to what u want. i made one in the map init trigger.
 

Attachments

  • combine buildings for MichaelwP.w3x
    14.2 KB · Views: 35
Level 2
Joined
May 21, 2013
Messages
17
Thank you for the trigger, unfortunately this won't work though. I am going to test it with your debug idea right now. Where you put the game message in every other line and see where it fails..
 
Level 2
Joined
May 21, 2013
Messages
17
The 8 surrounding buildings have to be constructed touching the middle building perfectly as in the photo I showed you. The players may have other repair factories and lumber mills touching all over, so it needs to be very precise that it only groups those 9 buildings and not a random touching/near one.

I think it's the very first line which may be wrong:
  • Set TempGroup = (Units within 196.00 of (Position of (Triggering unit)) matching ((((Unit-type of (Matching unit)) Equal to Repair Factory) or ((Point-value of (Matching unit)) Equal to 50)) and ((Custom value of (Matching unit)) Equal to 0)))
When I used your debug method I didn't get ANY messages, with all of them being after that.. Very strange..

Also I PM'd you, if you didn't see it yet.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Just a week ago I was thinking of making a system that does just this... maybe I still will.

Anyway, in your first line, the only condition you need is
  • Set TempGroup = (Units within 196.00 of (Position of (Triggering unit)) matching ((((Unit-type of (Matching unit)) Equal to Repair Factory)
Further, I'd rather use a dummy building and order it to construct than using an item.
 
Level 2
Joined
May 21, 2013
Messages
17
Just a week ago I was thinking of making a system that does just this... maybe I still will.

Anyway, in your first line, the only condition you need is
  • Set TempGroup = (Units within 196.00 of (Position of (Triggering unit)) matching ((((Unit-type of (Matching unit)) Equal to Repair Factory)
Further, I'd rather use a dummy building and order it to construct than using an item.

Just tried that and it still doesn't work >.>!

What the hell is wrong haha!
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
I've had success with this trigger:
  • Upgrade
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Guard Tower
    • Actions
      • -------- find farm --------
      • Set loc1 = (Position of (Triggering unit))
      • Set group1 = (Units within 364.00 of loc1)
      • Unit Group - Pick every unit in group1 and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Farm
            • Then - Actions
              • Set unit1 = (Picked unit)
            • Else - Actions
      • Custom script: call DestroyGroup(udg_group1)
      • Custom script: call RemoveLocation(udg_loc1)
      • -------- check towers --------
      • Set loc1 = (Position of unit1)
      • Set group1 = (Units within 364.00 of loc1)
      • Unit Group - Pick every unit in group1 and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Not equal to Guard Tower
            • Then - Actions
              • Unit Group - Remove (Picked unit) from group1
            • Else - Actions
      • Game - Display to (All players) the text: (units in group: + (String((Number of units in group1))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in group1) Equal to 8
        • Then - Actions
          • Unit Group - Pick every unit in group1 and do (Actions)
            • Loop - Actions
              • Unit - Remove (Picked unit) from the game
          • Unit - Replace unit1 with a Town Hall using The old unit's relative life and mana
        • Else - Actions
      • Custom script: call DestroyGroup(udg_group1)
      • Custom script: call RemoveLocation(udg_loc1)
 
Level 2
Joined
May 21, 2013
Messages
17
Edit:

The trigger works 100%

I can't thank you enough!

Sorry for asking so many questions btw..
 
Last edited:
Status
Not open for further replies.
Top