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

Adding New Techs

Discussion in 'CivBE - Modding Help & Mod Creation' started by Starrynite120, Apr 15, 2016.

  1. Starrynite120

    Starrynite120 Chieftain

    Joined:
    Jul 15, 2015
    Messages:
    469
    How do you add new technologies to the game? I'm getting a repeated lua error with this below code and the game won't load. I do want it to be a leaf tech.

    Code:
    
    	<Technologies>
    		<Row>
    			<Type>TECH_ENGINEERING_2</Type>
    			<Cost>75</Cost>
    			<LeafTech>true</LeafTech>
    			<Description>TXT_KEY_TECH_ENGINEERING_2</Description>
    			<Civilopedia>TXT_KEY_TECH_ENGINEERING_2_DESC</Civilopedia>
    			<Help>TXT_KEY_TECH_ENGINEERING_2_HELP</Help>
    			<Quote>TXT_KEY_TECH_ENGINEERING_2_QUOTE</Quote>
    			<IconAtlas>TECH_ATLAS_1</IconAtlas>
    			<PortraitIndex>12</PortraitIndex>
    			<AudioIntroHeader>AS2D_HEADING_TECH_ENGINEERING_2</AudioIntroHeader>
    		</Row>
    	</Technologies>
    
    	<Technology_Connections>
    		<Row>
    			<FirstTech>TECH_ENGINEERING</FirstTech>
    			<SecondTech>TECH_ENGINEERING_2</SecondTech>
    		</Row>
    	</Technology_Connections>
    
    
    
    
     
  2. Valessa

    Valessa Communistress

    Joined:
    Aug 30, 2013
    Messages:
    8,109
    Gender:
    Female
    Leaftech-Connections require the LeafTech to be indexed in the "FirstTech"-row.
     
  3. Starrynite120

    Starrynite120 Chieftain

    Joined:
    Jul 15, 2015
    Messages:
    469
    Oh, that's weird. Good to know though, thanks.
     
  4. Valessa

    Valessa Communistress

    Joined:
    Aug 30, 2013
    Messages:
    8,109
    Gender:
    Female
    Yeah, not quite intuitive. Took me a while to figure out as well, it's just the way they coded the tech web.
     
  5. Starrynite120

    Starrynite120 Chieftain

    Joined:
    Jul 15, 2015
    Messages:
    469
    So I tried what you said and I still got the error. I should mention that I have redesigned the entire tech web. Perhaps that's causing the problem?
     
  6. HandyVac

    HandyVac Gentleman

    Joined:
    Apr 24, 2014
    Messages:
    270
    Gender:
    Male
    Location:
    The shire where the oxen cross the river. UK.
    I notice you've set the AudioIntroHeader as AS2D_HEADING_TECH_ENGINEERING_2, which, unless you've created it yourself in the <Script2DSounds> table, doesn't exist.

    You can safely leave AudioIntroHeader blank (if you don't want any voiceover to be played), or use the same value as an existing tech (if you want to re-use an existing voiceover), but referencing a voiceover that doesn't exist may cause errors.
     
  7. Starrynite120

    Starrynite120 Chieftain

    Joined:
    Jul 15, 2015
    Messages:
    469
    Just tried that. Unfortunately that didn't fix the problem either.
     
  8. Valessa

    Valessa Communistress

    Joined:
    Aug 30, 2013
    Messages:
    8,109
    Gender:
    Female
    Go into the Lua.Log and see at which line the tech web errors out.
     
  9. Starrynite120

    Starrynite120 Chieftain

    Joined:
    Jul 15, 2015
    Messages:
    469
    This is the error message I'm getting:

    Code:
    
     Runtime Error: Assets\DLC\Expansion1\UI\InGame\TechTree\TechTree.lua:459: attempt to index a nil value
    stack traceback:
    	Assets\DLC\Expansion1\UI\InGame\TechTree\TechTree.lua:459: in function 'AddTechNode'
    	Assets\DLC\Expansion1\UI\InGame\TechTree\TechTree.lua:1357: in function 'OnGivenTimeSliceRemotely'
    	[C]: in function 'func'
    	[C]: in function 'lMetaCall'
    	Assets\DLC\Expansion1\UI\FrontEnd\LoadScreen.lua:390: in function 'OnUpdate_TechTree'
    
    
     
  10. Valessa

    Valessa Communistress

    Joined:
    Aug 30, 2013
    Messages:
    8,109
    Gender:
    Female
    Which would be this part:
    Code:
    function AddTechNode( tech )
    
    	-- Build node type based on if this is a "full" node or a leaf node.
    	local thisTechButtonInstance;
    	[B]if (tech.LeafTech) then[/B]
    [...]
    
    Given that that function is being called directly after looping through the Tech-Table my assumption would be that you've deleted technologies without fixing the technology IDs. If that's correct see this thread for a solution: http://forums.civfanatics.com/showthread.php?t=463429
     
  11. Starrynite120

    Starrynite120 Chieftain

    Joined:
    Jul 15, 2015
    Messages:
    469
    I don't think I've deleted any technologies. I've given these delete commands

    Code:
    
    DELETE FROM Technology_Affinities;
    DELETE FROM Technology_Flavors;
    DELETE FROM Technology_FreePromotions;
    DELETE FROM Technology_FreePlayerPerks;
    DELETE FROM Technology_Connections;
    DELETE FROM Improvement_TechYieldChanges;
    
    
    but then I reset them. I have rearranged the entire tech web, and I do have some technologies that I moved to gridradius 10 and set no connections to them, idk if that would be causing any problem.
     
  12. Valessa

    Valessa Communistress

    Joined:
    Aug 30, 2013
    Messages:
    8,109
    Gender:
    Female
    That should only cause problems if you forgot to set LeafTech=false
     
  13. Starrynite120

    Starrynite120 Chieftain

    Joined:
    Jul 15, 2015
    Messages:
    469
    I have set the leaftech = false on those. I have no problems regarding technologies until I try and add new ones.
     
  14. Starrynite120

    Starrynite120 Chieftain

    Joined:
    Jul 15, 2015
    Messages:
    469
    So I changed my new tech to a branch tech and now it works. I can just switch it out for other techs for a solution. Thanks for your advice everyone!
     
  15. roadmaster

    roadmaster Chieftain

    Joined:
    Apr 28, 2015
    Messages:
    20
    In your original XML did you add in "GridRadius and GridDegrees"?

    When creating a new custom Base Tech you have to tell it where to place it on your Tech Web, The GridRadius and GridDegrees tells the game where to put your new Base Tech, here is one I Created: The one thing to watch for is overcrowding :) you may have to modify where an original Tech is positioned you can do that by using the Update function in your XML, look below for my implementations.

    Code:
        
    <Technologies>
        <Row>
            <Type>TECH_ARMAMENTS</Type>
            <Cost>280</Cost>
            <GridRadius>1.05</GridRadius>
            <GridDegrees>183</GridDegrees>
            <Description>TXT_KEY_TECH_ARMAMENTS_DESC</Description>
            <Civilopedia>TXT_KEY_TECH_ARMAMENTS_PEDIA</Civilopedia>
            <Help>TXT_KEY_TECH_ARMAMENTS_HELP</Help>
            <Quote>TXT_KEY_TECH_ARMAMENTS_QUOTE</Quote>
            <IconAtlas>AF_TECHNOLOGY_ICON</IconAtlas><!-- TECH_ATLAS_1-->
            <PortraitIndex>0</PortraitIndex>
            <AudioIntro>AS2D_TECH_HABITATION</AudioIntro>
            <AudioIntroHeader>AS2D_HEADING_TECH_HABITATION</AudioIntroHeader>
            <UnitBaseMiasmaHeal>3</UnitBaseMiasmaHeal>
        </Row>
    </Technologies>
    
    Then Also in the Technologies section add a first Leaf to it you do it like this:

    Code:
    <Row>
        <Type>TECH_MOBILE_ARMAMENTS</Type>
        <Cost>360</Cost>
        <LeafTech>true</LeafTech>
        <Description>TXT_KEY_TECH_MOBILE_ARMAMENTS_DESC</Description>
        <Civilopedia>TXT_KEY_TECH_MOBILE_ARMAMENTS_PEDIA</Civilopedia>
        <Help>TXT_KEY_TECH_MOBILE_ARMAMENTS_HELP</Help>
        <Quote>TXT_KEY_TECH_MOBILE_ARMAMENTS_QUOTE</Quote>
        <IconAtlas>AF_TECHNOLOGY_ICON</IconAtlas>
        <!-- TECH_ATLAS_1-->
        <PortraitIndex>0</PortraitIndex>
        <AudioIntro>AS2D_TECH_HABITATION</AudioIntro>
        <AudioIntroHeader>AS2D_HEADING_TECH_HABITATION</AudioIntroHeader>
    </Row>
    
    Then you have to Connect your base Tech to an existing Tech near where your placing your custom one, My TECH_ARMAMENTS connects to the original TECH_ENGINEERING Tech, my TECH_MOBILE_ARMAMENTS then connects to my Base TECH_ARMAMENTS. I actually have a second leaf but I left it out of this explanation.

    Code:
    <Technology_Connections>
        <Row>
            <FirstTech>TECH_ENGINEERING</FirstTech>
            <SecondTech>TECH_ARMAMENTS</SecondTech>
        </Row>
        <Row>
            <FirstTech>TECH_MOBILE_ARMAMENTS</FirstTech>
            <SecondTech>TECH_ARMAMENTS</SecondTech>
        </Row>
    </Technology_Connections>
    
    Code:
        <Technologies>
            <!-- Moves the below Tech Branches to make room for my custom Tech Branch Armaments-->
            <Update>
                <Where Type="TECH_PHYSICS"></Where>
                <Set GridDegrees="220" GridRadius="1.10"/>
            </Update>
            <Update>
                <Where Type="TECH_ENGINEERING"/>
                <Set GridDegrees="135" GridRadius="1.20"/>
            </Update>
        </Technologies>
    
    Hope this helps.

    Edit: If you want to add a building to your Tech Leaf you only have to add one line to your Building Xml.

    Code:
    <Buildings>
        <!-- Special Buildings -->
        <Row>
            <Type>BUILDING_FRANKSPIZZA</Type>
            <BuildingClass>BUILDINGCLASS_FRANKSPIZZA</BuildingClass>
            <Description>TXT_KEY_BUILDING_FRANKSPIZZA_DESC</Description>
            <Civilopedia>TXT_KEY_BUILDING_FRANKSPIZZA_PEDIA</Civilopedia>
            <Help>TXT_KEY_BUILDING_FRANKSPIZZA_HELP</Help>
            <!-- [COLOR="Red"]PrereqTech is what adds it to your Custom Tech[/COLOR] -->
            <PrereqTech>TECH_ARMAMENTS</PrereqTech>
            <Cost>240</Cost>
            <ConquestProbability>67</ConquestProbability>
            <HurryCostModifier>-1</HurryCostModifier>
            <!-- This should be a float value. 1000 is actually 10.00 -->
            <Defense>500</Defense>
            <IconAtlas>AF_BUILDINGS_ATLAS</IconAtlas>
            <PortraitIndex>3</PortraitIndex>
            <Health>1</Health>
        </Row>
    </Buildings>
    
     

Share This Page