thadian
Kami of Awakened Dreamers
Sorry to bring up an older thread but i had a question about making units and buildings available by era instead of tech.
do i need one LUA file with this:
GameEvents.PlayerCanConstruct.Add(function(iPlayer , buildingTypeID)
local prereqEra = GameInfo.Buildings[buildingTypeID].PrereqEra
local playerEra = player:GetCurrentEra();
if playerEra >= prereqEra then
return false;
end
end
return true
end)
or one for each building? Where in the XML do i reference the era?
Do i need to make an SQL with this:
ALTER TABLE Buildings ADD COLUMN 'PrereqPolicy' TEXT DEFAULT NULL;
and how do i make said SQL run before the xml? Sorry if this is all old news, ive never seen SQL or LUA and i never realized how complex something so seemingly simple as adding a unit/building by era could be.
do i need one LUA file with this:
Spoiler :
GameEvents.PlayerCanConstruct.Add(function(iPlayer , buildingTypeID)
local prereqEra = GameInfo.Buildings[buildingTypeID].PrereqEra
local playerEra = player:GetCurrentEra();
if playerEra >= prereqEra then
return false;
end
end
return true
end)
or one for each building? Where in the XML do i reference the era?
Do i need to make an SQL with this:
Spoiler :
ALTER TABLE Buildings ADD COLUMN 'PrereqPolicy' TEXT DEFAULT NULL;
and how do i make said SQL run before the xml? Sorry if this is all old news, ive never seen SQL or LUA and i never realized how complex something so seemingly simple as adding a unit/building by era could be.