[ModBuddy Snippets] Easy templates for Units and Technologies

RandomPete

Chieftain
Joined
Oct 8, 2010
Messages
34
Hi folks,

Wasn't sure where to post as there isn't a specific forum for ModBuddy-related files.

Visual Studio (which ModBuddy is based on) has a feature called "Code Snippets" which allows you to create simple text templates for anything where you find you have to type the same bits of code over and over again.

I was starting to find it a bit annoying copying and pasting the XML definitions for things like Units and Technologies and making sure I updated all the Type references, text tags and so on ... so I made a couple of Snippets that automate the whole thing. You enter your tech Type once, and it creates all the normal linked blocks and language definitions for you.

To use them, unzip the attached file to:
My Documents\Firaxis ModBuddy\Code Snippets\XML\My Xml Snippets

Then, just right-click inside your <GameData> element and click "Insert Snippet..." (or use shortcut CTRL-K, CTRL-X). Choose "Civ 5 Unit" or "Civ 5 Tech". The whole template will then appear and you can tab between fields.

Technologies explanation:

- The first field is "Title". I always put it in a comment at the beginning to make my XML files clear. It will also be used for you in the <Description> text block at the end.

- The second field is "TypePrefix". This is because I've been using FiresForever's Multiple Page Tech Tree, and by leaving the default /Page2/_ here your tech would be on page 2. If you don't like this you can edit civtech.snippet and find/replace to remove all occurrences of $TypePrefix$ . I wanted it a separate field so it didn't make all the sound and text references look ugly (perhaps I'm being a bit obsessive there!)

- The third field is the main Type name and will be reused in all the other bits like sound and text references.

- Keep tabbing through for all the other standard fields you'll probably want to edit

The Unit template is pretty similar, it just doesn't have the odd prefix bit. Most of the values are based on the UNIT_WARRIOR defaults as a point of reference.

I included most of the common values and side tables so you'll still have to go off and look at the schema and game files for anything more advanced. The .snippet files are pretty easy to make and customise so just use these as a starting guide!

Also you don't have to put snippets in the default directory, go to "Tools -> Code Snippets Manager..." and select XML in the drop-down list - there you can add extra snippet folders.

Complete Tech generated definition ("Test Tech", tab, tab, "TEST_TECH", return):

Spoiler :

Code:
	<!-- Test Tech -->
	<Technologies>
		<Row>
			<Type>TECH_/Page2/_TEST_TECH</Type>
			<Cost>50</Cost>
			<Description>TXT_KEY_TECH_TEST_TECH_TITLE</Description>
			<Civilopedia>TXT_KEY_TECH_TEST_TECH_DESC</Civilopedia>
			<Quote>TXT_KEY_TECH_TEST_TECH_QUOTE</Quote>
			<Help>TXT_KEY_TECH_TEST_TECH_HELP</Help>
			<Era>ERA_ANCIENT</Era>
			<Trade>true</Trade>
			<GoodyTech>true</GoodyTech>
			<GridX>1</GridX>
			<GridY>5</GridY>
			<PortraitIndex>0</PortraitIndex>
			<IconAtlas>TECH_ATLAS_1</IconAtlas>
			<AudioIntro>AS2D_TECH_TEST_TECH</AudioIntro>
			<AudioIntroHeader>AS2D_HEADING_TECH_TEST_TECH</AudioIntroHeader>
		</Row>
	</Technologies>
	<Technology_PrereqTechs>
		<Row>
			<TechType>TECH_/Page2/_TEST_TECH</TechType>
			<PrereqTech>TECH_AGRICULTURE</PrereqTech>
		</Row>
	</Technology_PrereqTechs>
	<Technology_Flavors>
		<Row>
			<TechType>TECH_/Page2/_TEST_TECH</TechType>
			<FlavorType>FLAVOR_GROWTH</FlavorType>
			<Flavor>10</Flavor>
		</Row>
	</Technology_Flavors>
	<Language_en_US>
		<Row Tag="TXT_KEY_TECH_TEST_TECH_TITLE">
			<Text>Test Tech</Text>
		</Row>
		<Row Tag="TXT_KEY_TECH_TEST_TECH_DESC">
			<Text>Enter Civpedia text...</Text>
		</Row>
		<Row Tag="TXT_KEY_TECH_TEST_TECH_HELP">
			<Text>Enter Help text...</Text>
		</Row>
		<Row Tag="TXT_KEY_TECH_TEST_TECH_QUOTE">
			<Text>[NEWLINE][ TAB ][ TAB ]"A quote is just a bunch of stuff someone once said..."[NEWLINE][ TAB ][ TAB ]  - Random Pete[NEWLINE][ TAB ]</Text>
		</Row>
	</Language_en_US>


Complete Unit generated definition ("Test Unit",tab,"TEST_UNIT",return):

Spoiler :

Code:
	<!-- Test Unit -->
	<UnitClasses>
		<Row>
			<Type>UNITCLASS_TEST_UNIT</Type>
			<Description>TXT_KEY_UNIT_TEST_UNIT</Description>
			<DefaultUnit>UNIT_TEST_UNIT</DefaultUnit>
		</Row>
	</UnitClasses>
	<Units>
		<Row>
			<Class>UNITCLASS_TEST_UNIT</Class>
			<Type>UNIT_TEST_UNIT</Type>
			<PrereqTech>TECH_AGRICULTURE</PrereqTech>
			<Combat>6</Combat>
			<RangedCombat>0</RangedCombat>
			<Cost>40</Cost>
			<Moves>2</Moves>
			<Range>0</Range>
			<CombatClass>UNITCOMBAT_MELEE</CombatClass>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_TEST_UNIT</Description>
			<Civilopedia>TXT_KEY_CIV5_ANTIQUITY_TEST_UNIT_TEXT</Civilopedia>
			<Strategy>TXT_KEY_UNIT_TEST_UNIT_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_TEST_UNIT</Help>
			<MilitarySupport>true</MilitarySupport>
			<MilitaryProduction>true</MilitaryProduction>
			<Pillage>true</Pillage>
			<ObsoleteTech>TECH_METAL_CASTING</ObsoleteTech>
			<GoodyHutUpgradeUnitClass>UNITCLASS_SPEARMAN</GoodyHutUpgradeUnitClass>
			<AdvancedStartCost>10</AdvancedStartCost>
			<XPValueAttack>3</XPValueAttack>
			<XPValueDefense>3</XPValueDefense>
			<UnitArtInfo>ART_DEF_UNIT__WARRIOR</UnitArtInfo>
			<UnitFlagIconOffset>0</UnitFlagIconOffset>
			<IconAtlas>TECH_ATLAS_1</IconAtlas>
			<PortraitIndex>0</PortraitIndex>
		</Row>
	</Units>
	<Unit_AITypes>
		<Row>
			<UnitType>UNIT_TEST_UNIT</UnitType>
			<UnitAIType>UNITAI_ATTACK</UnitAIType>
		</Row>
	</Unit_AITypes>
	<Unit_ClassUpgrades>
		<Row>
			<UnitType>UNIT_TEST_UNIT</UnitType>
			<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
		</Row>
	</Unit_ClassUpgrades>
	<Unit_Flavors>
		<Row>
			<UnitType>UNIT_TEST_UNIT</UnitType>
			<FlavorType>FLAVOR_GROWTH</FlavorType>
			<Flavor>10</Flavor>
		</Row>
	</Unit_Flavors>
	<Unit_FreePromotions>
		<Row>
			<UnitType>UNIT_TEST_UNIT</UnitType>
			<PromotionType>PROMOTION_ONLY_DEFENSE</PromotionType>
		</Row>
	</Unit_FreePromotions>
	<Language_en_US>
		<Row Tag="TXT_KEY_UNIT_TEST_UNIT">
			<Text>Test Unit</Text>
		</Row>
		<Row Tag="TXT_KEY_UNIT_HELP_TEST_UNIT">
			<Text>Enter Help text...</Text>
		</Row>
		<Row Tag="TXT_KEY_CIV5_ANTIQUITY_TEST_UNIT_TEXT">
			<Text>Enter Civpedia text...</Text>
		</Row>
		<Row Tag="TXT_KEY_UNIT_TEST_UNIT_STRATEGY">
			<Text>Enter Strategy text...</Text>
		</Row>
	</Language_en_US>


I'll most likely end up making some for other stuff like Buildings and Wonders, will post them up if people like these.

Enjoy!
 

Attachments

wondering if there is a guide to creating snippets somewhere
 
Working in my Mod (Planeta Historico) need a lot of new buildings, and finally I made it this Building Snippet :)

I got ALL attributes from buildings, fill the yellow tags and erase tags with 0 or NULL because are default values on table, also you can delete blocks not necesary.
I have a little problem on yellow tags, only show in yellow the first tag on the archive, perhaps Radom_Pete can help me.

(Sorry for my english)
 

Attachments

Don't know if I should resurrect a dead topic, but thank you so much for this, wonderful person ^^
 
Back
Top Bottom