1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Can A Building Grant A Specific Tech?

Discussion in 'CivBE - Modding Help & Mod Creation' started by Bandobras Took, Sep 12, 2017.

  1. Bandobras Took

    Bandobras Took Chieftain

    Joined:
    Jun 27, 2007
    Messages:
    1,917
    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?
     
  2. Ryika

    Ryika Lazy Wannabe Artista

    Joined:
    Aug 30, 2013
    Messages:
    9,396
    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: Sep 13, 2017
  3. Bandobras Took

    Bandobras Took Chieftain

    Joined:
    Jun 27, 2007
    Messages:
    1,917
    Location:
    Orem, UT
    That's okay; if I type it there are going to be errors. :) Thanks!
     

Share This Page