- Joined
- Mar 27, 2019
- Messages
- 56
Hey folks,
I have a Combine System that works pretty good for the most part, if you have 4 Towers adjacent to each other like this:

It will turn to a bigger Tower that takes the same amount of space. All working good, however if I intend to upgrade 12 Towers in a line like this simultaneously, they won't combine from Top Left to Bottom Right sometimes, depends on how they were built (atleast I think so).
Here is an example what I mean, the red one "-" should not have those normal Towers inbetween them, they should be like the green one "+"

Any way to achieve this easily.
Example Map is downloadable. Here is also the Trigger
I may just add an Decombine Ability to prevent this behaviour, to revert the Mega Tower to Normal ones.
(The Trigger is kinda whacky not really polished, just an prototype)
Any help is highly appreciated!!
I have a Combine System that works pretty good for the most part, if you have 4 Towers adjacent to each other like this:

It will turn to a bigger Tower that takes the same amount of space. All working good, however if I intend to upgrade 12 Towers in a line like this simultaneously, they won't combine from Top Left to Bottom Right sometimes, depends on how they were built (atleast I think so).
Here is an example what I mean, the red one "-" should not have those normal Towers inbetween them, they should be like the green one "+"

Any way to achieve this easily.
Example Map is downloadable. Here is also the Trigger
-
Tower l Mega Tower
-
Events
-
Unit - A unit Finishes an upgrade
-
-
Conditions
-
((Triggering unit) is A town-hall-type unit) Equal to Falsch
-
-
Actions
-
Set VariableSet Temp_Type = Mega Tower
-
-------- Save Upgraded --------
-
Hashtable - Save upgraded as 12 of (Key (Triggering unit).) in Hashtable.
-
Set VariableSet Temp_Boolean = Falsch
-
Set VariableSet Temp_Point = (Position of (Triggering unit))
-
Set VariableSet Temp_Unit = (Triggering unit)
-
-------- Nil every Temp_Dummy --------
-
For each (Integer A) from 0 to 3, do (Actions)
-
Loop - Actions
-
Set VariableSet Temp_Dummy[(Integer A)] = No unit
-
-
-
-------- Top Left --------
-
Set VariableSet Temp_Real = -1.00
-
Set VariableSet Temp_Integer = 0
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Boolean Equal to Falsch
-
-
Then - Actions
-
For each (Integer A) from 1 to 2, do (Actions)
-
Loop - Actions
-
For each (Integer B) from 1 to 2, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Real Equal to -1.00
-
-
Then - Actions
-
-------- Find every Unit in specific Corner --------
-
Set VariableSet Temp_X = ((Real(((Integer A) - 1))) x 128.00)
-
Set VariableSet Temp_Y = ((Real(((Integer B) - 1))) x -128.00)
-
Set VariableSet Temp_Point_2 = (Temp_Point offset by (Temp_X, Temp_Y))
-
Set VariableSet Temp_Group = (Units within 8.00 of Temp_Point_2 matching ((((Matching unit) is alive) Equal to Wahr) and (((Unit-type of (Matching unit)) Equal to (Unit-type of (Triggering unit))) and ((Load 12 of (Key (Matching unit).) from Hashtable.) Equal to upgraded))).)
-
Set VariableSet Temp_Dummy[(((Integer A) x 2) - (Integer B))] = (Random unit from Temp_Group)
-
Set VariableSet Temp_Integer = (Temp_Integer + (Number of units in Temp_Group))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in Temp_Group) Equal to 0
-
-
Then - Actions
-
-------- Cancel if no Unit was found early on --------
-
Set VariableSet Temp_Real = 0.00
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Integer Equal to 4
-
-
Then - Actions
-
-------- All Units found, proceeding to Create Structure --------
-
Set VariableSet Temp_X = 64.00
-
Set VariableSet Temp_Y = -64.00
-
Set VariableSet Temp_Boolean = Wahr
-
-
Else - Actions
-
-
Custom script: call RemoveLocation(udg_Temp_Point_2)
-
Custom script: call DestroyGroup(udg_Temp_Group)
-
-
Else - Actions
-
-
-
-
-
-
-
Else - Actions
-
-
-------- Top Right --------
-
Set VariableSet Temp_Real = -1.00
-
Set VariableSet Temp_Integer = 0
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Boolean Equal to Falsch
-
-
Then - Actions
-
For each (Integer A) from 1 to 2, do (Actions)
-
Loop - Actions
-
For each (Integer B) from 1 to 2, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Real Equal to -1.00
-
-
Then - Actions
-
-------- Find every Unit in specific Corner --------
-
Set VariableSet Temp_X = ((Real(((Integer A) - 1))) x -128.00)
-
Set VariableSet Temp_Y = ((Real(((Integer B) - 1))) x -128.00)
-
Set VariableSet Temp_Point_2 = (Temp_Point offset by (Temp_X, Temp_Y))
-
Set VariableSet Temp_Group = (Units within 8.00 of Temp_Point_2 matching ((((Matching unit) is alive) Equal to Wahr) and (((Unit-type of (Matching unit)) Equal to (Unit-type of (Triggering unit))) and ((Load 12 of (Key (Matching unit).) from Hashtable.) Equal to upgraded))).)
-
Set VariableSet Temp_Integer = (Temp_Integer + (Number of units in Temp_Group))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in Temp_Group) Equal to 0
-
-
Then - Actions
-
-------- Cancel if no Unit was found early on --------
-
Set VariableSet Temp_Real = 0.00
-
-
Else - Actions
-
-
Set VariableSet Temp_Dummy[(((Integer A) x 2) - (Integer B))] = (Random unit from Temp_Group)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_X Equal to -128.00
-
Temp_Y Equal to 0.00
-
-
Then - Actions
-
-------- Set Top Left Unit as Standard Unit --------
-
Set VariableSet Temp_Unit = (Random unit from Temp_Group)
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Integer Equal to 4
-
-
Then - Actions
-
-------- All Units found, proceeding to Create Structure --------
-
Set VariableSet Temp_X = 64.00
-
Set VariableSet Temp_Y = -64.00
-
Set VariableSet Temp_Boolean = Wahr
-
-
Else - Actions
-
-
Custom script: call RemoveLocation(udg_Temp_Point_2)
-
Custom script: call DestroyGroup(udg_Temp_Group)
-
-
Else - Actions
-
-
-
-
-
-
-
Else - Actions
-
-
-------- Bot Left --------
-
Set VariableSet Temp_Real = -1.00
-
Set VariableSet Temp_Integer = 0
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Boolean Equal to Falsch
-
-
Then - Actions
-
For each (Integer A) from 1 to 2, do (Actions)
-
Loop - Actions
-
For each (Integer B) from 1 to 2, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Real Equal to -1.00
-
-
Then - Actions
-
-------- Find every Unit in specific Corner --------
-
Set VariableSet Temp_X = ((Real(((Integer A) - 1))) x 128.00)
-
Set VariableSet Temp_Y = ((Real(((Integer B) - 1))) x 128.00)
-
Set VariableSet Temp_Point_2 = (Temp_Point offset by (Temp_X, Temp_Y))
-
Set VariableSet Temp_Group = (Units within 8.00 of Temp_Point_2 matching ((((Matching unit) is alive) Equal to Wahr) and (((Unit-type of (Matching unit)) Equal to (Unit-type of (Triggering unit))) and ((Load 12 of (Key (Matching unit).) from Hashtable.) Equal to upgraded))).)
-
Set VariableSet Temp_Integer = (Temp_Integer + (Number of units in Temp_Group))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in Temp_Group) Equal to 0
-
-
Then - Actions
-
-------- Cancel if no Unit was found early on --------
-
Set VariableSet Temp_Real = 0.00
-
-
Else - Actions
-
-
Set VariableSet Temp_Dummy[(((Integer A) x 2) - (Integer B))] = (Random unit from Temp_Group)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_X Equal to 0.00
-
Temp_Y Equal to 128.00
-
-
Then - Actions
-
-------- Set Top Left Unit as Standard Unit --------
-
Set VariableSet Temp_Unit = (Random unit from Temp_Group)
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Integer Equal to 4
-
-
Then - Actions
-
-------- All Units found, proceeding to Create Structure --------
-
Set VariableSet Temp_X = 64.00
-
Set VariableSet Temp_Y = -64.00
-
Set VariableSet Temp_Boolean = Wahr
-
-
Else - Actions
-
-
Custom script: call RemoveLocation(udg_Temp_Point_2)
-
Custom script: call DestroyGroup(udg_Temp_Group)
-
-
Else - Actions
-
-
-
-
-
-
-
Else - Actions
-
-
-------- Bot Right --------
-
Set VariableSet Temp_Real = -1.00
-
Set VariableSet Temp_Integer = 0
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Boolean Equal to Falsch
-
-
Then - Actions
-
For each (Integer A) from 1 to 2, do (Actions)
-
Loop - Actions
-
For each (Integer B) from 1 to 2, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Real Equal to -1.00
-
-
Then - Actions
-
-------- Find every Unit in specific Corner --------
-
Set VariableSet Temp_X = ((Real(((Integer A) - 1))) x -128.00)
-
Set VariableSet Temp_Y = ((Real(((Integer B) - 1))) x 128.00)
-
Set VariableSet Temp_Point_2 = (Temp_Point offset by (Temp_X, Temp_Y))
-
Set VariableSet Temp_Group = (Units within 8.00 of Temp_Point_2 matching ((((Matching unit) is alive) Equal to Wahr) and (((Unit-type of (Matching unit)) Equal to (Unit-type of (Triggering unit))) and ((Load 12 of (Key (Matching unit).) from Hashtable.) Equal to upgraded))).)
-
Set VariableSet Temp_Integer = (Temp_Integer + (Number of units in Temp_Group))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in Temp_Group) Equal to 0
-
-
Then - Actions
-
-------- Cancel if no Unit was found early on --------
-
Set VariableSet Temp_Real = 0.00
-
-
Else - Actions
-
-
Set VariableSet Temp_Dummy[(((Integer A) x 2) - (Integer B))] = (Random unit from Temp_Group)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_X Equal to -128.00
-
Temp_Y Equal to 128.00
-
-
Then - Actions
-
-------- Set Top Left Unit as Standard Unit --------
-
Set VariableSet Temp_Unit = (Random unit from Temp_Group)
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Integer Equal to 4
-
-
Then - Actions
-
-------- All Units found, proceeding to Create Structure --------
-
Set VariableSet Temp_X = 64.00
-
Set VariableSet Temp_Y = -64.00
-
Set VariableSet Temp_Boolean = Wahr
-
-
Else - Actions
-
-
Custom script: call RemoveLocation(udg_Temp_Point_2)
-
Custom script: call DestroyGroup(udg_Temp_Group)
-
-
Else - Actions
-
-
-
-
-
-
-
Else - Actions
-
-
-------- - --------
-
-------- Create Structure --------
-
-------- - --------
-
Custom script: call RemoveLocation(udg_Temp_Point)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Boolean Equal to Wahr
-
-
Then - Actions
-
-------- Set Value if Unit is selected --------
-
For each (Integer A) from 0 to 3, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Temp_Dummy[(Integer A)] is selected by (Owner of (Triggering unit)).) Equal to Wahr
-
-
Then - Actions
-
Set VariableSet Temp_Real = -2.00
-
Custom script: exitwhen true
-
-
Else - Actions
-
-
-
-
Set VariableSet Temp_Point = (Position of Temp_Unit)
-
Unit - Hide Temp_Unit
-
-------- Remove all 4x4 Units (except 1) --------
-
For each (Integer A) from 0 to 3, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Unit Not equal to Temp_Dummy[(Integer A)]
-
-
Then - Actions
-
Unit - Remove Temp_Dummy[(Integer A)] from the game
-
-
Else - Actions
-
-
-
-
Set VariableSet Temp_Point_2 = (Temp_Point offset by (Temp_X, Temp_Y))
-
Unit - Create 1 Temp_Type for (Owner of (Triggering unit)) at Temp_Point_2 facing Default building facing degrees
-
Unit - Set Name of (Last created unit) to ([Mega] + (Name of (Triggering unit)))
-
Unit - Set Unit Skin of (Last created unit) to (Skin ID of (Triggering unit))
-
Unit - Set Base Damage of (Last created unit) to (((Base Damage of (Triggering unit) for weapon index 0) x 4) + 3) for weapon index: 0
-
Animation - Change (Last created unit)'s size to (120.00%, 120.00%, 120.00%) of its original size
-
Set VariableSet Temp_Unit = (Last created unit)
-
Custom script: call UnitRemoveAbility(udg_Temp_Unit,'ARal')
-
Set VariableSet Temp_Unit = No unit
-
-------- Get Value if Unit was selected --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Temp_Real Equal to -2.00
-
-
Then - Actions
-
Selection - Add (Last created unit) to selection for (Owner of (Triggering unit))
-
-
Else - Actions
-
-
Unit - Remove Temp_Unit from the game
-
Custom script: call RemoveLocation(udg_Temp_Point)
-
Custom script: call RemoveLocation(udg_Temp_Point_2)
-
-
Else - Actions
-
-
-
-
Tower l ID Complete
-
Events
-
Unit - A unit Begins an upgrade
-
-
Conditions
-
Actions
-
Hashtable - Save upgrading as 12 of (Key (Triggering unit).) in Hashtable.
-
-
-
Tower l ID Cancel
-
Events
-
Unit - A unit Cancels an upgrade
-
-
Conditions
-
Actions
-
Hashtable - Save upgraded as 12 of (Key (Triggering unit).) in Hashtable.
-
-
I may just add an Decombine Ability to prevent this behaviour, to revert the Mega Tower to Normal ones.
(The Trigger is kinda whacky not really polished, just an prototype)
Any help is highly appreciated!!