| 06-03-2005, 02:52 AM | #1 |
I want to make a loop that exits when a player reaches or goes over their maxium amount of food. So, I looked, and couldn't see a way to do it in the GUI, because the only loops are for int a... >< EDIT: I did a little research and came up with this... loop if unit enters and owner = player[1] region then exitwhen i>=max food for player[1] set i=current food for player[1] Create unit[type of entering unit for player[1] at region[1] endif endloop BTW, what I am trying to do is make it so when a unit enters a certain region, the a unit of the same unit type of entering unit, spawns in another region, over and over, 1 by 1, until the food limit for the owner of those units is reached. But Im really not sure how to go about it, any help is appreciated. |
| 06-22-2005, 08:23 PM | #2 |
First make a trigger in the GUI with the desired events (unit enters rect ...), then convert it to JASS and add this loop to the actions-part of the trigger: Code:
loop exitwhen GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_FOOD_USED) >= 100 call CreateUnit(Player(0), GetUnitTypeId(GetEnteringUnit()), GetRectCenterX(udg_region[0]), GetRectCenterY(udg_region[0]), 0) endloop udg_region is a global rect array with the name region btw. Also I take care you're using the right indizes, I used 0 here, because in JASS Player 1 = 0 |
