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

Figuring Out Building Creation

Discussion in 'C2C mod mods' started by Squidimp, Apr 13, 2016.

  1. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    24,727
    Gender:
    Male
    Location:
    Las Vegas
  2. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    Results of XML debug:
    Identified and fixed an apparently unrelated issue with FLAVOUR_RESEARCH by the simple expedient of removing the Flavours. There is also another issue which is claiming to involve the Human Trafficking dependency file and my Ancient Piercings vicinity building somehow. Disabling my common buildings folder solved the problem, so I suppose it must somehow be an issue I caused, but this is also unrelated, as fixing it does not resolve the Pedia display issues.

    If I attempt to view the Great Wonders file, the following error messages are produced:
    Spoiler :
    Code:
    Assert Failed
    
    File:  CvGlobals.cpp
    Line:  3089
    SVN-Rev:  9247
    Expression:  eBuildingClassNum > -1
    Message:  
    
    ----------------------------------------------------------
    
    Assert Failed
    
    File:  CvInfos.cpp
    Line:  14088
    SVN-Rev:  9247
    Expression:  i > -1
    Message:  Index out of bounds
    
    ----------------------------------------------------------
    

    The second is the one that seems to be the issue. The first also occurs when attempting to view National Wonders, but can simply be ignored with no apparent ill effect.
    I checked out the file referenced, but frankly I have no idea how to interpret this output.
     
  3. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,867
    Gender:
    Male
    Location:
    Canberra, Australia
    One of the things I found that can cause this sort of issue is where the default building in the building class file is not the correct one or is misspelt.
     
  4. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    The BuildingClassNum error, or the Index out of Bounds one? I've checked over the buildingclass and building files endlessly trying to figure out the root of this problem, but there aren't any simple mis-spellings. Moreover, this occurs for every Wonder I've added, both individually and as a group. It can't be a simple mistake, it must be something systematic that I'm doing.

    But d*mned if I can figure out what it is.
     
  5. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,867
    Gender:
    Male
    Location:
    Canberra, Australia
    have you posted just the buildings XML? I could have a look, though I am not quite "with it" at the moment.
     
  6. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    24,727
    Gender:
    Male
    Location:
    Las Vegas
    Misspelling FLAVOR may have something to do with that.

    With the asserts you showed, DH is right. You'd have to have a missing BuildingClass definition or something along those lines.
     
  7. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    Whoops, sorry, that isn't actually misspelled in the XML. I just defaulted to my normal spelling when recording the error.
    My XML code is below:
    Spoiler :
    BuildingClassInfos
    Code:
    <Civ4BuildingClassInfos xmlns="x-schema:C2C_CIV4BuildingsSchema.xml">
       <BuildingClassInfos>
           <BuildingClassInfo>
               <Type>BUILDINGCLASS_MOVILE</Type>
               <Description>TXT_KEY_BUILDING_MOVILE</Description>
               <iMaxGlobalInstances>1</iMaxGlobalInstances>
               <iMaxTeamInstances>-1</iMaxTeamInstances>
               <iMaxPlayerInstances>-1</iMaxPlayerInstances>
               <DefaultBuilding>BUILDING_MOVILE</DefaultBuilding>
               <VictoryThresholds/>
           </BuildingClassInfo>
       </BuildingClassInfos>
    </Civ4BuildingClassInfos>
    
    BuildingInfos
    Code:
    <Civ4BuildingInfos xmlns="x-schema:C2C_CIV4BuildingsSchema.xml">
       <BuildingInfos>
       <BuildingInfo>
           <!-- Movile Cave -->
           <BuildingClass>BUILDINGCLASS_MOVILE</BuildingClass>
           <Type>BUILDING_MOVILE</Type>
           <Description>TXT_KEY_BUILDING_MOVILE</Description>
           <Civilopedia>TXT_KEY_BUILDING_MOVILE_PEDIA</Civilopedia>
           <Strategy>TXT_KEY_BUILDING_MOVILE_STRATEGY</Strategy>
           <Advisor>ADVISOR_SCIENCE</Advisor>
           <!-- Graphical and interface -->
           <ArtDefineTag>ART_DEF_BUILDING_MOVILE</ArtDefineTag>
           <MovieDefineTag>ART_DEF_MOVIE_MOVILE</MovieDefineTag>
           <ConstructSound>AS2D_BUILD_LABORATORY</ConstructSound>
           <iMinAreaSize>-1</iMinAreaSize>
           <fVisibilityPriority>1</fVisibilityPriority>
           <!-- Prerequisites -->
           <PrereqTech>TECH_EXTREME_SPORTS</PrereqTech>
               <TechTypes>
                   <PrereqTech>TECH_ECOLOGY</PrereqTech>
               </TechTypes>
           <PrereqOrFeature>
                   <PrereqFeature>
                       <FeatureType>FEATURE_CAVE</FeatureType>
                       <bPrereqFeature>1</bPrereqFeature>
                   </PrereqFeature>
               </PrereqOrFeature>
           <PrereqOrBuildingClasses>
               <PrereqOrBuildingClass>
                   <BuildingClassType>BUILDINGCLASS_BIOLOGY_LAB</BuildingClassType>
                   <bPrereqBuildingClass>1</bPrereqBuildingClass>
               </PrereqOrBuildingClass>
               <PrereqOrBuildingClass>
                   <BuildingClassType>BUILDINGCLASS_MICROBIOLOGY_LAB</BuildingClassType>
                   <bPrereqBuildingClass>1</bPrereqBuildingClass>
               </PrereqOrBuildingClass>
           </PrereqOrBuildingClasses>
           <!-- Construction cost -->
           <iCost>8800</iCost>
           <!-- Specialist effects -->
           <SpecialistCounts>
               <SpecialistCount>
                   <SpecialistType>SPECIALIST_SCIENTIST</SpecialistType>
                   <iSpecialistCount>1</iSpecialistCount>
               </SpecialistCount>
           </SpecialistCounts>
           <!-- Special Yield and Commerce modifiers -->
           <CommerceChanges>
               <iCommerce>0</iCommerce>
               <iCommerce>5</iCommerce>
               <iCommerce>1</iCommerce>
               <iCommerce>0</iCommerce>
           </CommerceChanges>
           <!-- <ObsoleteSafeCommerceChanges>
               <iCommerce>0</iCommerce>
               <iCommerce>0</iCommerce>
               <iCommerce>1</iCommerce>
               <iCommerce>0</iCommerce>
           </ObsoleteSafeCommerceChanges> -->
           <!-- <CommerceChangeDoubleTimes>
               <iCommerce>0</iCommerce>
               <iCommerce>0</iCommerce>
               <iCommerce>1000</iCommerce>
               <iCommerce>0</iCommerce>
           </CommerceChangeDoubleTimes>
           <CommerceChangeOriginalOwners>
               <bCommerceChangeOriginalOwner>0</bCommerceChangeOriginalOwner>
               <bCommerceChangeOriginalOwner>0</bCommerceChangeOriginalOwner>
               <bCommerceChangeOriginalOwner>1</bCommerceChangeOriginalOwner>
               <bCommerceChangeOriginalOwner>0</bCommerceChangeOriginalOwner>
           </CommerceChangeOriginalOwners> -->
           <TechCommerceChanges>
               <TechCommerceChange>
               <PrereqTech>TECH_SEISMOLOGY</PrereqTech>
                   <TechCommerce>
                       <iCommerce>0</iCommerce>
                       <iCommerce>5</iCommerce>
                       <iCommerce>0</iCommerce>
                       <iCommerce>0</iCommerce>
                   </TechCommerce>
               </TechCommerceChange>
               <TechCommerceChange>
               <PrereqTech>TECH_GENCYCLOPEDIA</PrereqTech>
                   <TechCommerce>
                       <iCommerce>0</iCommerce>
                       <iCommerce>5</iCommerce>
                       <iCommerce>0</iCommerce>
                       <iCommerce>0</iCommerce>
                   </TechCommerce>
               </TechCommerceChange>
               <TechCommerceChange>
               <PrereqTech>TECH_MOLECULAR_SCANNING</PrereqTech>
                   <TechCommerce>
                       <iCommerce>0</iCommerce>
                       <iCommerce>5</iCommerce>
                       <iCommerce>0</iCommerce>
                       <iCommerce>0</iCommerce>
                   </TechCommerce>
               </TechCommerceChange>
               <TechCommerceChange>
               <PrereqTech>TECH_SUBTERRANEAN_EXPLORATION</PrereqTech>
                   <TechCommerce>
                       <iCommerce>0</iCommerce>
                       <iCommerce>5</iCommerce>
                       <iCommerce>0</iCommerce>
                       <iCommerce>0</iCommerce>
                   </TechCommerce>
               </TechCommerceChange>
               <TechCommerceChange>
               <PrereqTech>TECH_GAIA_ECOLOGY</PrereqTech>
                   <TechCommerce>
                       <iCommerce>0</iCommerce>
                       <iCommerce>0</iCommerce>
                       <iCommerce>4</iCommerce>
                       <iCommerce>0</iCommerce>
                   </TechCommerce>
               </TechCommerceChange>
           </TechCommerceChanges>
           <TechYieldChanges>
               <TechYieldChange>
                   <PrereqTech>TECH_ABYSS_COLONIZATION</PrereqTech>
                   <TechYield>
                       <iYield>0</iYield>
                       <iYield>3</iYield>
                       <iYield>0</iYield>
                   </TechYield>
               </TechYieldChange>
               <TechYieldChange>
                   <PrereqTech>TECH_NANOMINING</PrereqTech>
                   <TechYield>
                       <iYield>0</iYield>
                       <iYield>3</iYield>
                       <iYield>0</iYield>
                   </TechYield>
               </TechYieldChange>
               <TechYieldChange>
                   <PrereqTech>TECH_DESIGNER_MICROBIOLOGY</PrereqTech>
                   <TechYield>
                       <iYield>0</iYield>
                       <iYield>3</iYield>
                       <iYield>0</iYield>
                   </TechYield>
               </TechYieldChange>
               <TechYieldChange>
                   <PrereqTech>TECH_BACTERIUM_ENGINEERING</PrereqTech>
                   <TechYield>
                       <iYield>0</iYield>
                       <iYield>3</iYield>
                       <iYield>0</iYield>
                   </TechYield>
               </TechYieldChange>
               <TechYieldChange>
                   <PrereqTech>TECH_GAIA_ECOLOGY</PrereqTech>
                   <TechYield>
                       <iYield>0</iYield>
                       <iYield>0</iYield>
                       <iYield>4</iYield>
                   </TechYield>
               </TechYieldChange>
           </TechYieldChanges>
           <!-- Misc effects -->
           <GlobalBuildingExtraCommerces>
               <BuildingExtraCommerce>
                   <BuildingClass>BUILDINGCLASS_SPELUNKING_CAVE</BuildingClass>
                   <CommerceType>COMMERCE_RESEARCH</CommerceType>
                   <iExtraCommerce>3</iExtraCommerce>
               </BuildingExtraCommerce>
           </GlobalBuildingExtraCommerces>
           <GlobalBuildingClassProductionModifiers>
               <BuildingClassProductionModifier>
                   <BuildingClassType>BUILDINGCLASS_SPELUNKING_CAVE</BuildingClassType>
                   <iProductionModifier>100</iProductionModifier>
               </BuildingClassProductionModifier>
           </GlobalBuildingClassProductionModifiers>
           <!-- Great People effects -->
           <GreatPeopleUnitClass>UNITCLASS_SCIENTIST</GreatPeopleUnitClass>
           <iGreatPeopleRateChange>4</iGreatPeopleRateChange>
           <!-- Special properties -->
           <iAsset>4</iAsset>
           <!-- <Flavors>
               <Flavor>
                   <FlavorType>FLAVOR_RESEARCH</FlavorType>
                   <iFlavor>5</iFlavor>
               </Flavor>
           </Flavors> -->
           <iConquestProb>100</iConquestProb>
           <iHurryCostModifier>100</iHurryCostModifier>
           <bTeamShare>1</bTeamShare>
           <bNukeImmune>1</bNukeImmune>
           <iAdvancedStartCost>-1</iAdvancedStartCost>
           <!-- Properties diffusion -->
           <PropertyManipulators>
               <PropertySource>
                   <PropertySourceType>PROPERTYSOURCE_CONSTANT</PropertySourceType>
                   <PropertyType>PROPERTY_WATER_POLLUTION</PropertyType>
                   <iAmountPerTurn>10</iAmountPerTurn>
               </PropertySource>
               <PropertySource>
                   <PropertySourceType>PROPERTYSOURCE_CONSTANT</PropertySourceType>
                   <PropertyType>PROPERTY_WATER_POLLUTION</PropertyType>
                   <iAmountPerTurn>-5</iAmountPerTurn>
                   <Active>
                   <Has>
                       <GOMType>GOM_TECH</GOMType>
                       <ID>TECH_DESIGNER_MICROBIOLOGY</ID>
                   </Has>
                   </Active>
               </PropertySource>
               <PropertySource>
                   <PropertySourceType>PROPERTYSOURCE_CONSTANT</PropertySourceType>
                   <PropertyType>PROPERTY_WATER_POLLUTION</PropertyType>
                   <iAmountPerTurn>-5</iAmountPerTurn>
                   <Active>
                   <Has>
                       <GOMType>GOM_TECH</GOMType>
                       <ID>TECH_BACTERIUM_ENGINEERING</ID>
                   </Has>
                   </Active>
               </PropertySource>
               <PropertySource>
                   <PropertySourceType>PROPERTYSOURCE_CONSTANT</PropertySourceType>
                   <PropertyType>PROPERTY_TOURISM</PropertyType>
                   <iAmountPerTurn>4</iAmountPerTurn>
                   <Active>
                   <Has>
                       <GOMType>GOM_TECH</GOMType>
                       <ID>TECH_GAIA_ECOLOGY</ID>
                   </Has>
                   </Active>
               </PropertySource>
           </PropertyManipulators>
       </BuildingInfo>
       </BuildingInfos>
    </Civ4BuildingInfos>
    

    You can see that BUILDING_MOVILE is identical in each case (I copy paste in any case).
    If I comment out an effect, the failure to load doesn't change, so this isn't the result of the properties system or anything. As far as I can make out, everything should be fine. The template I have been using is one that I copied directly from other outsourced wonders. Moreover, this is the only additional wonder loaded at the moment, but the problem persists.
     
    Last edited: Nov 16, 2016
  8. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    24,727
    Gender:
    Male
    Location:
    Las Vegas
  9. Harrier

    Harrier Chieftain

    Joined:
    Feb 19, 2002
    Messages:
    2,345
    Location:
    UK
    Do not worry, the Americans never could spell correctly. :lol::mischief:
     
  10. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,867
    Gender:
    Male
    Location:
    Canberra, Australia
    first point assuming you have these in your own my_mod folder is that you should not be refering to C2C_CIV4BuildingsSchema.xml. You should have copied it into the folder and given it a new name then refer to that eg Squidimp_CIV4BuildingsSchema.xml. This way you now that you are getting the correct schema and not accidentally overwriting the main schema.

    edit everything works fine when I put that building in my version of the game. What are your art defines?
     
    Last edited: Nov 17, 2016
  11. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    The art def is:
    Spoiler :
    Code:
    <Civ4ArtDefines xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="..\Schema\Caveman2Cosmos.xsd">
       <BuildingArtInfos>
           <BuildingArtInfo>
               <Type>ART_DEF_BUILDING_MOVILE</Type>
               <LSystem>LSYSTEM_1x1</LSystem>
               <bAnimated>0</bAnimated>
               <fScale>0</fScale>
               <fInterfaceScale>0</fInterfaceScale>
               <NIF>Art/Empty.nif</NIF>
               <KFM/>
               <Button>Modules\My_Mods\Squidmods\Art\Movile.dds</Button>
           </BuildingArtInfo>
       </BuildingArtInfos>
    </Civ4ArtDefines>
    

    Your Wonders section loads fine? If you clear the cache, does it still load fine?

    I didn't know about the schema renaming thing. I should probably go do that.
     
  12. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,867
    Gender:
    Male
    Location:
    Canberra, Australia
    I loaded a different Mod which clears the cache and it still works fine

    Try changing
    <Button>Modules\My_Mods\Squidmods\Art\Movile.dds</Button>
    to
    <Button>Art\Movile.dds</Button>

    Usually I would make the folder structure the same as it would be when the building was in core. so Art\Interface\Buttons\Buildings\Movile.dds but it should work fine. In fact it should work fine as you have it but we have changed some things about the loading and that may be causing a problem.

    edit also make sure the button is exactly 64x64 pixels
     
    Last edited: Nov 17, 2016
  13. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    The second format failed to locate the button (which I have verified to be 64x64 pixels).

    My most recent tests turned up a failure to load even without my wonders XML file in the My_Mods folder! Given that you cannot recreate the problem, it seems possible that it isn't an XML issue at all, unless some other part of my mod is somehow causing the problem. Could this be the result of folder structure? Adding movies to the remember-movies file?

    I am tempted to try a re-adding the mod bit-by-bit to a clean install. The problem has already followed me through multiple C2C installs, however.
     
  14. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,867
    Gender:
    Male
    Location:
    Canberra, Australia
    I created a folder under My_Mods called Squidimp and a folder under that called Art. I then copied the C2C building schema into the base folder and renamed it. Then I put your building class and building info XML into files. Copied your Art defines files. Then copied a button from elsewhere and renamed it Movile.dds. I then changed the Art defines path for the button. It all works for me.:confused:

    You don't need to add the movies to the remember movies file until it goes into core. The only bug that may cause is that the movie wont play.

    Folder structure should not matter. The My_Mods folder is set up so as it should not matter at all. I have mods in there with XML in multiple levels and they are working.
     
  15. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    The problem has been resolved! It looks like it was two separate problems, caused by some superfluous schema files! Thank you for your assistance DH, it would have been much harder without your help.

    When I get around to updating everything should be working (once I re-test the Python stuff).
     

Share This Page