Grid + Range Indicator!

Status
Not open for further replies.
Level 11
Joined
Jun 20, 2017
Messages
380
Hello, I have 3 problems with this system!

1. As you can see in the picture below, the gird is not centerd! I want those marked areas in the image not to be counted(white one).
2. When I upgraded the range of my tower, its upgrade is not added to it! therefore, its range does not change!
3. If I turn off the Check Tower Range trigger, the Check Aura Range will work! same thing work opposite! (I guess I'll have to create another channel ability for the other one!).

Also tell/point me if there is something unnecessary I should remove! to summarize the trigger.
  • Check Tower Range
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(submerge))
      • (Level of Grid (On - Self) for (Ordered unit)) Equal to 1
    • Actions
      • Set VariableSet TriggeringUnit = (Triggering unit)
      • Set VariableSet Point_TowerRange = (Position of TriggeringUnit)
      • Set VariableSet Integer_TowerRangeIndex = (Integer_TowerRangeIndex + 1)
      • Set VariableSet Integer_TowerRangeUpgrade = (Current research level of Long Rifles[custom] for (Owner of TriggeringUnit))
      • Set VariableSet GridNumber = (Player number of (Owner of (Ordered unit)))
      • Set VariableSet GridHost[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Player(GridNumber)).) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Grid (On - Self) for (Picked unit) to 2
          • Unit - Set level of Grid (On - Target) for (Picked unit) to 2
          • Unit - Set level of Grid (Off) for (Picked unit) to 2
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of TriggeringUnit) Equal to Guard Tower
        • Then - Actions
          • -------- Add the TowerRangeSize + CollisionSize for efficiency --------
          • Set VariableSet Reals_TowerRangeSize[Integer_TowerRangeIndex] = 400.00
          • Set VariableSet Reals_CollisionSize[Integer_TowerRangeIndex] = 72.00
          • Set VariableSet Real_TotalTowerRange = ((Reals_TowerRangeSize[Integer_TowerRangeIndex] + Reals_CollisionSize[Integer_TowerRangeIndex]) + (Real(Integer_TowerRangeUpgrade)))
          • -------- --------
          • Unit - Create 1 Check Range [Dummy] for (Owner of TriggeringUnit) at Point_TowerRange facing Default building facing degrees
          • Set VariableSet LastCreatedUnit = (Last created unit)
          • Animation - Change LastCreatedUnit's size to ((Real_TotalTowerRange x 2.00)%, (Real_TotalTowerRange x 2.00)%, 100.00%) of its original size
        • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of TriggeringUnit) Equal to Cannon Tower
        • Then - Actions
          • -------- Add the TowerRangeSize + CollisionSize for efficiency --------
          • Set VariableSet Reals_TowerRangeSize[Integer_TowerRangeIndex] = 600.00
          • Set VariableSet Reals_CollisionSize[Integer_TowerRangeIndex] = 72.00
          • Set VariableSet Real_TotalTowerRange = ((Reals_TowerRangeSize[Integer_TowerRangeIndex] + Reals_CollisionSize[Integer_TowerRangeIndex]) + (Real(Integer_TowerRangeUpgrade)))
          • -------- --------
          • Unit - Create 1 Check Range [Dummy] for (Owner of TriggeringUnit) at Point_TowerRange facing Default building facing degrees
          • Set VariableSet LastCreatedUnit = (Last created unit)
          • Animation - Change LastCreatedUnit's size to ((Real_TotalTowerRange x 2.00)%, (Real_TotalTowerRange x 2.00)%, 100.00%) of its original size
        • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of TriggeringUnit) Equal to Arcane Tower
        • Then - Actions
          • -------- Add the TowerRangeSize + CollisionSize for efficiency --------
          • Set VariableSet Reals_TowerRangeSize[Integer_TowerRangeIndex] = 800.00
          • Set VariableSet Reals_CollisionSize[Integer_TowerRangeIndex] = 72.00
          • Set VariableSet Real_TotalTowerRange = ((Reals_TowerRangeSize[Integer_TowerRangeIndex] + Reals_CollisionSize[Integer_TowerRangeIndex]) + (Real(Integer_TowerRangeUpgrade)))
          • -------- --------
          • Unit - Create 1 Check Range [Dummy] for (Owner of TriggeringUnit) at Point_TowerRange facing Default building facing degrees
          • Set VariableSet LastCreatedUnit = (Last created unit)
          • Animation - Change LastCreatedUnit's size to ((Real_TotalTowerRange x 2.00)%, (Real_TotalTowerRange x 2.00)%, 100.00%) of its original size
        • Else - Actions
      • -------- --------
      • Custom script: call RemoveLocation(udg_Point_TowerRange)
  • Tower Range Upgrade
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Long Rifles[custom]
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) 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 Guard Tower
            • Then - Actions
              • Unit - Set (Picked unit) acquisition range to ((Current acquisition range of (Picked unit)) + (Real((Current research level of Long Rifles[custom] for (Owner of (Picked unit))))))
              • Animation - Change LastCreatedUnit's size to ((((Current acquisition range of (Picked unit)) + ((Collision Size of (Picked unit)) + (Real((Current research level of Long Rifles[custom] for (Owner of (Picked unit))))))) x 2.00)%, (((Current acquisition range of (Picked unit)) + ((Collision Size of (Picked unit)) + (Real((Current research level of Long Rifles[custom] for (Owner of (Picked unit))))))) x 2.00)%, 100.00%) of its original size
            • Else - Actions
  • Check Aura Range
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(submerge))
      • (Level of Grid (On - Self) for (Ordered unit)) Equal to 1
    • Actions
      • Set VariableSet TriggeringUnit = (Triggering unit)
      • Set VariableSet Point_AuraRange = (Position of TriggeringUnit)
      • Set VariableSet Integer_AuraRangeIndex = (Integer_AuraRangeIndex + 1)
      • Set VariableSet GridNumber = (Player number of (Owner of (Ordered unit)))
      • Set VariableSet GridHost[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Player(GridNumber)).) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Grid (On - Self) for (Picked unit) to 2
          • Unit - Set level of Grid (On - Target) for (Picked unit) to 2
          • Unit - Set level of Grid (Off) for (Picked unit) to 2
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Devotion Aura [Custom] for TriggeringUnit) Equal to 1
        • Then - Actions
          • -------- Add the AuraRangeSize for efficiency --------
          • Set VariableSet Reals_AuraRangeSize[Integer_AuraRangeIndex] = 300.00
          • Set VariableSet Real_TotalAuraRange = (Reals_AuraRangeSize[Integer_AuraRangeIndex] x 2.00)
          • -------- --------
          • Unit - Create 1 Check Range [Dummy] for (Owner of TriggeringUnit) at Point_AuraRange facing Default building facing degrees
          • Set VariableSet LastCreatedUnit = (Last created unit)
          • Animation - Change LastCreatedUnit's size to (Real_TotalAuraRange%, Real_TotalAuraRange%, 100.00%) of its original size
          • Animation - Change LastCreatedUnit's vertex coloring to (0.00%, 0.00%, 0.00%) with 0.00% transparency
        • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Devotion Aura [Custom] for TriggeringUnit) Equal to 2
        • Then - Actions
          • -------- Add the AuraRangeSize for efficiency --------
          • Set VariableSet Reals_AuraRangeSize[Integer_AuraRangeIndex] = 500.00
          • Set VariableSet Real_TotalAuraRange = (Reals_AuraRangeSize[Integer_AuraRangeIndex] x 2.00)
          • -------- --------
          • Unit - Create 1 Check Range [Dummy] for (Owner of TriggeringUnit) at Point_AuraRange facing Default building facing degrees
          • Set VariableSet LastCreatedUnit = (Last created unit)
          • Animation - Change LastCreatedUnit's size to (Real_TotalAuraRange%, Real_TotalAuraRange%, 100.00%) of its original size
          • Animation - Change LastCreatedUnit's vertex coloring to (0.00%, 0.00%, 0.00%) with 0.00% transparency
        • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Devotion Aura [Custom] for TriggeringUnit) Equal to 3
        • Then - Actions
          • -------- Add the AuraRangeSize for efficiency --------
          • Set VariableSet Reals_AuraRangeSize[Integer_AuraRangeIndex] = 700.00
          • Set VariableSet Real_TotalAuraRange = (Reals_AuraRangeSize[Integer_AuraRangeIndex] x 2.00)
          • -------- --------
          • Unit - Create 1 Check Range [Dummy] for (Owner of TriggeringUnit) at Point_AuraRange facing Default building facing degrees
          • Set VariableSet LastCreatedUnit = (Last created unit)
          • Animation - Change LastCreatedUnit's size to (Real_TotalAuraRange%, Real_TotalAuraRange%, 100.00%) of its original size
          • Animation - Change LastCreatedUnit's vertex coloring to (0.00%, 0.00%, 0.00%) with 0.00% transparency
        • Else - Actions
      • -------- --------
      • Custom script: call RemoveLocation(udg_Point_AuraRange)
  • GridInit
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • -------- Color choices% (Red, Green, Blue, Opacity) --------
      • -------- Buildable (White - GridColorPathBuildable) --------
      • Set VariableSet GridColorR[0] = 100.00
      • Set VariableSet GridColorG[0] = 100.00
      • Set VariableSet GridColorB[0] = 100.00
      • Set VariableSet GridColorO[0] = 0.00
      • -------- --------
      • -------- Unbuildable (Red - GridColorPathUnbuildable) --------
      • Set VariableSet GridColorR[1] = 100.00
      • Set VariableSet GridColorG[1] = 0.00
      • Set VariableSet GridColorB[1] = 0.00
      • Set VariableSet GridColorO[1] = 0.00
      • -------- --------
      • -------- Shallow water (Cyan - GridColorPathShallow) --------
      • Set VariableSet GridColorR[2] = 0.00
      • Set VariableSet GridColorG[2] = 100.00
      • Set VariableSet GridColorB[2] = 100.00
      • Set VariableSet GridColorO[2] = 0.00
      • -------- --------
      • -------- Deep water (Purple - GridColorPathDeep) --------
      • Set VariableSet GridColorR[3] = 100.00
      • Set VariableSet GridColorG[3] = 0.00
      • Set VariableSet GridColorB[3] = 100.00
      • Set VariableSet GridColorO[3] = 0.00
      • -------- --------
      • -------- Color picker (0-5 choosing from above defined colors) --------
      • Set VariableSet GridColorPathBuildable = 0
      • Set VariableSet GridColorPathUnbuildable = 1
      • Set VariableSet GridColorPathShallow = 2
      • Set VariableSet GridColorPathDeep = 3
      • -------- End of color section --------
      • -------- --------
      • Set VariableSet GridMaxPlayer = 24
      • Set VariableSet GridMaxSizeX = 8
      • Set VariableSet GridMaxSizeY = 8
      • Set VariableSet GridRectSize = (GridMaxSizeX x GridMaxSizeY)
      • Set VariableSet GridPos = (Center of (Playable map area))
      • -------- --------
      • Hashtable - Create a hashtable
      • Set VariableSet GridImagesHash = (Last created hashtable)
      • -------- --------
      • For each (Integer GridNumber) from 1 to GridMaxPlayer, do (Actions)
        • Loop - Actions
          • Set VariableSet GridSubPos = (GridPos offset by ((0.00 - ((X of GridSubPos) mod 128.00)), (0.00 - ((Y of GridSubPos) mod 128.00))))
          • -------- --------
          • For each (Integer GridHashLoop) from 0 to (GridRectSize - 1), do (Actions)
            • Loop - Actions
              • Set VariableSet GridCoorX = ((GridHashLoop mod GridMaxSizeX) - (GridMaxSizeX / 2))
              • Set VariableSet GridCoorY = (((GridHashLoop - (GridHashLoop mod GridMaxSizeX)) / GridMaxSizeX) - (GridMaxSizeY / 2))
              • Set VariableSet GridPos = (GridSubPos offset by ((128.00 x (Real(GridCoorX))), (128.00 x (Real(GridCoorY)))))
              • -------- --------
              • Image - Create an image using war3mapImported\Grid64.blp of size 128.00 at GridPos with Z offset 0.00 using image type Occlusion Mark
              • Hashtable - Save Handle Of(Last created image) as GridNumber of GridHashLoop in GridImagesHash.
              • Image - Change (Load GridNumber of GridHashLoop in GridImagesHash.): Enable render always state
              • Image - Hide (Load GridNumber of GridHashLoop in GridImagesHash.)
              • -------- --------
              • Custom script: call RemoveLocation(udg_GridPos)
          • -------- --------
          • Custom script: call RemoveLocation(udg_GridSubPos)
      • -------- --------
      • Custom script: call RemoveLocation(udg_GridPos)
  • GridOnPoint
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(submerge))
      • (Level of Grid (On - Target) for (Ordered unit)) Equal to 1
    • Actions
      • Set VariableSet GridNumber = (Player number of (Owner of (Ordered unit)))
      • Set VariableSet GridHost[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Player(GridNumber)).) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Grid (On - Target) for (Picked unit) to 2
          • Unit - Set level of Grid (On - Self) for (Picked unit) to 2
          • Unit - Set level of Grid (Off) for (Picked unit) to 2
      • -------- --------
      • Set VariableSet GridPos = (Target point of issued order)
      • Set VariableSet GridSubPos = (GridPos offset by ((0.00 - ((X of GridPos) mod 128.00)), (0.00 - ((Y of GridPos) mod 128.00))))
      • -------- --------
      • For each (Integer GridHashLoop) from 0 to (GridRectSize - 1), do (Actions)
        • Loop - Actions
          • Set VariableSet GridCoorX = ((GridHashLoop mod GridMaxSizeX) - (GridMaxSizeX / 2))
          • Set VariableSet GridCoorY = (((GridHashLoop - (GridHashLoop mod GridMaxSizeX)) / GridMaxSizeX) - (GridMaxSizeY / 2))
          • Set VariableSet GridPos = (GridSubPos offset by ((128.00 x (Real(GridCoorX))), (128.00 x (Real(GridCoorY)))))
          • -------- --------
          • Image - Change the position of (Load GridNumber of GridHashLoop in GridImagesHash.) to GridPos with Z offset 0.00
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain pathing at GridPos of type Buildability is off) Equal to False
            • Then - Actions
              • Set VariableSet GridColorIndex = GridColorPathBuildable
            • Else - Actions
              • Set VariableSet GridColorIndex = GridColorPathUnbuildable
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Terrain pathing at GridPos of type Floatability is off) Equal to False
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Terrain pathing at GridPos of type Walkability is off) Equal to False
                    • Then - Actions
                      • Set VariableSet GridColorIndex = GridColorPathShallow
                    • Else - Actions
                      • Set VariableSet GridColorIndex = GridColorPathDeep
                • Else - Actions
          • -------- --------
          • Image - Change the color of (Load GridNumber of GridHashLoop in GridImagesHash.) to (GridColorR[GridColorIndex]%, GridColorG[GridColorIndex]%, GridColorB[GridColorIndex]%) with GridColorO[GridColorIndex]% transparency
          • Image - Change the position of (Load GridNumber of GridHashLoop in GridImagesHash.) to GridPos with Z offset 0.00
          • Image - Change (Load GridNumber of GridHashLoop in GridImagesHash.): Enable render always state
          • Image - Show (Load GridNumber of GridHashLoop in GridImagesHash.)
          • -------- --------
          • Custom script: call RemoveLocation(udg_GridPos)
      • -------- --------
      • Custom script: call RemoveLocation(udg_GridPos)
      • Custom script: call RemoveLocation(udg_GridSubPos)
  • GridOff
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(unsubmerge))
      • (Level of Grid (Off) for (Ordered unit)) Equal to 2
    • Actions
      • Set VariableSet GridNumber = (Player number of (Owner of (Ordered unit)))
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Player(GridNumber)).) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Grid (On - Target) for (Picked unit) to 1
          • Unit - Set level of Grid (On - Self) for (Picked unit) to 1
          • Unit - Set level of Grid (Off) for (Picked unit) to 1
      • -------- --------
      • For each (Integer GridHashLoop) from 0 to (GridRectSize - 1), do (Actions)
        • Loop - Actions
          • Image - Hide (Load GridNumber of GridHashLoop in GridImagesHash.)
      • -------- --------
      • Unit - Kill LastCreatedUnit
      • Unit - Remove LastCreatedUnit from the game
  • GridHostDies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Dying unit) Equal to GridHost[(Player number of (Owner of (Dying unit)))]
    • Actions
      • Set VariableSet GridNumber = (Player number of (Owner of (Dying unit)))
      • -------- --------
      • Custom script: call RemoveLocation(udg_GridHostPos[udg_GridNumber])
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Player(GridNumber)).) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Grid (On - Target) for (Picked unit) to 1
          • Unit - Set level of Grid (On - Self) for (Picked unit) to 1
          • Unit - Set level of Grid (Off) for (Picked unit) to 1
      • -------- --------
      • For each (Integer GridHashLoop) from 0 to (GridRectSize - 1), do (Actions)
        • Loop - Actions
          • Image - Hide (Load GridNumber of GridHashLoop in GridImagesHash.)
      • -------- --------
      • Unit - Kill LastCreatedUnit
      • Unit - Remove LastCreatedUnit from the game
      • -------- --------
      • Set VariableSet GridIsOn[GridNumber] = False
 

Attachments

  • Screenshot_6.png
    Screenshot_6.png
    1.6 MB · Views: 52
  • Custom Grid + Range Indicator!.w3m
    41.2 KB · Views: 9
Last edited:
Level 14
Joined
Jan 10, 2023
Messages
247
Hello, I have 3 problems with this system!

1. As you can see in the picture below, the gird is not centerd! I want those marked areas in the image not to be counted(white one).
2. When I upgraded the range of my tower, its upgrade is not added to it! therefore, its range does not change!
3. If I turn off the Check Tower Range trigger, the Check Aura Range will work! same thing work opposite! (I guess I'll have to create another channel ability for the other one!).

Also tell/point me if there is something unnecessary I should remove! to summarize the trigger.
  • Check Tower Range
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(submerge))
      • (Level of Grid (On - Self) for (Ordered unit)) Equal to 1
    • Actions
      • Set VariableSet TriggeringUnit = (Triggering unit)
      • Set VariableSet Point_TowerRange = (Position of TriggeringUnit)
      • Set VariableSet Integer_TowerRangeIndex = (Integer_TowerRangeIndex + 1)
      • Set VariableSet Integer_TowerRangeUpgrade = (Current research level of Long Rifles[custom] for (Owner of TriggeringUnit))
      • Set VariableSet GridNumber = (Player number of (Owner of (Ordered unit)))
      • Set VariableSet GridHost[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Player(GridNumber)).) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Grid (On - Self) for (Picked unit) to 2
          • Unit - Set level of Grid (On - Target) for (Picked unit) to 2
          • Unit - Set level of Grid (Off) for (Picked unit) to 2
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of TriggeringUnit) Equal to Guard Tower
        • Then - Actions
          • -------- Add the TowerRangeSize + CollisionSize for efficiency --------
          • Set VariableSet Reals_TowerRangeSize[Integer_TowerRangeIndex] = 400.00
          • Set VariableSet Reals_CollisionSize[Integer_TowerRangeIndex] = 72.00
          • Set VariableSet Real_TotalTowerRange = ((Reals_TowerRangeSize[Integer_TowerRangeIndex] + Reals_CollisionSize[Integer_TowerRangeIndex]) + (Real(Integer_TowerRangeUpgrade)))
          • -------- --------
          • Unit - Create 1 Check Range [Dummy] for (Owner of TriggeringUnit) at Point_TowerRange facing Default building facing degrees
          • Set VariableSet LastCreatedUnit = (Last created unit)
          • Animation - Change LastCreatedUnit's size to ((Real_TotalTowerRange x 2.00)%, (Real_TotalTowerRange x 2.00)%, 100.00%) of its original size
        • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of TriggeringUnit) Equal to Cannon Tower
        • Then - Actions
          • -------- Add the TowerRangeSize + CollisionSize for efficiency --------
          • Set VariableSet Reals_TowerRangeSize[Integer_TowerRangeIndex] = 600.00
          • Set VariableSet Reals_CollisionSize[Integer_TowerRangeIndex] = 72.00
          • Set VariableSet Real_TotalTowerRange = ((Reals_TowerRangeSize[Integer_TowerRangeIndex] + Reals_CollisionSize[Integer_TowerRangeIndex]) + (Real(Integer_TowerRangeUpgrade)))
          • -------- --------
          • Unit - Create 1 Check Range [Dummy] for (Owner of TriggeringUnit) at Point_TowerRange facing Default building facing degrees
          • Set VariableSet LastCreatedUnit = (Last created unit)
          • Animation - Change LastCreatedUnit's size to ((Real_TotalTowerRange x 2.00)%, (Real_TotalTowerRange x 2.00)%, 100.00%) of its original size
        • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of TriggeringUnit) Equal to Arcane Tower
        • Then - Actions
          • -------- Add the TowerRangeSize + CollisionSize for efficiency --------
          • Set VariableSet Reals_TowerRangeSize[Integer_TowerRangeIndex] = 800.00
          • Set VariableSet Reals_CollisionSize[Integer_TowerRangeIndex] = 72.00
          • Set VariableSet Real_TotalTowerRange = ((Reals_TowerRangeSize[Integer_TowerRangeIndex] + Reals_CollisionSize[Integer_TowerRangeIndex]) + (Real(Integer_TowerRangeUpgrade)))
          • -------- --------
          • Unit - Create 1 Check Range [Dummy] for (Owner of TriggeringUnit) at Point_TowerRange facing Default building facing degrees
          • Set VariableSet LastCreatedUnit = (Last created unit)
          • Animation - Change LastCreatedUnit's size to ((Real_TotalTowerRange x 2.00)%, (Real_TotalTowerRange x 2.00)%, 100.00%) of its original size
        • Else - Actions
      • -------- --------
      • Custom script: call RemoveLocation(udg_Point_TowerRange)
  • Tower Range Upgrade
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Long Rifles[custom]
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) 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 Guard Tower
            • Then - Actions
              • Unit - Set (Picked unit) acquisition range to ((Current acquisition range of (Picked unit)) + (Real((Current research level of Long Rifles[custom] for (Owner of (Picked unit))))))
              • Animation - Change LastCreatedUnit's size to ((((Current acquisition range of (Picked unit)) + ((Collision Size of (Picked unit)) + (Real((Current research level of Long Rifles[custom] for (Owner of (Picked unit))))))) x 2.00)%, (((Current acquisition range of (Picked unit)) + ((Collision Size of (Picked unit)) + (Real((Current research level of Long Rifles[custom] for (Owner of (Picked unit))))))) x 2.00)%, 100.00%) of its original size
            • Else - Actions
  • Check Aura Range
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(submerge))
      • (Level of Grid (On - Self) for (Ordered unit)) Equal to 1
    • Actions
      • Set VariableSet TriggeringUnit = (Triggering unit)
      • Set VariableSet Point_AuraRange = (Position of TriggeringUnit)
      • Set VariableSet Integer_AuraRangeIndex = (Integer_AuraRangeIndex + 1)
      • Set VariableSet GridNumber = (Player number of (Owner of (Ordered unit)))
      • Set VariableSet GridHost[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Player(GridNumber)).) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Grid (On - Self) for (Picked unit) to 2
          • Unit - Set level of Grid (On - Target) for (Picked unit) to 2
          • Unit - Set level of Grid (Off) for (Picked unit) to 2
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Devotion Aura [Custom] for TriggeringUnit) Equal to 1
        • Then - Actions
          • -------- Add the AuraRangeSize for efficiency --------
          • Set VariableSet Reals_AuraRangeSize[Integer_AuraRangeIndex] = 300.00
          • Set VariableSet Real_TotalAuraRange = (Reals_AuraRangeSize[Integer_AuraRangeIndex] x 2.00)
          • -------- --------
          • Unit - Create 1 Check Range [Dummy] for (Owner of TriggeringUnit) at Point_AuraRange facing Default building facing degrees
          • Set VariableSet LastCreatedUnit = (Last created unit)
          • Animation - Change LastCreatedUnit's size to (Real_TotalAuraRange%, Real_TotalAuraRange%, 100.00%) of its original size
          • Animation - Change LastCreatedUnit's vertex coloring to (0.00%, 0.00%, 0.00%) with 0.00% transparency
        • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Devotion Aura [Custom] for TriggeringUnit) Equal to 2
        • Then - Actions
          • -------- Add the AuraRangeSize for efficiency --------
          • Set VariableSet Reals_AuraRangeSize[Integer_AuraRangeIndex] = 500.00
          • Set VariableSet Real_TotalAuraRange = (Reals_AuraRangeSize[Integer_AuraRangeIndex] x 2.00)
          • -------- --------
          • Unit - Create 1 Check Range [Dummy] for (Owner of TriggeringUnit) at Point_AuraRange facing Default building facing degrees
          • Set VariableSet LastCreatedUnit = (Last created unit)
          • Animation - Change LastCreatedUnit's size to (Real_TotalAuraRange%, Real_TotalAuraRange%, 100.00%) of its original size
          • Animation - Change LastCreatedUnit's vertex coloring to (0.00%, 0.00%, 0.00%) with 0.00% transparency
        • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Devotion Aura [Custom] for TriggeringUnit) Equal to 3
        • Then - Actions
          • -------- Add the AuraRangeSize for efficiency --------
          • Set VariableSet Reals_AuraRangeSize[Integer_AuraRangeIndex] = 700.00
          • Set VariableSet Real_TotalAuraRange = (Reals_AuraRangeSize[Integer_AuraRangeIndex] x 2.00)
          • -------- --------
          • Unit - Create 1 Check Range [Dummy] for (Owner of TriggeringUnit) at Point_AuraRange facing Default building facing degrees
          • Set VariableSet LastCreatedUnit = (Last created unit)
          • Animation - Change LastCreatedUnit's size to (Real_TotalAuraRange%, Real_TotalAuraRange%, 100.00%) of its original size
          • Animation - Change LastCreatedUnit's vertex coloring to (0.00%, 0.00%, 0.00%) with 0.00% transparency
        • Else - Actions
      • -------- --------
      • Custom script: call RemoveLocation(udg_Point_AuraRange)
  • GridInit
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • -------- Color choices% (Red, Green, Blue, Opacity) --------
      • -------- Buildable (White - GridColorPathBuildable) --------
      • Set VariableSet GridColorR[0] = 100.00
      • Set VariableSet GridColorG[0] = 100.00
      • Set VariableSet GridColorB[0] = 100.00
      • Set VariableSet GridColorO[0] = 0.00
      • -------- --------
      • -------- Unbuildable (Red - GridColorPathUnbuildable) --------
      • Set VariableSet GridColorR[1] = 100.00
      • Set VariableSet GridColorG[1] = 0.00
      • Set VariableSet GridColorB[1] = 0.00
      • Set VariableSet GridColorO[1] = 0.00
      • -------- --------
      • -------- Shallow water (Cyan - GridColorPathShallow) --------
      • Set VariableSet GridColorR[2] = 0.00
      • Set VariableSet GridColorG[2] = 100.00
      • Set VariableSet GridColorB[2] = 100.00
      • Set VariableSet GridColorO[2] = 0.00
      • -------- --------
      • -------- Deep water (Purple - GridColorPathDeep) --------
      • Set VariableSet GridColorR[3] = 100.00
      • Set VariableSet GridColorG[3] = 0.00
      • Set VariableSet GridColorB[3] = 100.00
      • Set VariableSet GridColorO[3] = 0.00
      • -------- --------
      • -------- Color picker (0-5 choosing from above defined colors) --------
      • Set VariableSet GridColorPathBuildable = 0
      • Set VariableSet GridColorPathUnbuildable = 1
      • Set VariableSet GridColorPathShallow = 2
      • Set VariableSet GridColorPathDeep = 3
      • -------- End of color section --------
      • -------- --------
      • Set VariableSet GridMaxPlayer = 24
      • Set VariableSet GridMaxSizeX = 8
      • Set VariableSet GridMaxSizeY = 8
      • Set VariableSet GridRectSize = (GridMaxSizeX x GridMaxSizeY)
      • Set VariableSet GridPos = (Center of (Playable map area))
      • -------- --------
      • Hashtable - Create a hashtable
      • Set VariableSet GridImagesHash = (Last created hashtable)
      • -------- --------
      • For each (Integer GridNumber) from 1 to GridMaxPlayer, do (Actions)
        • Loop - Actions
          • Set VariableSet GridSubPos = (GridPos offset by ((0.00 - ((X of GridSubPos) mod 128.00)), (0.00 - ((Y of GridSubPos) mod 128.00))))
          • -------- --------
          • For each (Integer GridHashLoop) from 0 to (GridRectSize - 1), do (Actions)
            • Loop - Actions
              • Set VariableSet GridCoorX = ((GridHashLoop mod GridMaxSizeX) - (GridMaxSizeX / 2))
              • Set VariableSet GridCoorY = (((GridHashLoop - (GridHashLoop mod GridMaxSizeX)) / GridMaxSizeX) - (GridMaxSizeY / 2))
              • Set VariableSet GridPos = (GridSubPos offset by ((128.00 x (Real(GridCoorX))), (128.00 x (Real(GridCoorY)))))
              • -------- --------
              • Image - Create an image using war3mapImported\Grid64.blp of size 128.00 at GridPos with Z offset 0.00 using image type Occlusion Mark
              • Hashtable - Save Handle Of(Last created image) as GridNumber of GridHashLoop in GridImagesHash.
              • Image - Change (Load GridNumber of GridHashLoop in GridImagesHash.): Enable render always state
              • Image - Hide (Load GridNumber of GridHashLoop in GridImagesHash.)
              • -------- --------
              • Custom script: call RemoveLocation(udg_GridPos)
          • -------- --------
          • Custom script: call RemoveLocation(udg_GridSubPos)
      • -------- --------
      • Custom script: call RemoveLocation(udg_GridPos)
  • GridOnPoint
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(submerge))
      • (Level of Grid (On - Target) for (Ordered unit)) Equal to 1
    • Actions
      • Set VariableSet GridNumber = (Player number of (Owner of (Ordered unit)))
      • Set VariableSet GridHost[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Player(GridNumber)).) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Grid (On - Target) for (Picked unit) to 2
          • Unit - Set level of Grid (On - Self) for (Picked unit) to 2
          • Unit - Set level of Grid (Off) for (Picked unit) to 2
      • -------- --------
      • Set VariableSet GridPos = (Target point of issued order)
      • Set VariableSet GridSubPos = (GridPos offset by ((0.00 - ((X of GridPos) mod 128.00)), (0.00 - ((Y of GridPos) mod 128.00))))
      • -------- --------
      • For each (Integer GridHashLoop) from 0 to (GridRectSize - 1), do (Actions)
        • Loop - Actions
          • Set VariableSet GridCoorX = ((GridHashLoop mod GridMaxSizeX) - (GridMaxSizeX / 2))
          • Set VariableSet GridCoorY = (((GridHashLoop - (GridHashLoop mod GridMaxSizeX)) / GridMaxSizeX) - (GridMaxSizeY / 2))
          • Set VariableSet GridPos = (GridSubPos offset by ((128.00 x (Real(GridCoorX))), (128.00 x (Real(GridCoorY)))))
          • -------- --------
          • Image - Change the position of (Load GridNumber of GridHashLoop in GridImagesHash.) to GridPos with Z offset 0.00
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain pathing at GridPos of type Buildability is off) Equal to False
            • Then - Actions
              • Set VariableSet GridColorIndex = GridColorPathBuildable
            • Else - Actions
              • Set VariableSet GridColorIndex = GridColorPathUnbuildable
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Terrain pathing at GridPos of type Floatability is off) Equal to False
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Terrain pathing at GridPos of type Walkability is off) Equal to False
                    • Then - Actions
                      • Set VariableSet GridColorIndex = GridColorPathShallow
                    • Else - Actions
                      • Set VariableSet GridColorIndex = GridColorPathDeep
                • Else - Actions
          • -------- --------
          • Image - Change the color of (Load GridNumber of GridHashLoop in GridImagesHash.) to (GridColorR[GridColorIndex]%, GridColorG[GridColorIndex]%, GridColorB[GridColorIndex]%) with GridColorO[GridColorIndex]% transparency
          • Image - Change the position of (Load GridNumber of GridHashLoop in GridImagesHash.) to GridPos with Z offset 0.00
          • Image - Change (Load GridNumber of GridHashLoop in GridImagesHash.): Enable render always state
          • Image - Show (Load GridNumber of GridHashLoop in GridImagesHash.)
          • -------- --------
          • Custom script: call RemoveLocation(udg_GridPos)
      • -------- --------
      • Custom script: call RemoveLocation(udg_GridPos)
      • Custom script: call RemoveLocation(udg_GridSubPos)
  • GridOff
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(unsubmerge))
      • (Level of Grid (Off) for (Ordered unit)) Equal to 2
    • Actions
      • Set VariableSet GridNumber = (Player number of (Owner of (Ordered unit)))
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Player(GridNumber)).) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Grid (On - Target) for (Picked unit) to 1
          • Unit - Set level of Grid (On - Self) for (Picked unit) to 1
          • Unit - Set level of Grid (Off) for (Picked unit) to 1
      • -------- --------
      • For each (Integer GridHashLoop) from 0 to (GridRectSize - 1), do (Actions)
        • Loop - Actions
          • Image - Hide (Load GridNumber of GridHashLoop in GridImagesHash.)
      • -------- --------
      • Unit - Kill LastCreatedUnit
      • Unit - Remove LastCreatedUnit from the game
  • GridHostDies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Dying unit) Equal to GridHost[(Player number of (Owner of (Dying unit)))]
    • Actions
      • Set VariableSet GridNumber = (Player number of (Owner of (Dying unit)))
      • -------- --------
      • Custom script: call RemoveLocation(udg_GridHostPos[udg_GridNumber])
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Player(GridNumber)).) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Grid (On - Target) for (Picked unit) to 1
          • Unit - Set level of Grid (On - Self) for (Picked unit) to 1
          • Unit - Set level of Grid (Off) for (Picked unit) to 1
      • -------- --------
      • For each (Integer GridHashLoop) from 0 to (GridRectSize - 1), do (Actions)
        • Loop - Actions
          • Image - Hide (Load GridNumber of GridHashLoop in GridImagesHash.)
      • -------- --------
      • Unit - Kill LastCreatedUnit
      • Unit - Remove LastCreatedUnit from the game
      • -------- --------
      • Set VariableSet GridIsOn[GridNumber] = False
Well that looks familiar! I saw the message and will take a look starting tuesday.

I know when I wrote it I was considering buildings that have a pathing size of 64*[EVEN#]x64*[EVEN#] (like a farm) and also buildings with a pathing size of 64*[ODD#]x64*[ODD#] (like an altar) I needed to offset the grid by 32 distance units from the unit's center in order for the grid to line up.

I'm thinking the solution has to do with that, since it does look like buildings are in the picture, I think I must have some bad math for when it is targeting the ground, it should be quick once I look at since I'm familiar with the triggers.
 
Level 14
Joined
Jan 10, 2023
Messages
247
Hello pal, I have 3 solutions to these systems, which I totally made as two separate systems.

This was a big part of the issue and also gave me a headache until I boiled it down.
I don't want to make a big deal out of it, but if you're going to fuse two systems like this, you really have to take the time to understand them each, in the future, I'm not sure I would bother to help with such a problem, I only say that because to get help I really think you need to put in a considerable effort and this sort of thing will deter people quick.

Anyway here are your solutions listed
  1. This problem is unavoidable if you want the tiles to be 128x128, pathing uses 64x64 'tiles' when it comes to placing buildings and so unless you make the grid tiles equal or higher resolution than the pathing 'tiles' you won't be able to express them. It's like saying, what is four minus one, but instead of giving the exact answer, tell me the nearest even number. You will never get three, only ever two or four. I made a picture to demonstrate that I will show further down in this post.
  2. This part I gutted and remade. You don't need to worry about the long rifles upgrade value. When a unit is upgraded, it's range changes. So I got rid of everything related to tracking long-rifle range increases and simply added a trigger to hide, re-evaluate, and then show the range again.
  3. There was never any reason for these triggers to be separated, other than (inefficient) preference. I'm not sure why it didn't work, and I don't care because IMO if you have one event, there should be one trigger (excluding some circumstances that I don't think you'll be running in to any time soon, I would be happy to explain this at another time). These are now one trigger that uses conditions to determine which actions to take. Anyway, this works now.


Triggers:
GridInit:
  • GridInit
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • -------- Color choices% (Red, Green, Blue, Opacity) --------
      • -------- Buildable (White - GridColorPathBuildable) --------
      • Set VariableSet GridColorR[0] = 100.00
      • Set VariableSet GridColorG[0] = 100.00
      • Set VariableSet GridColorB[0] = 100.00
      • Set VariableSet GridColorO[0] = 0.00
      • -------- --------
      • -------- Unbuildable (Red - GridColorPathUnbuildable) --------
      • Set VariableSet GridColorR[1] = 100.00
      • Set VariableSet GridColorG[1] = 0.00
      • Set VariableSet GridColorB[1] = 0.00
      • Set VariableSet GridColorO[1] = 0.00
      • -------- --------
      • -------- Shallow water (Cyan - GridColorPathShallow) --------
      • Set VariableSet GridColorR[2] = 0.00
      • Set VariableSet GridColorG[2] = 100.00
      • Set VariableSet GridColorB[2] = 100.00
      • Set VariableSet GridColorO[2] = 0.00
      • -------- --------
      • -------- Deep water (Purple - GridColorPathDeep) --------
      • Set VariableSet GridColorR[3] = 100.00
      • Set VariableSet GridColorG[3] = 0.00
      • Set VariableSet GridColorB[3] = 100.00
      • Set VariableSet GridColorO[3] = 0.00
      • -------- --------
      • -------- Color picker (0-5 choosing from above defined colors) --------
      • Set VariableSet GridColorPathBuildable = 0
      • Set VariableSet GridColorPathUnbuildable = 1
      • Set VariableSet GridColorPathShallow = 2
      • Set VariableSet GridColorPathDeep = 3
      • -------- End of color section --------
      • -------- --------
      • Set VariableSet GridMaxPlayer = 24
      • Set VariableSet GridMaxSizeX = 16
      • Set VariableSet GridMaxSizeY = 16
      • Set VariableSet GridMaxRect = (GridMaxSizeX x GridMaxSizeY)
      • Set VariableSet GridPos = (Center of (Playable map area))
      • -------- --------
      • For each (Integer GridHashLoop) from 0 to (GridMaxRect - 1), do (Actions)
        • Loop - Actions
          • Image - Create an image using war3mapImported\Grid64.blp of size 64.00 at GridPos with Z offset 0.00 using image type Occlusion Mark
          • Set VariableSet GridImage[GridHashLoop] = (Last created image)
          • Image - Change GridImage[GridHashLoop]: Enable render always state
          • Image - Hide GridImage[GridHashLoop]
      • Custom script: call RemoveLocation(udg_GridPos)
GridOnPoint:
  • GridOnPoint
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(submerge))
      • (Level of Grid (On - Target) for (Ordered unit)) Equal to 1
    • Actions
      • Set VariableSet GridNumber = (Player number of (Owner of (Ordered unit)))
      • Set VariableSet GridHost[GridNumber] = (Ordered unit)
      • Set VariableSet GridPos = (Target point of issued order)
      • Trigger - Run ShowGrid <gen> (checking conditions)
GridOnSelf:
  • GridOnSelf
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(submerge))
          • (Level of Grid (On - Self) for (Ordered unit)) Equal to 1
        • Then - Actions
          • Set VariableSet GridNumber = (Player number of (Owner of (Ordered unit)))
          • Set VariableSet GridHost[GridNumber] = (Ordered unit)
          • Trigger - Run ShowRange <gen> (checking conditions)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(unsubmerge))
              • (Level of Grid (Off) for (Ordered unit)) Equal to 2
            • Then - Actions
              • Set VariableSet GridNumber = (Player number of (Owner of (Ordered unit)))
              • Trigger - Run GridAndRangeDestroy <gen> (checking conditions)
            • Else - Actions
GridHostDies:
  • GridHostDies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Dying unit) Equal to GridHost[(Player number of (Owner of (Dying unit)))]
    • Actions
      • Set VariableSet GridNumber = (Player number of (Owner of (Dying unit)))
      • Trigger - Run GridAndRangeDestroy <gen> (checking conditions)
UpgradeRefresh:
  • UpgradeRefresh
    • Events
      • Unit - A unit Finishes research
      • Unit - A unit Learns a skill
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Researched tech-type) Equal to Long Rifles[custom]
          • (Learned Hero Skill) Equal to Devotion Aura [Custom]
      • isGridRangeOn[(Player number of (Owner of (Triggering unit)))] Equal to True
    • Actions
      • Set VariableSet GridNumber = (Player number of (Owner of (Triggering unit)))
      • Trigger - Run GridAndRangeDestroy <gen> (checking conditions)
      • Trigger - Run ShowRange <gen> (checking conditions)
ShowGrid:
  • ShowGrid
    • Events
    • Conditions
    • Actions
      • Set VariableSet isGridRangeOn[GridNumber] = True
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Player(GridNumber)).) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Grid (On - Target) for (Picked unit) to 2
          • Unit - Set level of Grid (On - Self) for (Picked unit) to 2
          • Unit - Set level of Grid (Off) for (Picked unit) to 2
      • Set VariableSet GridSubPos = (GridPos offset by ((0.00 - ((X of GridPos) mod 64.00)), (0.00 - ((Y of GridPos) mod 64.00))))
      • Custom script: call RemoveLocation(udg_GridPos)
      • -------- --------
      • For each (Integer GridHashLoop) from 0 to (GridMaxRect - 1), do (Actions)
        • Loop - Actions
          • Set VariableSet GridCoorX = ((GridHashLoop mod GridMaxSizeX) - (GridMaxSizeX / 2))
          • Set VariableSet GridCoorY = (((GridHashLoop - (GridHashLoop mod GridMaxSizeX)) / GridMaxSizeX) - (GridMaxSizeY / 2))
          • Set VariableSet GridPos = (GridSubPos offset by ((64.00 x (Real(GridCoorX))), (64.00 x (Real(GridCoorY)))))
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain pathing at GridPos of type Buildability is off) Equal to False
            • Then - Actions
              • Set VariableSet GridColorIndex = GridColorPathBuildable
            • Else - Actions
              • Set VariableSet GridColorIndex = GridColorPathUnbuildable
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Terrain pathing at GridPos of type Floatability is off) Equal to False
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Terrain pathing at GridPos of type Walkability is off) Equal to False
                    • Then - Actions
                      • Set VariableSet GridColorIndex = GridColorPathShallow
                    • Else - Actions
                      • Set VariableSet GridColorIndex = GridColorPathDeep
                • Else - Actions
          • -------- --------
          • Custom script: if GetLocalPlayer() == Player( udg_GridNumber - 1) then
          • Image - Change the color of GridImage[GridHashLoop] to (GridColorR[GridColorIndex]%, GridColorG[GridColorIndex]%, GridColorB[GridColorIndex]%) with GridColorO[GridColorIndex]% transparency
          • Image - Change the position of GridImage[GridHashLoop] to GridPos with Z offset 0.00
          • Image - Change GridImage[GridHashLoop]: Enable render always state
          • Image - Show GridImage[GridHashLoop]
          • Custom script: endif
          • -------- --------
          • Custom script: call RemoveLocation(udg_GridPos)
      • -------- --------
      • Custom script: call RemoveLocation(udg_GridSubPos)
ShowRange:
  • ShowRange
    • Events
    • Conditions
    • Actions
      • Set VariableSet isGridRangeOn[GridNumber] = True
      • Set VariableSet Point_RangeTarget = (Position of GridHost[GridNumber])
      • Set VariableSet Real_CollisionSize = (Collision Size of GridHost[GridNumber])
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Player(GridNumber)).) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Grid (On - Self) for (Picked unit) to 2
          • Unit - Set level of Grid (On - Target) for (Picked unit) to 2
          • Unit - Set level of Grid (Off) for (Picked unit) to 2
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of GridHost[GridNumber]) Equal to Guard Tower
              • (Unit-type of GridHost[GridNumber]) Equal to Cannon Tower
              • (Unit-type of GridHost[GridNumber]) Equal to Arcane Tower
        • Then - Actions
          • -------- Add the TowerRangeSize + CollisionSize for efficiency --------
          • Set VariableSet Real_RangeSize = (Unit: GridHost[GridNumber]'s Weapon Real Field: Attack Range ('ua1m') at Index:0)
          • Set VariableSet Real_TotalRange = (Real_RangeSize + Real_CollisionSize)
          • -------- --------
          • Special Effect - Create a special effect at Point_RangeTarget using RangeCircle.mdx
          • Set VariableSet RangeCircle[GridNumber] = (Last created special effect)
          • Custom script: if GetLocalPlayer() != Player(udg_GridNumber - 1) then
          • Special Effect - Set Alpha of RangeCircle[GridNumber] to 0
          • Custom script: endif
          • Special Effect - Set Scale of RangeCircle[GridNumber] to ((Real_TotalRange x 2.00) / 100.00)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Devotion Aura [Custom] for GridHost[GridNumber]) Not equal to 0
        • Then - Actions
          • -------- Add the AuraRangeSize for efficiency --------
          • Set VariableSet Real_RangeSize = (Ability: (Unit: GridHost[GridNumber]'s Ability with Ability Code: Devotion Aura [Custom])'s Real Level Field Area of Effect ('aare'), of Level: ((Level of Devotion Aura [Custom] for GridHost[GridNumber]) - 1))
          • Set VariableSet Real_TotalRange = (Real_RangeSize + Real_CollisionSize)
          • -------- An AoE has an effect range of one-half of the AoE value from the center of the Area. In short, "AoE / 2 = Range". Hence the above AoE is divided by two. --------
          • Special Effect - Create a special effect attached to the origin of GridHost[GridNumber] using RangeCircle.mdx
          • Set VariableSet RangeCircle[GridNumber] = (Last created special effect)
          • Custom script: if GetLocalPlayer() != Player(udg_GridNumber - 1) then
          • Special Effect - Set Alpha of RangeCircle[GridNumber] to 0
          • Custom script: endif
          • Special Effect - Set Scale of RangeCircle[GridNumber] to ((Real_TotalRange x 2.00) / 100.00)
        • Else - Actions
      • -------- --------
      • Custom script: call RemoveLocation(udg_Point_RangeTarget)
GridAndRangeDestroy:
  • GridAndRangeDestroy
    • Events
    • Conditions
    • Actions
      • Set VariableSet isGridRangeOn[GridNumber] = False
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Player(GridNumber)).) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Grid (On - Target) for (Picked unit) to 1
          • Unit - Set level of Grid (On - Self) for (Picked unit) to 1
          • Unit - Set level of Grid (Off) for (Picked unit) to 1
      • Special Effect - Set Scale of RangeCircle[GridNumber] to 0.00
      • Special Effect - Destroy RangeCircle[GridNumber]
      • -------- --------
      • For each (Integer GridHashLoop) from 0 to (GridMaxRect - 1), do (Actions)
        • Loop - Actions
          • Custom script: if GetLocalPlayer() == Player( udg_GridNumber - 1 ) then
          • Image - Hide GridImage[GridHashLoop]
          • Custom script: endif

Back to the point I was making on Problem/Solution 1, hopefully this makes it a lot more clear:
Farms.jpg

Simply put, 128x128 tiles do not reflect the pathing with enough definition to have any solution. I could shift it all, but then you would have the same problem at every other place where pathing is restricted, in fact it would be far worse. The solution is to have tiles that represent the pathing with adequate resolution meaning 64x64 or smaller.



Another thing I want to point out unless it comes up as another 'problem' is the difference that collision size has on the position of a unit.
Take a look at this picture:
Collision Size Map.png


This has to do specifically with non-structure units.
You'll notice, if you haven't already that for the Footman and the Peasant, they have to be more 'in-the-circle' if they are above or toward the right side the range of devotion aura, but when they are to the left or toward the bottom, they can be a little further and still get the effect.

Not so with the Knight, the Rifleman, and the Paladin.

That's because the Knight, the Rifleman, and the Paladin all have a collision size between 32.00 and 47.99, while the Footman and Peasant have a collision size between 16.00 and 31.99.

Notice the difference this has on the unit based on the picture. If you have questions I can answer them here or in a message, but I have to cut this short and get to my buddy's house.

GLHF!
 

Attachments

  • Custom Grid + Range Indicator()!.w3m
    38.8 KB · Views: 11
Last edited:
Level 14
Joined
Jan 10, 2023
Messages
247
So I tested the map and there was only one problem that the aura range had a slight delay like a 5 second delay to be shown!
Yes, I know exactly what you are talking about, but I have a bit to say on it and thought I'd better wait until you saw it...
Anyway, here's the short answer followed by the long answer:

There is this bugginess when it came to the special effects:
A key difference to notice is the difference between special effects that are attached to a unit model and special effects that are not attached to a unit model. That is where I ran into some bugs.

EDIT: The solution provided in the below spoiler section has been tested and is no solution. So far, I have no solution but I can confirm that even with a death animation of 0.020, the circle still takes ~ 5.00 seconds to become available again if it was attached to the unit (in the case of auras in this system). I still think you would be better off keeping the attached special effect because the unit is mobile. However, if this system was to be used with stationary units only, one could simply make the special effect at the location of the unit rather than attached to the unit, thus side-stepping the issue.

I will certainly update you if I find a solution and hopefully someone stumbles along with the answer if there is an easy one.

To save you some time reading: the bug we're seeing here is an easy solution, but it's not trigger related, the solution is to find or make a range circle model for special effect with a short - near zero - death animation duration. I don't know enough about modelling to know if the duration can actually be 0.00, but if so I'd make/ find one like that.



To speak to my experience with this delayed circle bug:

From what I can tell, the game seems to be refusing to show the new special effect attachment until the old special effect attachment is gone... maybe one is on top of the other. I think you'll notice that if the Paladin has had about 5 seconds pass since the last time his range circle is removed, his new circle pops up instantly, the unique thing going on here that the Paladin is getting a special effect attached to its origin, while the towers are just having a special effect made at their location. If you find a model with the shorter animation I would recommend changing the special effects all to be attachments, but these had the buggy behavior, so I wanted to include both possibilities for demonstration.

Normal behavior is that the special effect will finish its animation and then disappear when it is 'destroyed'.
This circle model has a longer death animation than I think we should want, it's 5.00 seconds, but I made the special effect too small to see in order to solve this in the short term/ make the system more flexible about what model could be used, but a circle model with a very short 'death' animation should solve this completely.

Some detail on that bugginess:
The full story is that I first made it so that the special effect would be transparent when it was destroyed so that it could play out its animation invisibly, but this had strange effects when the special effect was attached to a unit, the first attachment didn't disappear for 5 seconds (the death animation's duration) and if another circle was made on the same unit in that 5 second window (if you toggled the ability rapidly) the first circle would expand into a gigantic circle, but the new circle would still be made at the correct size around the unit.

There must be something funny going on here with attached special effects that I really don't want to grapple with when it really seems the real solution is to have a very short death animation.

Because I still wanted some solution to offer for demoing purposes, but did not want to find a circle model with the right death animation length, I noticed this weird sizing problem didn't happen if I made the special effect have a size of 0.00.
The delay bug still exists, but the solution I think is elsewhere, so I opted for resizing the the special effect to hide it in the event of a long death animation, in which case the delay seems unavoidable without greater expertise on special effects and attachments.

Again, the solution I think you want is to find or make a circle model with a death animation duration near zero, or equal to zero if that's a thing... I don't know a ton about modelling...
 
Last edited:
Level 11
Joined
Jun 20, 2017
Messages
380
Hmm... I thought I could create a dummy unit that is attached to a unit! and then set its death time to 0.
Like, you can create a special effect on the unit, but for unit there are 2 similar options where you can create a unit in a place with different faces.

Well, even with 0 death animation, the same problem still exists!
[Solved] - Simple Circle
 
Last edited:
Level 14
Joined
Jan 10, 2023
Messages
247
Hmm... I thought I could create a dummy unit that is attached to a unit! and then set its death time to 0.
Like, you can create a special effect on the unit, but for unit there are 2 similar options where you can create a unit in a place with different faces.

Well, even with 0 death animation, the same problem still exists!
[Solved] - Simple Circle
Yeah I noticed the same thing, sorry for speaking too soon, but it seemed like a sure theory.

There is another option, kind of a nuclear option, but my other thought is to use an image instead of a model.

The downside is that this will require a timer to move the image with the unit, something like every 0.03 seconds it will fire.

I expect it won't slow anything down, it is just moving between 1-(12 or 24) images. When there are no images it will turn off.

Probably could run it every 0.01 seconds with zero lag but I think 0.03 is typical for fluid movement.
 
Status
Not open for further replies.
Top