Connection ErrorBad RequestSession ExpiredSign in requiredForbiddenNot FoundToo Many RequestsServer ErrorBad GatewayService UnavailableGateway TimeoutHTTP Version Not Supported
Session Expired
Your session has expired. Please log in to continue.
Sign in required
You need an account to do that. Sign in or create one — it only takes a minute.
Request Failed
We encountered an issue while processing your request.
Please check your internet connection and try again.
garrison_names={'G1', 'G2', 'G3', 'G4', 'G5', 'G6', 'G7', 'G8', 'G9'}
garrisons={}
for j, gar in garrison_names do
Trigger(5, gar, 'capture_gar')
garrisons[gar] = {}
for i = 0, 6 do
local t, n = GetObjectArmySlotCreature(gar, i)
garrisons[gar][i] = {t, n}
end
end
function capture_gar(oldowner, newowner, hero, gar)
for i = 0, 6 do
if garrisons[gar][i][1] ~= 0 then
AddObjectCreatures(gar, garrisons[gar][i][1], garrisons[gar][i][2]*2)
end
end
DenyGarrisonCreaturesTakeAway(gar, 1)
Trigger(5, gar, nil)
end
```
Added 10 minutes later Ment
Create a new array for GetObjectArmySlotCreature, there's no need to put everything in one, and organize it differently.
Indeed, the loop executes the block for the values that it created itself.