How to upgrade 'classic' tech tree shape?

maxf

Chieftain
Joined
Jan 4, 2019
Messages
60
In general, I have two questions:
1. How add more "circles" to techs where we can see new units, buildings etc. 5 is not enouth.
2. How to change order in these "circles"? Say, wonders first, next buildings, units and so on.

Moderator Action: Moved to main C&C forum as that is where we post questions. leif
 
Last edited by a moderator:
Both require a considerable understanding of the CivV UI code, and how to replace it with a mod.

a) The "circles" are the buttons B1 thru B5 defined in TechTree.xml and referenced in the function AddSmallButtonsToTechButton in the TechButtonInclude.lua file. To add more you would need to make the techs bigger, which also requires changing the connection lines and the size of the eras, then adding extra buttons (B6 onwards) (all in the XML UI context), then changing "local maxSmallButtons = 5;" in TechTree.lua to reflect how many you added.

b) Slightly easier, as the order is hard-coded in the function AddSmallButtonsToTechButton in the TechButtonInclude.lua file - so just change the code around for your desired order.

HTH
 
Thank you. Yes, I see that a) is the complex problem whereas b) not so hard. I placed wonders first by adding 2 lines in TechButtonInclude.lua code and repeat one block:
Code:
     for thisBuildingInfo in GameInfo.Buildings(string.format("PreReqTech = '%s'", techType)) do
         -- if this tech grants this player the ability to construct this building
        local thisBuildingClass = GameInfo.BuildingClasses[thisBuildingInfo.BuildingClass];                --!
        if thisBuildingClass.MaxGlobalInstances == 1 then                                                                    --!
            if validBuildingBuilds[thisBuildingInfo.BuildingClass] == thisBuildingInfo.Type then
                local buttonName = "B"..tostring(buttonNum);
                local thisButton = thisTechButtonInstance[buttonName];
                if thisButton then
                    AdjustArtOnGrantedBuildingButton( thisButton, thisBuildingInfo, textureSize );
                    buttonNum = buttonNum + 1;
                end
            end
        end
     end

Btw i'm surprised what a weak language. I tried first "if thisBuildingInfo.BuildingClass.MaxGlobalInstances == 1 then" - it don't work, so I had to add thisBuildingClass variable.
 
Back
Top Bottom