civ.scen.onTurn(function (turn)
--g delete all air craft which are on the wrong carrier :)
if state.delay and state.delay > 0 then -- this is line 1139
state.delay = state.delay - 1
end
for unit in civ.iterateUnits() do
for _, typeToBeDeleted in pairs(unitTypesToBeDeletedEachTurn) do
if unit.type.id==typeToBeDeleted then
civ.deleteUnit(unit)
end
end
end
if tribeAliases.Allies:hasTech(civ.getTech(76)) then
tile = civ.getTile(405, 75, 0)
tile.terrainType = 2
civ.ui.text("Allies have tech 76")
end
--[[local currentUnit = civ.getActiveUnit()
local cannotLandCityItalyRussia = {
["Me109G6"] = { cannotLand=civ.getUnitType(12), killedTerrain={0, 15, -128, -114} },
}
for _, cannotLand in pairs (cannotLandCityItalyRussia) do
if unit.type.id==cannotLand then
killedTerrain=0
for _, killedTerrain in pairs (cannotLandCityItalyRussia.killedTerrain) do
if currentUnit.location.terrainType==killedTerrain then
killedTerrain=1
end
end
if killedTerrain==1 then
civ.deleteUnit(unit)
end
end
end ]]
local cannotLandCityItalyRussia = {
[unitAliases.Me109G6.id] = { forbiddenTerrain={0, 15, -128, -114} }, --Index unit types by their id number
}
for unit in civ.iterateUnits() do
for _, cannotLand in pairs (cannotLandCityItalyRussia) do
if unit.type.id==cannotLand and unit.location.terrainType==0
then
civ.deleteUnit(unit)
end
end
end
function doThisBetweenTurns(turn)
civ.scen.onTurn(doThisBetweenTurns)
for unit in civ.iterateUnits() do
if cannotLandCityItalyRussia[unit.type.id] then -- If the unittype id is not in the table, the call will return
-- nil, which is interpreted by lua as false
local unitMustBeKilled = false
for __, terrain in pairs(cannotLandCityItalyRussia[unit.type.id].forbiddenTerrain) do
if unit.location.terrainType == terrain then
unitMustBeKilled = true -- Could simply kill unit here, I guess.
end
end --end check each type of terrain
end -- end if statement for if unit is in the cannotLandCityItalyRussia table
if unitMustBeKilled then
civ.deleteUnit(unit)
end
end -- end the for loop over all units in the game
end -- end function
if turn == 1 then
civ.ui.text(func.splitlines(textAliases.firstTurn1))
end
--civ.scen.onTurn(function (turn)
if turn % 4 == 0 then
civ.ui.text(func.splitlines(textAliases.freighterText))
civlua.createUnit(unitAliases.Freighter, tribeAliases.Allies, {{3,119,0},{8,122,0},{4,86,0},{5,13,0}}, {count=2, randomize=true, veteran=false})
civlua.createUnit(unitAliases.Freighter, tribeAliases.Allies, {{200,6,0},{193,17,0},{185,9,0},{3,5,0}}, {count=2, randomize=true, veteran=false})
civlua.createUnit(unitAliases.Freighter, tribeAliases.Allies, {{8,8,0},{4,46,0},{9,67,0}}, {count=2, randomize=true, veteran=false})
end
end) --g end of onTurn function