• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Can A Building Grant A Specific Tech?

Bandobras Took

Emperor
Joined
Jun 27, 2007
Messages
1,923
Location
Orem, UT
The option's available in the Cargo xml, but I can't find something similar in the Building table.

Is there a way to get a building to Grant Techs like the Laboratory option for cargo does?
 
Only with lua.

Something like...

Code:
function OnBuildingProcessed(iPlayer, iBuilding, iCity, buildingAdded)
    local pPlayer            = Players[iPlayer]
    local pTeam                = Teams[pPlayer:GetTeam()];
    local teamTechs            = team:GetTeamTechs();

    if buildingAdded == true then
        if GameInfo.Buildings[iBuilding] == GameInfo.Buildings["BUILDING_YOUR_BUILDING"] then
            pTeam:SetHasTech(GameInfo.Technologies["TECH_YOUR_TECH"].ID, true)
        end                    
    end
end
GameEvents.BuildingProcessed.Add(OnBuildingProcessed)

Don't have the time to run it, so there might be errors.
 
Last edited:
Back
Top Bottom