"For each integer A, do action"

Monictor

New Member
Reaction score
0
I still need a way to input integers into loops, but read my latest post for the latest update. Thanks.

So I have noticed that this can be very helpful for when making dummies for special effects and other stuff. However, I can't seem to figure out how to do these triggers accuratly.

Here is one of my attempts:

For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
Unit - Create 1 Peasant for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
Custom script: set temp_dummy[(Integer A)] = (Last created unit)
Unit - Order (Last created unit) to Move To ((Position of (Casting unit)) offset by 500.00 towards (1.00 x 1.00) degrees)
Custom script: Order (Last created unit) to Move To ((Position of (Casting unit)) offset by 500.00 towards ([(Integer_A )] x 36.00) degrees)

I have unit variables temp_dummy(1-10) created.
This is one sort of haphazzardly thrown together to make a nova of peasants. Not a serious one, but I wouldn't know how to correct it or make a serious one.

Anyone know what I am doing wrong and generally what to keep in mind when making these things?

A lowly nub map-maker is very much obliged for any assistance.
 

vypur85

Hibernate
Reaction score
803
Code:
For each (Integer A) from 1 to 10, do (Actions)
    Loop - Actions
        Unit - Create 1 Peasant for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
        [B]Custom script:   set temp_dummy[(Integer A)] = (Last created unit)[/B]
        Unit - Order (Last created unit) to Move To ((Position of (Casting unit)) offset by 500.00 towards (1.00 x 1.00) degrees)
        [B]Custom script:   Order (Last created unit) to Move To ((Position of (Casting unit)) offset by 500.00 towards ([(Integer_A )] x 36.00) degrees)[/B]

What's with the custom scripts? Use the default GUI actions instead. Your script above will return error.

This:
Code:
For each (Integer A) from 1 to 10, do (Actions)
    Loop - Actions
        Unit - Create 1 Peasant for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
        [B]Set temp_dummy[(Integer A)] = (Last created unit)[/B] <-- [I]Set Variable[/I]
        Unit - Order (Last created unit) to Move To ((Position of (Casting unit)) offset by 500.00 towards [B](36.00 x (Integer A))[/B] degrees) --> ?
 

Faust

You can change this now in User CP.
Reaction score
123
What do you want with that custom script?! WTF
Use wc3 tags my god
Jesus, your code is a mess, I'll just show you what you are supposed to make.

Trigger:
  • For each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions
      • Set RealVariable = (RealVariable + 36)
      • Unit - Create 1 Peasant for (Owner of (Triggering unit)) at ((Position of (Triggering unit)) offset by 500.00 towards RealVariable degrees) facing Default building facing degrees
      • Set UnitVariable[(Integer A)] = (Last created unit)
 

Monictor

New Member
Reaction score
0
Okay... wtf. I keep getting suggestions from people in here to use GUI functions that don't appear to exist.

Faust, you say "Set UnitVariable[(Integer A)] = Last created item"

The problem is, [(Integer A)] does not exist as a value I can set variables with. When I try to set variables, all I get is the list of premade varable names I put into the system, and I do not see how to fit variablename[(Integer A)] into the equation. {, (, and spaces are not allowed in variable names either, so I don't know if you want me to incorporate the integer A into the variable name somehow.
 

Monictor

New Member
Reaction score
0
Click on this:


Thanks for that reply TwoHeadedBoy, but... that function does not seem to exist on my editor. Are there other updated versions or something? becuase I seem to have no function that references any Integer loop variable. I am not using a mac either.
 

vypur85

Hibernate
Reaction score
803
It should be an Integer variable. Do not mistaken it with Real variable. If you have Real, then you need to convert it to Integer first. Use the conversion function (Real to Integer), which is also captured in the screen shot above.
 

TwoHeadedBoy

New Member
Reaction score
6
hmmmmm. I just have the base WE. and its up to date. like vypur85 said, are you sure you're in integers and not reals?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top