HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Teach me

08-09-2004, 02:23 PM#1
Saxe
Right now, im testing what the possibilities with the trigger "For each integer A" is. I've never used it before, so i dont know much about what you can do with it. Is there a way to apply a camera for all players through a loop? I dont really see how you would do the "for player" part. Anyway, i hope someone can help me
08-09-2004, 02:52 PM#2
Coffein
Simply, by looping from 1 to the max player number in a map, and then converting the For Loop Integer A to a player index.
08-09-2004, 03:12 PM#3
th15
For loops are similar to any of the "pick all ****..." functions. Both are Loops. That is to say that they repeat the same action across a set number of times.

For- loops are most commonly used in any good spawn trigger. Instead of making a block of 40 troops spawn, picking all units within the spawn region then issuing a move order, what you should do is have a for-loop loop 40 times creating each individual unit and ordering each individual unit as it is created. Like so:
Code:
Event:
<whatever>

Condtions:
<whatever>

Actions:
For each integer 1-40 do:
      Unit-create 1 footman at <Spawnloc> facing default building angle
      Unit issue order targeting a point- Order <last created unit> to <attack-move> to <targetloc>

That's just one example though, there are many many other uses for for-loops. But be careful with loops because if they are badly coded they can create massive mem leaks or overtax your processor.
08-09-2004, 03:28 PM#4
Saxe
Like this: "Camera - Apply Cam <gen> for (Player(1)) over 0.00 seconds" ?
08-09-2004, 04:54 PM#5
Anitarf
Quote:
Originally Posted by Saxe
Like this: "Camera - Apply Cam <gen> for (Player(1)) over 0.00 seconds" ?
Almost got it right. When doing this in a loop, you use (Player((Integer A))) (instead of 1, you put in (Integer A), so each time the loop will run, it will do the camera thingy for a different player).