I am trying to force the AI to build the National College and the Hermitage in the capital city when they become available. I'd like any insight.
Here is my first attempt, completely naive and ineffective.
I'm not sure how the print statement actually works or how best to debug this and/or go about what I actually want to do.
Here is my first attempt, completely naive and ineffective.
Spoiler :
Code:
GameEvents.PlayerDoTurn.Add(function(iPlayer)
local pPlayer = Players[ iPlayer ];
if ( pPlayer:IsHuman() ) then
return false;
end
if ( not pPlayer:CanConstruct( BUILDING_NATIONAL_COLLEGE ) and
not pPlayer:CanConstruct( BUILDING_HERMITAGE ) ) then
return false;
end
print("Can build a national wonder");
local pCapital = pPlayer:GetCapitalCity();
if ( pPlayer:CanConstruct( BUILDING_NATIONAL_COLLEGE ) ) then
pCapital:ChooseProduction( 0, BUILDING_NATIONAL_COLLEGE, 0, 1, 1);
return false;
end
if ( pPlayer:CanConstruct( BUILDING_HERMITAGE ) ) then
pCapital:ChooseProduction( 0, BUILDING_HERMITAGE, 0, 1, 1);
return false;
end
end);
I'm not sure how the print statement actually works or how best to debug this and/or go about what I actually want to do.