Hi,
currently I'm working on my 1st scenario project.
One of the problems that I am trying to handle is to place a specific set of buildings (e.g. barracks, a market and a granary) into every city on my map at the start of the game initially.
Well, I finished my map and placed all cities by WorldBuilder. But how do I place the buildings by lua?
I tried it with a code snippet from the 'New World' scenario, I adapted for my issues:
... unfortunately, it doesn't work.
I copied the code into a new mapscript-file and added it as a mapscript in the content-section of my modbuddy-project.
But when I start the game, it seems to be not working.
I would be very grateful for any help
thanks,
bluefoxxp
currently I'm working on my 1st scenario project.
One of the problems that I am trying to handle is to place a specific set of buildings (e.g. barracks, a market and a granary) into every city on my map at the start of the game initially.
Well, I finished my map and placed all cities by WorldBuilder. But how do I place the buildings by lua?
I tried it with a code snippet from the 'New World' scenario, I adapted for my issues:
Code:
function InitMyCities()
local player = Players[0];
local capital1 = player:InitCity(2, 27);
local city_ID = capital1:GetID();
SetupMyCity(capital1);
end
function SetupMyCity(city)
local iBuildingID;
iBuildingID = GameInfoTypes["BUILDING_GRANARY"];
city:SetNumRealBuilding(iBuildingID, 1);
end
... unfortunately, it doesn't work.
I copied the code into a new mapscript-file and added it as a mapscript in the content-section of my modbuddy-project.
But when I start the game, it seems to be not working.
I would be very grateful for any help
thanks,
bluefoxxp