for each Integer A...??

sergykid

Cool Member
Reaction score
0
i didn't found a tutorial for the action "for each integer A, do...". How does this work? for what i can use this action, what can be done with it? i need to set custom values to units or how to use the effect of this action, i tested some event but nothing happened. Is there a tutorial for this action? Like... heroes variable array [1]...[10], and use variable integer A from 1 to 10 and do actions will affect all the heroes? or how it works, if someone know and want to help me, please post here. :)
 

Happy

Well-Known Member
Reaction score
71
if you need an example wait a sec ill show one of the triggers of my map^^

Trigger:
  • sand effect
    • Events
      • Time - QT_SandTimer expires
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Consitions
          • QT_ControlBoolean Equal to False
        • 'THEN'-Actions
        • 'ELSE'-Actions
          • Countdown-Timer - Start QT_SandTimer as a One-Shot timer that will expire in 3.00 seconds
          • For each (Integer A) from 1 to 15, do (Actions)
            • Loop - Actions
              • Set QT_SandPosition = (QT_HeroPosition offset by 400.00 towards ((360.00 / 15.00) x (Real((Integer A)))) degrees)
              • Einheit - Create 1 Dummy for (Owner of QT_Hero) at QT_SandPosition facing ...
              • Set QT_Control = ((Real((Integer A))) / 2.00)
              • Set QT_Control2 = ((Integer A) / 2)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Conditions
                  • QT_Control Not Equal (Real(QT_Control2))
                • 'THEN'-Actions
                  • Unit - Add a 5.00 second Standard expiration timer to (Last created unit)
                  • Set KnockbackCall_Dist = 400.00
                  • Set KnockbackCall_Dur = 10.00
                • 'ELSE'-Actions
                  • Unit - Add a 1.50 second Standard expiration timer to (Last created unit)
                  • Set KnockbackCall_Dist = 200.00
                  • Set KnockbackCall_Dur = 3.00
              • Set KnockbackCall_Unit = (Last created unit)
              • Set KnockbackCall_SFX = Abilities\Spells\Orc\MirrorImage\MirrorImageDeathCaster.mdl
              • Set KnockbackCall_DestroyTree = False
              • Set KnockbackCall_Angle = (Angle from QT_SandPosition to QT_HeroPosition)
              • Custom script: call RemoveLocation(udg_QT_SandPosition)
              • Trigger - Run Knocback Call <gen> (ignoring conditions)


look how i use Integer A....maybe it helps ^^
 

eubz

Cool Member
Reaction score
1
For each integer A is good for Arrays and variables you set. If there are four spawners, for instance and you want to spawn creeptypes in a those spawners, use that action.

For each integer A (from 1 to totalspawners) do (Actions)
Unit - Create 1 (creeptypes) for (player <player>) at the position of (creepspawner(integer A))
 

0WN3D

New Member
Reaction score
15
Integer A is also good for reducing trigger length....
Instead of
Create unit for Player 1-12

You can use
For each integer A 1 to 12
Create unit for Playernumber(Integer A)
 

NeuroToxin

New Member
Reaction score
46
Basically, Integer A and Integer B are loops, loops are things that the actions you put in them, will be run as many times as specified, you can also do a variable loop, which basically means for each integer tempint from 0 to 60 create 1 unit for X player. It will then create 60 units for player (X).
Loops - I use them mainly when I make spells mui, for example, heres a small sample. (Note its quite advanced)
Trigger:
  • SSCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Send Soul
    • Actions
      • Set Send_Effect = &quot;Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl&quot;
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Circling_Units[(Custom value of (Triggering unit))] is empty) Equal to True
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SS_Integer Greater than or equal to 2999
        • Then - Actions
          • Set SS_Integer = 0
        • Else - Actions
          • Set SS_Integer = (SS_Integer + 1)
      • Set SS_Caster[SS_Integer] = (Triggering unit)
      • Set SS_Target[SS_Integer] = (Target unit of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (SS_Target[SS_Integer] is in SS_NO_DAMAGE) Equal to True
        • Then - Actions
          • Unit Group - Remove SS_Target[SS_Integer] from SS_NO_DAMAGE
        • Else - Actions
      • Set SS_Damage[SS_Integer] = (10.00 + (10.00 x (Real((Level of (Ability being cast) for (Triggering unit))))))
      • Set SS_Dummy[SS_Integer] = (Random unit from Circling_Units[(Custom value of (Triggering unit))])
      • Unit Group - Remove SS_Dummy[SS_Integer] from Circling_Units[(Custom value of (Triggering unit))]
      • Unit Group - Add SS_Dummy[SS_Integer] to SS_SentGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SS_Dummy[SS_Integer] Equal to No unit
        • Then - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: No Dummy Unit Selec...
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SS_Integer Equal to 0
            • Then - Actions
              • Set SS_Integer = 0
            • Else - Actions
              • Set SS_Integer = (SS_Integer - 1)
        • Else - Actions
          • Trigger - Turn on SSLoop &lt;gen&gt;
          • Animation - Change SS_Dummy[SS_Integer] flying height to 50.00 at 500.00

And then heres the Integer A to run through all instances of the spell.
Trigger:
  • SSLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 0 to SS_Integer, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SS_Dummy[(Integer A)] Not equal to No unit
            • Then - Actions
              • Set SS_Dummyloc = (Position of SS_Dummy[(Integer A)])
              • Set SS_TargetLoc = (Position of SS_Target[(Integer A)])
              • Set SS_Angle = (Angle from SS_Dummyloc to SS_TargetLoc)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Distance between SS_Dummyloc and SS_TargetLoc) Less than or equal to 50.00) and ((SS_Target[(Integer A)] is in SS_NO_DAMAGE) Equal to False)
                • Then - Actions
                  • Custom script: call RemoveLocation(udg_SS_Dummyloc)
                  • Custom script: call RemoveLocation(udg_SS_TargetLoc)
                  • Special Effect - Create a special effect attached to the origin of SS_Target[(Integer A)] using Send_Effect
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Cause SS_Caster[(Integer A)] to damage SS_Target[(Integer A)], dealing SS_Damage[(Integer A)] damage of attack type Spells and damage type Normal
                  • Unit - Remove SS_Dummy[(Integer A)] from the game
                  • Unit Group - Remove SS_Dummy[(Integer A)] from SS_SentGroup
                  • Unit Group - Add SS_Target[(Integer A)] to SS_NO_DAMAGE
                • Else - Actions
                  • Set SS_Offset = (SS_Dummyloc offset by 20.00 towards SS_Angle degrees)
                  • Unit - Move SS_Dummy[(Integer A)] instantly to SS_Offset, facing SS_Angle degrees
                  • Custom script: call RemoveLocation(udg_SS_Dummyloc)
                  • Custom script: call RemoveLocation(udg_SS_TargetLoc)
                  • Custom script: call RemoveLocation(udg_SS_Offset)
            • Else - Actions
 

sergykid

Cool Member
Reaction score
0
I am not that advanced, and i know nothing about custom script. I will try to use something like creating a unit array variable, create 10 demons (example) and set variable 1-10 array to them, then for each integer A from 1 to 10 create the unit [(index) integer A]. It should work ?

Sorry for late answer but i dont have internet at my home, only at scool i enter the forum.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
612
Yes, it will. Basically any actions that come under For Each Integer Loops will run once, then the integer increases its value by one and does all the actions again. That's how the Integer A value for integers works - if you put the action Add 5 Gold to Player[Integer A], that means every value of Integer A that gets run through will do this action for that player.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top