bane_
Howardianism High-Priest
- Joined
- Nov 27, 2013
- Messages
- 1,559
This is the relevant part of the mission:
This is from the function:
The turn after I activate the mission, (thus, including BondsHFood into the PlayerDoTurn) I get a CTD. Nothing on the Lua log.
This is one of the last fixes before I can launch my next Civ, I'm working on it for a month now.
Ideas? Please?
Code:
...
local pPlayer = Players[Game.GetActivePlayer()];
local pPlot = unit:GetPlot()
local iPlotOwner = pPlot:GetOwner()
GameEvents.PlayerDoTurn.Add(BondsHFood(pPlayer, iPlotOwner))
...
This is from the function:
Code:
function BondsHFood(pPlayer, iPlotOwner)
for _, v in ipairs(pPlayer:GetTradeRoutes()) do
local pFromCity = v.FromCity
local pToCity = v.ToCity
local pToCityOwner = Players[pToCity:GetOwner()]
if pToCity:GetOwner() == Players[iPlotOwner] then
local FFood = math.ceil(pFromCity:GetFood() / 50)
local TFood = math.ceil(pToCity:GetFood() / 50)
print("OUR FromFood pre-increase is " .. pFromCity:GetFood() .. ".")
print("OUR ToFood pre-increase is " .. pToCity:GetFood() .. ".")
pFromCity:ChangeFood(FFood)
pToCity:ChangeFood(TFood)
print("OUR FromFood now is " .. pFromCity:GetFood() .. ".")
print("OUR ToFood now is " .. pToCity:GetFood() .. ".")
end
end
for _, v in ipairs(Players[iPlotOwner]:GetTradeRoutes()) do
local pFromCity = v.FromCity
local pToCity = v.ToCity
local pToCityOwner = Players[pToCity:GetOwner()]
if pToCity:GetOwner() == pPlayer then
local FFood = math.ceil(pFromCity:GetFood() / 50)
local TFood = math.ceil(pToCity:GetFood() / 50)
print("FromFood pre-increase is " .. pFromCity:GetFood() .. ".")
print("ToFood pre-increase is " .. pToCity:GetFood() .. ".")
pFromCity:ChangeFood(FFood)
pToCity:ChangeFood(TFood)
print("FromFood now is " .. pFromCity:GetFood() .. ".")
print("ToFood now is " .. pToCity:GetFood() .. ".")
end
end
local BondsTimer = BondsTimer + 1
if BondsTimer == 15 then
GameEvents.PlayerDoTurn.Remove(BondsHFood)
end
end
The turn after I activate the mission, (thus, including BondsHFood into the PlayerDoTurn) I get a CTD. Nothing on the Lua log.
This is one of the last fixes before I can launch my next Civ, I'm working on it for a month now.
Ideas? Please?