- Joined
- Jul 31, 2020
- Messages
- 1
So im generating units for my map to make it more dynamic.
But it fails mid loop and I don't understand why.
Basically the code starts 100 units * (5 * number of players). To give it an increased size depending on how many players are playing.
Then the loop subtracts 200 units(distance) each loop. but it gives me strange patterns.
See below picture
Can someone explain why the patterns are wierd?
If you need, I can explain it more.
The outcome:
But it fails mid loop and I don't understand why.
Code:
setup
Events
Time - Elapsed game time is 3.00 seconds
Conditions
Actions
Set VariableSet temp_playergroup = (All players controlled by a User player)
Set VariableSet MaxSize = (5 + (Number of players in temp_playergroup))
Custom script: call DestroyForce (udg_temp_playergroup)
Set VariableSet mapsize_max = (100.00 x (Real(MaxSize)))
Set VariableSet mapsize_min = (mapsize_max - mapsize_max)
Set VariableSet playareaX = mapsize_max
Set VariableSet playareaY = mapsize_max
For each (Integer A) from 1 to ((MaxSize x MaxSize) + MaxSize), do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
playareaXcounter Not equal to MaxSize
Then - Actions
Set VariableSet temp_point = ((Center of (Playable map area)) offset by (playareaX, playareaY))
Unit - Create 1 Wall for Player 1 (Red) at temp_point facing Default building facing degrees
Custom script: call RemoveLocation(udg_temp_point)
Set VariableSet playareaX = (playareaX + -200.00)
Set VariableSet playareaXcounter = (playareaXcounter + 1)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
playareaYcounter Not equal to MaxSize
Then - Actions
Set VariableSet playareaXcounter = 0
Set VariableSet playareaY = (playareaY - 200.00)
Set VariableSet playareaYcounter = (playareaYcounter + 1)
Set VariableSet playareaX = mapsize_max
Else - Actions
Game - Display to (All players) the text: TURNED OFF
Trigger - Turn off (This trigger)
Basically the code starts 100 units * (5 * number of players). To give it an increased size depending on how many players are playing.
Then the loop subtracts 200 units(distance) each loop. but it gives me strange patterns.
See below picture
Can someone explain why the patterns are wierd?
If you need, I can explain it more.
The outcome: