You cannot have more than 200 "local" variables, like for example "local koenigsberg", in the same function.
You could clone it under a different name, that's one way, but still quite terrible in my opinion.
I believe you want to set 0 movement to quite a lot of german units, right?
There are better and much easier ways to achieve this, for example:
Code: Select all
for unit in germany.units do
if unit.type == Unit.LAND
and unit.hex ~= nil
and unit.hex.originalFaction.id == 2
and unit.hex.construction ~= nil then
unit.mp = 0
end
end
This will set movement to 0 to:
ALL german units
that are land units
that are not in the production queue but already on the map
that are on a hex originally belonging to germany
that are on a hex with a construction (~= nil means "not nothing").
Constructions come in different types, for example:
Code: Select all
Construction.TYPE_CAPITAL
Construction.TYPE_CITY
Construction.TYPE_FORTRESS
There is also
which is the actual port hex on an ocean hex, NOT a city with a port!
So for example if you would want to set 0 movement to all german units in all cities and fortresses but not capitals you could use:
Code: Select all
for unit in germany.units do
if unit.hex ~= nil
and unit.type == Unit.LAND
and unit.hex.construction ~= nil
and (unit.hex.construction.type == Construction.TYPE_CITY
or unit.hex.construction.type == Construction.TYPE_FORTRESS) then
unit.mp = 0
end
end
If that's not want you need I need more details about what you are trying to achieve, but please be specific.