If I Put message in the end the number will be 12.
-
Game - Display to (All players) the text: (String(loopInt))
Depends
where you put it.
If you put it inside the "loop-actions" part of the "For integer loop", then it will actually show 12 messages.
If you put it outside "loop-actions" block, it will show only once and it will be like you wrote number 12.
The GUI function looks like this:
For each (integer variable) from X to Y do (Actions)
What you have to set up is the integer variable - in the trigger I posted that variable would be called
loopInt
and set
X and
Y, where (X < Y), else it would not loop at all.
In the trigger I posted
X would have value 1 and
Y would have value 12.
Now it works like this: When you first start this loop, loopInt variable will be assigned number equal to
X and it will do all those actions which are inside the "Loop - Actions" block. In the trigger I posted inside the "Loop - Actions" block is that If/Then/Else function.
Once all actions in the "Loop - Actions" block has been completed, the integer variable
loopInt will have its value increased by 1 and it will once again do all those actions in the "Loop - Actions" block. Then once that is finished, loopInt will have its value increased by 1 yet again... and this process will repeat and repeat until loopInt value becomes greater than
Y, in which case it will stop and
it will no longer start all those actions in the "Loop - Actions" block; instead the trigger will go on without going back into the loop.
This is why loopInt has value 12 when you put it outside the Loop-Actions block.
However what you are interested in should be the "Count" variable, which contains the actual amount of Computer players.