[Trigger] loop actions

Status
Not open for further replies.
I'm sorry but I don't know how to make those pretty boxes that look like the trigger editor.
May this be what you seek?


For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
 
  • Comment - 1/4 of the Circle
  • Unit - Order SU1[1] to Move to PointW
  • Unit - Order SU2[2] to Move to PointS
  • Unit - Order SU3[3] to Move to PointE
  • Unit - Order SU4[4] to Move to PointN
  • Comment - 2/4 of the circle
  • Unit - Order SU1[1] to Move to PointS
  • Unit - Order SU2[2] to Move to PointE
  • Unit - Order SU3[3] to Move to PointN
  • Unit - Order SU4[4] to Move to PointW
  • Comment - 3/4 of the circle
  • Unit - Order SU1[1] to Move to PointE
  • Unit - Order SU2[2] to Move to PointN
  • Unit - Order SU3[3] to Move to PointW
  • Unit - Order SU4[4] to Move to PointS
  • Comment - 4/4 of the circle
  • Unit - Order SU1[1] to Move to PointN
  • Unit - Order SU2[2] to Move to PointW
  • Unit - Order SU3[3] to Move to PointS
  • Unit - Order SU4[4] to Move to PointE
 
  • loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Comment - 1/4 of the Circle
      • Unit - Order SU1[1] to Move to PointW
      • Unit - Order SU2[2] to Move to PointS
      • Unit - Order SU3[3] to Move to PointE
      • Unit - Order SU4[4] to Move to PointN
      • Comment - 2/4 of the circle
      • Unit - Order SU1[1] to Move to PointS
      • Unit - Order SU2[2] to Move to PointE
      • Unit - Order SU3[3] to Move to PointN
      • Unit - Order SU4[4] to Move to PointW
      • Comment - 3/4 of the circle
      • Unit - Order SU1[1] to Move to PointE
      • Unit - Order SU2[2] to Move to PointN
      • Unit - Order SU3[3] to Move to PointW
      • Unit - Order SU4[4] to Move to PointS
      • Comment - 4/4 of the circle
      • Unit - Order SU1[1] to Move to PointN
      • Unit - Order SU2[2] to Move to PointW
      • Unit - Order SU3[3] to Move to PointS
      • Unit - Order SU4[4] to Move to PointE
is this what you want?
 
oh...

You want a unit to walk from north to east to south to west to north?

  • Events
    • Unit - a unit enters PointN
  • Conditions
    • Or - any conditions are true
      • Unit - triggering unit is SU1[1]
      • Unit - triggering unit is SU2[2]
      • Unit - triggering unit is SU3[3]
      • Unit - triggering unit is SU4[4]
  • Actions
    • Unit - order entering unit to move to PointE
Make a similar trigger for PointE, PointS and PointW, so they run in circles.

A sidenote: Why are you using arrays?
 
lol making regions are only at one place. they must run around the casting unit, and that can be anywhere. Yes Eleandor i want that but only the other direction :P. I thought let's make a loop but it seems there is no such possibility. this would mean real long triggers, but i know what you mean Eleandor ur my godess! :P
 
Actauly its short...

  • Unknown
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set point[0] = (Position of (Triggering unit))
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set point[(Integer A)] = (point[0] offset by 200.00 towards (90.00 x (Real((Integer A)))) degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Region centered at point[((Integer A) - 1)] with size (50.00, 50.00)) contains (Triggering unit)) Equal to True
            • Then - Actions
              • Unit - Order (Last created unit) to Move To point[(Integer A)]
            • Else - Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Custom script: call RemoveLocation(udg_point[GetForLoopIndexA()])

You should of course set all the unit values here to your own values.
 
Actauly its short...

  • Unknown
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set point[0] = (Position of (Triggering unit))
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set point[(Integer A)] = (point[0] offset by 200.00 towards (90.00 x (Real((Integer A)))) degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Region centered at point[((Integer A) - 1)] with size (50.00, 50.00)) contains (Triggering unit)) Equal to True
            • Then - Actions
              • Unit - Order (Last created unit) to Move To point[(Integer A)]
            • Else - Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Custom script: call RemoveLocation(udg_point[GetForLoopIndexA()])
You should of course set all the unit values here to your own values.
JASS:
GetForLoopIndexA()
?
You should use bj_forLoopAIndex
Also, you can't use Triggering Unit where the event does not involve any unit.
Yes its a square, after all 4 points can't be a circle lol.

Need at least 5 points for a circle (and it will be very crude).
Actually, you need at least 0 vertices for a circle because circles don't have a single vertex.
 
Look at my last sentence ... its all bright in red so you will look at it lol.

And also I wonderd about that code.
I made something in GUI, transferd to JASS and thats what it gave me.
Now I knew the code is something with bj_xxxx but it still works !
Didn't give me any error :weekani:
 
I did the idea from Eleandor but points did not work out. so instead id did it like this with regions. I made 4 regions at a random area then i do this:
  • Region
  • Events
  • Conditions
  • Actions
  • Region - Center Rect[1] to PointW
  • Region - Center Rect[2] to PointS
  • Region - Center Rect[3] to PointE
  • Region - Center Rect[4] to PointN
Could this be it?
 
Status
Not open for further replies.
Back
Top