local iSettler = GameInfo.Units["UNIT_SETTLER"].Index
for i = 1, 2 do
pUnit2 = playerUnits:Create(iSettler, adjacentPlot:GetX(), adjacentPlot:GetY())
end
local iScout = GameInfo.Units["UNIT_SCOUT"].Index
local iSettler = GameInfo.Units["UNIT_SETTLER"].Index
local function OnPlayerTurnActivated( player, bIsFirstTime )
local pUnit;
if (bIsFirstTime and player == Game.GetLocalPlayer()) then
local currentTurn = Game.GetCurrentGameTurn();
local SpawnTurn = 0;
local playerUnits;
local adjacentPlot;
local unitPlot;
if 1 == currentTurn then
local pPlayer = Players[player]
if pPlayer:IsHuman() then
playerUnits = pPlayer:GetUnits()
print("SpawnTurn", SpawnTurn) ;
for i, unit in playerUnits:Members() do
local unitTypeName = UnitManager.GetTypeName(unit)
print("unitTypeName", unitTypeName) ;
if "LOC_UNIT_SETTLER_NAME" == unitTypeName then
SpawnTurn = 1;
unitPlot = Map.GetPlot(unit:GetX(), unit:GetY());
print("SpawnTurn", SpawnTurn) ;
end
end
end
if SpawnTurn == 1 then
print("yeps", SpawnTurn) ;
for i = 1, 5 do
pUnit = playerUnits:Create(iScout, unitPlot:GetX(), unitPlot:GetY())
for direction = 1, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
adjacentPlot = Map.GetAdjacentPlot(pUnit:GetX(), pUnit:GetY(), direction);
if (adjacentPlot ~= nil) and not (adjacentPlot:IsWater() or adjacentPlot:IsImpassable()) then
break
end
end
for i = 1, 2 do
pUnit2 = playerUnits:Create(iSettler, adjacentPlot:GetX(), adjacentPlot:GetY())
end
end
end
end
end
Events.PlayerTurnActivated.Add(OnPlayerTurnActivated)
local iScout = GameInfo.Units["UNIT_SCOUT"].Index
local iSettler = GameInfo.Units["UNIT_SETTLER"].Index
local function OnPlayerTurnActivated( player, bIsFirstTime )
local pUnit;
if (bIsFirstTime and player == Game.GetLocalPlayer()) then
local currentTurn = Game.GetCurrentGameTurn();
local SpawnTurn = 0;
local playerUnits;
local adjacentPlot;
local unitPlot;
if 1 == currentTurn then
local pPlayer = Players[player]
if pPlayer:IsHuman() then
playerUnits = pPlayer:GetUnits()
print("SpawnTurn", SpawnTurn) ;
for i, unit in playerUnits:Members() do
local unitTypeName = UnitManager.GetTypeName(unit)
print("unitTypeName", unitTypeName) ;
if "LOC_UNIT_SETTLER_NAME" == unitTypeName then
SpawnTurn = 1;
unitPlot = Map.GetPlot(unit:GetX(), unit:GetY());
print("SpawnTurn", SpawnTurn) ;
end
end
end
if SpawnTurn == 1 then
for i = 1, 5 do
pUnit = playerUnits:Create(iScout, unitPlot:GetX(), unitPlot:GetY())
for direction = 1, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
adjacentPlot = Map.GetAdjacentPlot(pUnit:GetX(), pUnit:GetY(), direction);
if (adjacentPlot ~= nil) and not (adjacentPlot:IsWater() or adjacentPlot:IsImpassable()) then
break
end
end
end
for i = 1, 2 do
pUnit2 = playerUnits:Create(iSettler, adjacentPlot:GetX(), adjacentPlot:GetY())
end
Events.PlayerTurnActivated.Remove(OnPlayerTurnActivated)
end
end
end
end
Events.PlayerTurnActivated.Add(OnPlayerTurnActivated)
for i = 1, 5 do
pUnit = playerUnits:Create(iScout, unitPlot:GetX(), unitPlot:GetY())
for direction = 1, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
adjacentPlot = Map.GetAdjacentPlot(pUnit:GetX(), pUnit:GetY(), direction);
if (adjacentPlot ~= nil) and not (adjacentPlot:IsWater() or adjacentPlot:IsImpassable()) then
break
end
end
for i = 1, 2 do
pUnit2 = playerUnits:Create(iSettler, adjacentPlot:GetX(), adjacentPlot:GetY())
end
end
for i = 1, 5 do
pUnit = playerUnits:Create(iScout, unitPlot:GetX(), unitPlot:GetY())
for direction = 1, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
adjacentPlot = Map.GetAdjacentPlot(pUnit:GetX(), pUnit:GetY(), direction);
if (adjacentPlot ~= nil) and not (adjacentPlot:IsWater() or adjacentPlot:IsImpassable()) then
break
end
end
end
for i = 1, 2 do
pUnit2 = playerUnits:Create(iSettler, adjacentPlot:GetX(), adjacentPlot:GetY())
end
for i = 1, 5 do
pUnit = playerUnits:Create(iScout, unitPlot:GetX(), unitPlot:GetY())
for direction = 1, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
adjacentPlot = Map.GetAdjacentPlot(pUnit:GetX(), pUnit:GetY(), direction);
if (adjacentPlot ~= nil) and not (adjacentPlot:IsWater() or adjacentPlot:IsImpassable()) then
break
end
end
end
for i = 1, 2 do
pUnit2 = playerUnits:Create(iSettler, adjacentPlot:GetX(), adjacentPlot:GetY())
end
Events.PlayerTurnActivated.Remove(OnPlayerTurnActivated)
for i = 1, 1 do
pUnit3 = playerUnits:Create(iBuilder, adjacentPlot:GetX(), adjacentPlot:GetY())
end
Events.PlayerTurnActivated.Remove(OnPlayerTurnActivated)
end
end
end
end
Events.PlayerTurnActivated.Add(OnPlayerTurnActivated)
local iScout = GameInfo.Units["UNIT_SCOUT"].Index
local iSettler = GameInfo.Units["UNIT_SETTLER"].Index
local iBuilder = GameInfo.Units["UNIT_BUILDER"].Index
local function OnPlayerTurnActivated( player, bIsFirstTime )
local pUnit;
if (bIsFirstTime and player == Game.GetLocalPlayer()) then
local currentTurn = Game.GetCurrentGameTurn();
local SpawnTurn = 0;
local playerUnits;
local adjacentPlot;
local unitPlot;
if 1 == currentTurn then
local pPlayer = Players[player]
if pPlayer:IsHuman() then
playerUnits = pPlayer:GetUnits()
print("SpawnTurn", SpawnTurn) ;
for i, unit in playerUnits:Members() do
local unitTypeName = UnitManager.GetTypeName(unit)
print("unitTypeName", unitTypeName) ;
if "LOC_UNIT_SETTLER_NAME" == unitTypeName then
SpawnTurn = 1;
unitPlot = Map.GetPlot(unit:GetX(), unit:GetY());
print("SpawnTurn", SpawnTurn) ;
end
end
end
if SpawnTurn == 1 then
for i = 1, 5 do
pUnit = playerUnits:Create(iScout, unitPlot:GetX(), unitPlot:GetY())
for direction = 1, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
adjacentPlot = Map.GetAdjacentPlot(pUnit:GetX(), pUnit:GetY(), direction);
if (adjacentPlot ~= nil) and not (adjacentPlot:IsWater() or adjacentPlot:IsImpassable()) then
break
end
end
end
for i = 1, 2 do
pUnit2 = playerUnits:Create(iSettler, adjacentPlot:GetX(), adjacentPlot:GetY())
end
for i = 1, 1 do
pUnit3 = playerUnits:Create(iBuilder, adjacentPlot:GetX(), adjacentPlot:GetY())
end
Events.PlayerTurnActivated.Remove(OnPlayerTurnActivated)
end
end
end
end
Events.PlayerTurnActivated.Add(OnPlayerTurnActivated)
local iScout = GameInfo.Units["UNIT_SCOUT"].Index
local iSettler = GameInfo.Units["UNIT_SETTLER"].Index
local iBuilder = GameInfo.Units["UNIT_BUILDER"].Index
[SPOILER]local function OnPlayerTurnActivated( player, bIsFirstTime )
local pUnit;
if (bIsFirstTime and player == Game.GetLocalPlayer()) then
local currentTurn = Game.GetCurrentGameTurn();
local SpawnTurn = 0;
local playerUnits;
local adjacentPlot;
local unitPlot;
if 1 == currentTurn then
local pPlayer = Players[player]
if pPlayer:IsHuman() then
playerUnits = pPlayer:GetUnits()
print("SpawnTurn", SpawnTurn) ;
for i, unit in playerUnits:Members() do
local unitTypeName = UnitManager.GetTypeName(unit)
print("unitTypeName", unitTypeName) ;
if "LOC_UNIT_SETTLER_NAME" == unitTypeName then
SpawnTurn = 1;
unitPlot = Map.GetPlot(unit:GetX(), unit:GetY());
print("SpawnTurn", SpawnTurn) ;
end
end
end
if SpawnTurn == 1 then
local lastPlot = unitPlot;
for i = 1, 5 do
for direction = 1, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
adjacentPlot = Map.GetAdjacentPlot((lastPlot:GetX() + 1), lastPlot:GetY(), direction);
if (adjacentPlot ~= nil) and not (adjacentPlot:IsWater() or adjacentPlot:IsImpassable()) then
break
end
end
pUnit = playerUnits:Create(iScout, unitPlot:GetX(), unitPlot:GetY())
lastPlot = Map.GetPlot(pUnit:GetX(), pUnit:GetY());
end
for i = 1, 2 do
for direction = 1, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
adjacentPlot = Map.GetAdjacentPlot((lastPlot:GetX() ), lastPlot:GetY(), direction);
if (adjacentPlot ~= nil) and not (adjacentPlot:IsWater() or adjacentPlot:IsImpassable()) then
break
end
end
pUnit2 = playerUnits:Create(iSettler, adjacentPlot:GetX(), adjacentPlot:GetY())
lastPlot = Map.GetPlot(pUnit:GetX(), pUnit:GetY());
end
for i = 1, 1 do
for direction = 1, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
adjacentPlot = Map.GetAdjacentPlot(lastPlot:GetX(), lastPlot:GetY(), direction);
if (adjacentPlot ~= nil) and not (adjacentPlot:IsWater() or adjacentPlot:IsImpassable()) then
break
end
end
pUnit3 = playerUnits:Create(iBuilder, lastPlot:GetX(), lastPlot:GetY())
lastPlot = Map.GetPlot(pUnit:GetX(), pUnit:GetY());
end
Events.PlayerTurnActivated.Remove(OnPlayerTurnActivated)
end
end
end
end
Events.PlayerTurnActivated.Add(OnPlayerTurnActivated)
For those of us who have not modded in Civ V or Civ VI, what file does this code go into?
<GameInfo>
<Modifiers>
<!--Grant Unit-->
<Row>
<ModifierId>TCS_PALACE_GRANT_SCOUT</ModifierId>
<ModifierType>MODIFIER_SINGLE_CITY_GRANT_UNIT_IN_CITY</ModifierType>
<RunOnce>true</RunOnce>
<Permanent>true</Permanent>
<OwnerRequirementSetId>PLAYER_IS_HUMAN</OwnerRequirementSetId>
</Row>
</Modifiers>
<ModifierArguments>
<!--Grant Unit-->
<Row>
<ModifierId>TCS_PALACE_GRANT_SCOUT</ModifierId>
<Name>UnitType</Name>
<Value>UNIT_SCOUT</Value>
</Row>
<Row>
<ModifierId>TCS_PALACE_GRANT_SCOUT</ModifierId>
<Name>Amount</Name>
<Value>1</Value>
</Row>
</ModifierArguments>
</GameInfo>
<GameInfo>
<Modifiers>
<!--Grant Unit-->
<Row>
<ModifierId>TCS_PALACE_GRANT_SCOUT</ModifierId>
<ModifierType>MODIFIER_SINGLE_CITY_GRANT_UNIT_IN_CITY</ModifierType>
<RunOnce>true</RunOnce>
<Permanent>true</Permanent>
<OwnerRequirementSetId>PLAYER_IS_HUMAN</OwnerRequirementSetId>
</Row>
</Modifiers>
<ModifierArguments>
<!--Grant Unit-->
<Row>
<ModifierId>TCS_PALACE_GRANT_SCOUT</ModifierId>
<Name>UnitType</Name>
<Value>UNIT_SCOUT</Value>
</Row>
<Row>
<ModifierId>TCS_PALACE_GRANT_SCOUT</ModifierId>
<Name>Amount</Name>
<Value>1</Value>
</Row>
</ModifierArguments>
<BuildingModifiers>
<!--Grant Unit-->
<Row>
<BuildingType>BUILDING_PALACE</BuildingType>
<ModifierId>TCS_PALACE_GRANT_SCOUT</ModifierId>
</Row>
</BuildingModifiers>
</GameInfo>