Technologie Tree Help

blazekid87

Warlord
Joined
Oct 5, 2010
Messages
179
Location
NYC
Hello everyone, Im creating a mod andim hoping to implement some technologies early in the game such as fire which is gonna be a prereq for mining instead of agriculture. What I would like to know is how to add the technology, remove the current prereq and add the new prereq.

:confused:
 
well, have a look at the CIV5technoligies.xml, it quite speak for itself :)
 
OK well i got it mostly figured out except one part. I have already added all the technologies just need how to change the current PrereqTech for a technology. For example I want my fire technology to lead to pottery instead of agriculture. This is what I got.

Spoiler :

<Update>
<Set PrereqTech ="TECH_FIRE"/>
<Where Type ="TECH_POTTERY"/>
</Update>


What am I doing wrong??
 
is your fire tech showing on the tech tree?

I think those requirement are mainly there to draw the white lines beetween tech, but I guess the fire has to be on screen for it to work.
 
Yea Everything Shows up I juss need to change the lines leading from agriculture to pottery to fire going to pottery. I think I figured it out after looking through the SQL logs.

Spoiler :
<Update>
<Set PrereqTech ="TECH_FIRE"/>
<Where TechType ="TECH_POTTERY"/>
</Update>


Ill give it a try
 
Yea that was the problem....now the Eras are not correctly alligned. The Eras codes dont have any info on GridX. How do I edit these?? or even add a new one?
 
I think so too.

I worked a little on the tech tree, trying to delete things, and it keeps breaking up. Couldn't find anything about that in XML :/
 
The eras get broken (and the scroll bar stops working) if any of the tech information is missing. Try putting some dummy info in all of the columns (copy and past from pottery), and see if it works. Also make sure the line can reach the tech from the left hand side (prereqs have to be above or below and behind the tech they are a prereq for).

Edit: And if that doesn't work try setting the ID to 0
 
hmm, well i took a look at the LUA script for technologies. It looks like it automatically calculates the eras from the XML file. The problem is it calculates it from the main dir and most likely only once, when the game is first loaded. This is prob the reason why my eras look messed up. here the code i was talking about:

Spoiler :
function AddEraPanels()
-- find the range of columns that each era takes
for tech in GameInfo.Technologies() do
local eraID = GameInfo.Eras[tech.Era].ID;
if not eraColumns[eraID] then
eraColumns[eraID] = { minGridX = tech.GridX; maxGridX = tech.GridX; researched = false; };
else
if tech.GridX < eraColumns[eraID].minGridX then
eraColumns[eraID].minGridX = tech.GridX;
end
if tech.GridX > eraColumns[eraID].maxGridX then
eraColumns[eraID].maxGridX = tech.GridX;
end
end
end


Anybody have any experience with coding these techs in LUA? How could I change the path of the directory to load the tech tree from my mod instead? Is it possible to also add your own Eras?
 
Here is a photo to explain the problem, notice how Sailing, calendar, writing, etc. are all located in the Classical Era after I shifted all the techs. I want the LUA file to update the ERA locations based on my modified Technologies.xml and not the one that is located in the Install Dir.
 

Attachments

Hi again dude,

Im 100% sure u need to do it in Lua not XML, ive bee messing with the tech tree myself but for other purposes(Renaming the Eras themselves), the file you need is:- TechTree.Lua

The code is:-

Spoiler :
function AddEraPanels()
-- find the range of columns that each era takes
for tech in GameInfo.Technologies() do
local eraID = GameInfo.Eras[tech.Era].ID;
if not eraColumns[eraID] then
eraColumns[eraID] = { minGridX = tech.GridX; maxGridX = tech.GridX; researched = false; };
else
if tech.GridX < eraColumns[eraID].minGridX then
eraColumns[eraID].minGridX = tech.GridX;
end
if tech.GridX > eraColumns[eraID].maxGridX then
eraColumns[eraID].maxGridX = tech.GridX;
end
end
end

-- add the era panels
for era in GameInfo.Eras() do
local thisEraBlockInstance = g_EraManager:GetInstance();
-- store this panel off for later
eraBlocks[era.ID] = thisEraBlockInstance;

-- add the correct text for this era panel
local textString = "TXT_KEY_ERAS_"..tostring( era.ID );
local localizedLabel = Locale.ConvertTextKey( textString );
thisEraBlockInstance.OldLabel:SetText( localizedLabel );
thisEraBlockInstance.CurrentLabel:SetText( localizedLabel );
thisEraBlockInstance.FutureLabel:SetText( localizedLabel );

-- adjust the sizes of the era panels
local blockWidth = (eraColumns[era.ID].maxGridX - eraColumns[era.ID].minGridX + 1);
blockWidth = (blockWidth * blockSpacingX);
if era.ID == 0 then
blockWidth = blockWidth + 32;
end
local blockSize = thisEraBlockInstance.EraBlock:GetSize();
blockSize.x = blockWidth;
thisEraBlockInstance.EraBlock:SetSize( blockSize );
blockSize = thisEraBlockInstance.FrameBottom:GetSize();
blockSize.x = blockWidth;
thisEraBlockInstance.FrameBottom:SetSize( blockSize );

blockSize = thisEraBlockInstance.OldBar:GetSize();
blockSize.x = blockWidth;
thisEraBlockInstance.OldBar:SetSize( blockSize );
blockSize = thisEraBlockInstance.OldBlock:GetSize();
blockSize.x = blockWidth;
thisEraBlockInstance.OldBlock:SetSize( blockSize );

blockSize = thisEraBlockInstance.CurrentBlock:GetSize();
blockSize.x = blockWidth;
thisEraBlockInstance.CurrentBlock:SetSize( blockSize );
blockSize = thisEraBlockInstance.CurrentBlock1:GetSize();
blockSize.x = blockWidth;
thisEraBlockInstance.CurrentBlock1:SetSize( blockSize );
blockSize = thisEraBlockInstance.CurrentBlock2:GetSize();
blockSize.x = blockWidth;
thisEraBlockInstance.CurrentBlock2:SetSize( blockSize );

blockSize = thisEraBlockInstance.CurrentTop:GetSize();
blockSize.x = blockWidth;
thisEraBlockInstance.CurrentTop:SetSize( blockSize );
blockSize = thisEraBlockInstance.CurrentTop1:GetSize();
blockSize.x = blockWidth;
thisEraBlockInstance.CurrentTop1:SetSize( blockSize );
blockSize = thisEraBlockInstance.CurrentTop2:GetSize();
blockSize.x = blockWidth;
thisEraBlockInstance.CurrentTop2:SetSize( blockSize );

blockSize = thisEraBlockInstance.FutureBlock:GetSize();
blockSize.x = blockWidth;
thisEraBlockInstance.FutureBlock:SetSize( blockSize );
end


And its about Half way down the file, line 349.

Dont take this for granted, I realy do not know much about Lua, but enough about coding to get the general gist.
 
I juss finished adding the Pre-Historic Era and I was able to do it all through XML. The trick if you want to create an Era that is before all others, you must delete them all and assign the ID numbers in the order you want them to appear. You must then delete all the name tags and reassign them. Its alot more simple if you want to add an Era after the future.

The code above determins the minimum and maximum size of each era by comparing the technologies and their GridX values.

I posted the mod up, so you can check it out here:
http://forums.civfanatics.com/showthread.php?t=389419
 
Back
Top Bottom