Announcement

Collapse
No announcement yet.

Problem Creating New Buildings

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem Creating New Buildings

    Am trying to follow the example in the howto section here. Creating a new building.

    I have copied the BUILDINGINFO for an Obelisk and pasted a new one into my CIV4BuildingInfos.xml

    (BuildingInfo)(BuildingClass)BUILDINGCLASS_OBELISK (/BuildingClass)(Type)BUILDING_GREEK_STATUE(/Type)(/BuildingInfo)

    I have NOT added an entry to the CIV4BuildingClass Infos because its an instance of the Obelisk class. I then added my building lines to my Civ4CivilizationInfos.xml as per the Bollywood example.

    (Building) (BuildingClassType)BUILDINGCLASS_OBELISK(/BuildingClassType)(BuildingType)BUILDING_GREEK_STA TUE(/BuildingType)(/Building)

    However when I load my mod I get the message "BUILDING_GREEK_STATUE in Info class was incorrect. Current XML file is: CIV4CivilizationInfos.

    Any ideas why such a simple example isn't working ?

  • #2
    Ok, let me just get this straight (I hate having to deal with () instead of <> all the time)...

    Here is a (clipped) version of the original Obelisk code from 'CIV4BuildingInfos.xml':
    Code:
    		<BuildingInfo>
    			<BuildingClass>BUILDINGCLASS_OBELISK</BuildingClass>
    			<Type>BUILDING_OBELISK</Type>
    			<SpecialBuildingType>NONE</SpecialBuildingType>
    			<Description>TXT_KEY_BUILDING_OBELISK</Description>
    			<Civilopedia>TXT_KEY_BUILDING_OBELISK_PEDIA</Civilopedia>
    			<Strategy>TXT_KEY_BUILDING_OBELISK_STRATEGY</Strategy>
    			<Advisor>ADVISOR_CULTURE</Advisor>
    			<ArtDefineTag>ART_DEF_BUILDING_OBELISK</ArtDefineTag>
    
    			...
    
    			<bAltDown>0</bAltDown>
    			<bShiftDown>0</bShiftDown>
    			<bCtrlDown>0</bCtrlDown>
    			<iHotKeyPriority>0</iHotKeyPriority>
    		</BuildingInfo>
    And you want to add a unique building to your Civ. Firt problem is the use of <BuildingType> when it should just be <type>. Secondly, it would be a good idea if you added a Prefix (or Suffix) to the name, to destinguish it from Vanilla code. Thus you should end up with something like this (replace [Mod] with the name of your mod):
    Code:
    		<BuildingInfo>
    			<BuildingClass>BUILDINGCLASS_OBELISK</BuildingClass>
    			<Type>[b][Mod]_BUILDING_GREEK_STATUE[/b]</Type>
    			<SpecialBuildingType>NONE</SpecialBuildingType>
    			<Description>[b]TXT_KEY_[Mod]_BUILDING_GREEK_STATUE[/b]</Description>
    			<Civilopedia>[b]TXT_KEY_[Mod]_BUILDING_GREEK_STATUE_PEDIA[/b]</Civilopedia>
    			<Strategy>TXT_KEY_BUILDING_OBELISK_STRATEGY</Strategy>
    			<Advisor>ADVISOR_CULTURE</Advisor>
    			<ArtDefineTag>ART_DEF_BUILDING_OBELISK</ArtDefineTag>
    
    			...
    
    			<bAltDown>0</bAltDown>
    			<bShiftDown>0</bShiftDown>
    			<bCtrlDown>0</bCtrlDown>
    			<iHotKeyPriority>0</iHotKeyPriority>
    		</BuildingInfo>
    The changed bits are in Bold. This is not a definative list of changes, due to the fact the code is clipped for this post, but you should be able to spot the other places you'd want to change things. I've left the <ArtDefineTag> etc as the Obelisk, as I don't know whether you want to add your own art or not.

    PS: I admit to never having made my own buildings or even read the HowTo you followed, but I do know enough about XML/XHTML to say that if it works once, then Copy/Paste is enough... as long as you Copy/Paste enough of the code.
    Ceeforee v0.1 - The Unofficial Civ 4 Editor -= Something no Civ Modder should ever be without =- Last Updated: 27/03/2009
    "Just because I'm paranoid doesn't mean there's no conspiracy"

    Comment


    • #3
      ??? Spot the difference

      Um thanks for that, but I'm not sure that you're suggesting anything different to what I've done.

      I only use the buildingtype tag in the Civ4Civilisation file NOT the BuildingInfo file where I use Type.

      Comment


      • #4
        Sorry... Part of what I was was doing was just trying to make what you had done, slightly easier to read (and compare with the original XML).

        As you can tell, even then I still misunderstood what you had said, so I'll try and sort that out in a mo.

        You are trying to make a Greek-only building, right?
        Ceeforee v0.1 - The Unofficial Civ 4 Editor -= Something no Civ Modder should ever be without =- Last Updated: 27/03/2009
        "Just because I'm paranoid doesn't mean there's no conspiracy"

        Comment


        • #5
          OK, having looked at the BuildingClass Code, it would appear that you need a seperate class, even though it would be the same as the Obelisk (although the description would differ).
          Ceeforee v0.1 - The Unofficial Civ 4 Editor -= Something no Civ Modder should ever be without =- Last Updated: 27/03/2009
          "Just because I'm paranoid doesn't mean there's no conspiracy"

          Comment


          • #6
            OK Complete Code

            Ok I guess we need my complete code. See below:

            CIV4CivilizationInfos.xml


            <Buildings>

            <Building>

            <BuildingClassType>BUILDINGCLASS_OBELISK</BuildingClassType>

            <BuildingType>BUILDING_GRK_STATUE</BuildingType>

            </Building>

            </Buildings>


            CIV4BuildingInfos.xml


            <BuildingInfo>

            <BuildingClass>BUILDINGCLASS_OBELISK</BuildingClass>

            <Type>BUILDING_GRK_STATUE</Type>

            <SpecialBuildingType>NONE</SpecialBuildingType>

            <Description>Fancy Greek Style Statue </Description>

            <Civilopedia>TXT_KEY_BUILDING_OBELISK_PEDIA</Civilopedia>

            <Strategy>TXT_KEY_BUILDING_OBELISK_STRATEGY</Strategy>
            ...
            </BuildingInfo>

            CIV4BuildingClassInfos.xml

            <BuildingClassInfo>

            <Type>BUILDINGCLASS_GRK_STATUE</Type>

            <Description>Nice Greek Style Statue</Description>

            <iMaxGlobalInstances>-1</iMaxGlobalInstances>

            <iMaxTeamInstances>-1</iMaxTeamInstances>

            <iMaxPlayerInstances>-1</iMaxPlayerInstances>

            <iExtraPlayerInstances>0</iExtraPlayerInstances>

            <bNoLimit>0</bNoLimit>

            <DefaultBuilding>BUILDING_GRK_STATUE</DefaultBuilding>

            <VictoryThresholds/>

            </BuildingClassInfo>

            Comment


            • #7
              Now that you've defined the new class, don't forget to change the references the the Obelisk class.
              Ceeforee v0.1 - The Unofficial Civ 4 Editor -= Something no Civ Modder should ever be without =- Last Updated: 27/03/2009
              "Just because I'm paranoid doesn't mean there's no conspiracy"

              Comment


              • #8
                Well I Don't See Why This Doesn't Work

                Code looks fine to me.
                Can I use xml spy or anything else to get a more helpful error message sat least showing me what line it doesn't like.

                Comment

                Working...
                X