pineappledan
Deity
So I don't know what kind of spooky mods you guys might have poopin' up the works, but the 4UC stuff is showing up just fine for me:
As for the problem with the human player getting Canada's free tiles, even if they aren't playing Canada, it's pretty bizarre.
Can I get a second pair of eyeballs on this code? This looks pretty airtight to me, but it's still not working as intended. I loaded up a game as a different civ, then ran autoplay and gave Canada an internal trade route, and the first civ I loaded up as got all the free tiles.
That seems foolproof to me, I made a separate PlayerID check to make sure the owner of the Caravan is the one who gets the tiles, and it STILL gives the free tiles to whichever civ the human player is loaded as. I'm stumped.
Spoiler :
As for the problem with the human player getting Canada's free tiles, even if they aren't playing Canada, it's pretty bizarre.
Can I get a second pair of eyeballs on this code? This looks pretty airtight to me, but it's still not working as intended. I loaded up a game as a different civ, then ran autoplay and gave Canada an internal trade route, and the first civ I loaded up as got all the free tiles.
Code:
function YorkFactoryExpress(iPlayer, iUnit, iX, iY)
local pPlayer = Players[iPlayer]
if pPlayer:GetCivilizationType() ~= iCanada then return end
local pUnit = pPlayer:GetUnitByID(iUnit)
if (pUnit == nil or pUnit:IsDelayedDeath()) then return end
if pUnit:GetUnitType() == GameInfoTypes.UNIT_CARAVAN then
local iRouteIndex = pUnit:GetTradeRouteIndex()
if iRouteIndex == -1 then return end
if (Game.GetTradeRoute(iRouteIndex).ToCivilizationType == iCanada) then
local pPlot = pUnit:GetPlot()
if pPlot:GetOwner() == -1 then
local eYesWeCanada = Players[pUnit:GetOwner()]
pPlot:SetOwner(eYesWeCanada, eYesWeCanada:GetCapitalCity():GetID(), 1, 1)
end
end
end
end