• 🏆 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] Square Around Point.

Status
Not open for further replies.
Level 12
Joined
Sep 24, 2007
Messages
283
Well really i forgot how to make the square around the target. I dont know really how to explain that but i will show it like that:

;;;;;;;;;;;;;;
;----------;
;----x-----;
;----------;
;;;;;;;;;;;;;;

so x = point
and the " - " is the space... the space in that square. Just nothing >.<
and the " ; " are the dummies. So all created dummies will create a form of square.
thx.
- Nahm
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Here you go:

Old trigger
  • Dummies in Square
    • Events
      • Time - Elapsed game time is 2.00 seconds
    • Conditions
    • Actions
      • -------- --------------------------------------------- --------
      • -------- DEFINE VARIABLES --------
      • -------- --------------------------------------------- --------
      • -------- Center of the square --------
      • Set TempLoc1 = (Center of Rect 016 <gen>)
      • -------- Replace 256 with how far away from the center do you wan the sides to be --------
      • Set TempReal1 = 256.00
      • -------- Number of units per side --------
      • Set TempInt = 4
      • -------- --------------------------------------------- --------
      • -------- DO THE THINGIES --------
      • -------- --------------------------------------------- --------
      • -------- Upper right corner of the square --------
      • Set TempLoc2 = (TempLoc1 offset by (TempReal1, TempReal1))
      • -------- Calculate distance between units --------
      • Set TempReal1 = (2.00 x (TempReal1 / (Real((TempInt - 1)))))
      • -------- Create upper row --------
      • For each (Integer A) from 1 to (TempInt - 1), do (Actions)
        • Loop - Actions
          • Set TempLoc2 = (TempLoc2 offset by ((-1.00 x TempReal1), 0.00))
          • Unit - Create 1 Footman for Player 1 (Red) at TempLoc2 facing Default building facing (270.0) degrees
      • -------- Create left side --------
      • For each (Integer A) from 1 to (TempInt - 1), do (Actions)
        • Loop - Actions
          • Set TempLoc2 = (TempLoc2 offset by (0.00, (-1.00 x TempReal1)))
          • Unit - Create 1 Footman for Player 1 (Red) at TempLoc2 facing Default building facing (270.0) degrees
      • -------- Crete lower row --------
      • For each (Integer A) from 1 to (TempInt - 1), do (Actions)
        • Loop - Actions
          • Set TempLoc2 = (TempLoc2 offset by (TempReal1, 0.00))
          • Unit - Create 1 Footman for Player 1 (Red) at TempLoc2 facing Default building facing (270.0) degrees
      • -------- Create right side --------
      • For each (Integer A) from 1 to (TempInt - 1), do (Actions)
        • Loop - Actions
          • Set TempLoc2 = (TempLoc2 offset by (0.00, TempReal1))
          • Unit - Create 1 Footman for Player 1 (Red) at TempLoc2 facing Default building facing (270.0) degrees
      • Custom script: call RemoveLocation(udg_TempLoc1)
      • Custom script: call RemoveLocation(udg_TempLoc2)
EDIT:
Here's more sophisticated version:

  • Units in Square
    • Events
      • Time - Elapsed game time is 2.00 seconds
    • Conditions
    • Actions
      • -------- DEFINE VARIABLES --------
      • -------- Center of the square --------
      • Set TempLoc1 = (Center of Rect 022 <gen>)
      • -------- Replace 256 with how far away from the center do you wan the sides to be --------
      • Set TempReal1 = 256.00
      • -------- Number of units per side --------
      • Set TempInt = 4
      • -------- -------------------------------- --------
      • -------- DO THE THINGIES --------
      • Set TempLoc2 = (TempLoc1 offset by (TempReal1, TempReal1))
      • Set TempReal2 = (2.00 x (TempReal1 / (Real((TempInt - 1)))))
      • Custom script: call RemoveLocation(udg_TempLoc1)
      • For each (Integer A) from 1 to TempInt, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to TempInt, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • ((1.00 - (Real((Integer A)))) x TempReal2) Equal to 0.00
                      • ((1.00 - (Real((Integer A)))) x TempReal2) Equal to (-2.00 x TempReal1)
                      • ((1.00 - (Real((Integer B)))) x TempReal2) Equal to 0.00
                      • ((1.00 - (Real((Integer B)))) x TempReal2) Equal to (-2.00 x TempReal1)
                • Then - Actions
                  • Set TempLoc1 = (TempLoc2 offset by (((1.00 - (Real((Integer A)))) x TempReal2), ((1.00 - (Real((Integer B)))) x TempReal2)))
                  • Unit - Create 1 Footman for Player 1 (Red) at TempLoc1 facing Default building facing (270.0) degrees
                  • Custom script: call RemoveLocation(udg_TempLoc1)
                • Else - Actions
      • Custom script: call RemoveLocation(udg_TempLoc2)
Should be easy enough to edit.

Though you might still want to use your own variables instead of ForLoopA and ForLoopB, since they may clash with other triggers.
 
Last edited:
Status
Not open for further replies.
Top