Tasks
Code
Create a function, that runs on map initialiaztion.
The function's goal is to create <Footman Amount> footmen for Player_1 using a loop.
Insert a new condition to exit the loop from Part 1 -- now the loop should (also) exit if Player_1's currently used food level is above "3".
Create a new function, that also runs on map initialization.
The function's goal is to loop through all players, and to create <Footman Amount> footmen units for all of the players with using a loop, as well.
JASS:
scope Part1n2n3 initializer main
globals
integer fmanAmount = 5
integer foodLimit = 3
endglobals
private function main2 takes nothing returns nothing
local integer i = 1
local integer u = 0
local real x
local real y
loop
exitwhen i > bj_MAX_PLAYERS
loop
exitwhen u == fmanAmount or GetPlayerState(Player(i), PLAYER_STATE_RESOURCE_FOOD_USED) > foodLimit
set x = GetRandomReal(GetRectMinX(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea))
set y = GetRandomReal(GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))
call CreateUnit(Player(i), 'hfoo', x*Cos(GetRandomReal(0, 359)*bj_DEGTORAD), y*Sin(GetRandomReal(0, 359)*bj_DEGTORAD), .0)
set u = u + 1
endloop
set u = 0
set i = i + 1
endloop
endfunction
private function main takes nothing returns nothing
local integer i = 0
local real x = 300 //X distance between footman and center of map
local real y = 300 //Y "
loop
exitwhen i == fmanAmount or GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_FOOD_USED) > foodLimit
call CreateUnit(Player(0), 'hfoo', x*Cos(((360/fmanAmount)*i)*bj_DEGTORAD), y*Sin(((360/fmanAmount)*i)*bj_DEGTORAD), .0)
set i = i + 1
endloop
//I think this 'll do
call main2()
endfunction
endscope