1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    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,878
    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. Valessa

    Valessa innocent

    Joined:
    Aug 30, 2013
    Messages:
    6,779
    Gender:
    Female
    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 at 2:53 AM
  3. Bandobras Took

    Bandobras Took Chieftain

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

Share This Page