[Tutorial - Beginner/Intermediate] Elemental Races - Unique spells, Tech trees, Buildings, Units and more

By on September 7, 2010 6:24:22 AM from Elemental Forums Elemental Forums

Das123

Join Date 05/2003
+79

This tutorial can be applied to new races you create yourself, or you can use it to manipulate the existing races.

Before we get started, lets establish a few things.

The files you will be creating should be placed inside the Elemental/Mods folder (C:\Program Files\Stardock Games\Elemental\Mods). If for some reason you don't have a Mods folder, you should create one.

Also, in the game options, make sure you have 'Use Mods' turned on.

I'm assuming you can create XML files and understand the basic structure. This is easier if you are using an XML editor. I use Eclipse which is free and powerful.

What we are going to do is not going to improve the game - not even in the slightest. Unless of course you want to be summoning a Fire Giant from turn one and build powerful Golems from your city within the first 10 moves. We are going to get rid of the Altarians completely. And we are also going to nerf the Warfare tech to the point of making it useless for you.

The idea is to illustrate what changes impact certain areas so you can design your own unique racial elements.

The completed tutorial files can be accessed here. 


Pinned, Locked Post 17 Replies +6
Search this post
Subscription Options


Reason for Karma (Optional)
Successfully updated karma reason!
September 7, 2010 6:24:45 AM from Elemental Forums Elemental Forums

Chapter 1. Race Config - Getting rid of the Altarians.

The default races are controlled through a file called CoreRaceConfigs.xml. We will be creating a mod file that will enhance this core file - which means we only need to put in our small changes and they will then be applied into the core files settings.

Create a file in your Mods directory called 'DasTut_RaceConfig.xml'

Inside this file, type the following:

Code: xml
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <RaceConfigs>
  3.     <DataChecksum NoParse="1">
  4.         <Ignore>DisplayName, ShortName, Capitol, Description, UnitSkinColor, UnitHairColor, UnitClothColor, BuildingPrimaryColor, BuildingSecondaryColor, BuildingRoofColor, BuildingStyle, UnitStyle, WorkerName</Ignore>
  5.         <Translate>DisplayName, ShortName, Capitol, Description, WorkerName</Translate>
  6.     </DataChecksum>
  7.     <RaceConfig InternalName="KingdomOfAltar">
  8.         <HideInSetupLists>1</HideInSetupLists> <!-- Hides the race -->
  9.     </RaceConfig>
  10. </RaceConfigs>

Lets briefly step through.

After the XML declaration at the top, the items are wrapped in a RaceConfigs tag.

Next is the DataChecksum information and this is copied directly from the CoreRaceConfigs.xml file.

Now comes the interesting part. There is an initial RaceConfig tag with an InternalName property with the value "KingdomOfAltar". This, once again, is straight from the CoreRaceConfigs.xml file. The game uses this value to establish the Altarian race.

Inside this RaceConfig tag we have a single XML tag: <HideInSetupLists>1</HideInSetupLists>

This is the command that hides the race in the setup screen.

The statement <!-- Hides the race --> afterwards is a comment that I put in so I can remember what does what.

If you run the game now the Altarian race should be gone.

Reason for Karma (Optional)
Successfully updated karma reason!
September 7, 2010 6:25:34 AM from Elemental Forums Elemental Forums

Chapter 2. Spellbooks - I want my Fire Giant! And I want it now!

OK. Now that the pesky Altarians are out of the picture, lets get our own spells.

We have a few things we need to setup before we can do this though. This will introduce how various XML files rely on each other.

Before we get started it is important to realise how spell books work. First of all you get spell books from your sovereigns. By default all of them have all spell books already turned on. Hopefully this will be seriously nerfed in future patches to make magic more of a choice - but I digress. The second method of getting spellbooks is through your race.

We will be using the second method.

In this example we are going to be using the Capitar Mancers as our race.

First of all, lets create our spell book. In this example we are just going to have a single spell that is accessible from the very start of the game. And yes, because I like Fire Giants, the spell is going to be the Fire Giant summon spell.

You can create your own spells in the XML but we're not going to do that here. We are simply going to piggy back off the current Fire Giant spell.

Create a new XML file called 'DasTut_SpellBooks.xml.

By the way, the file-names don't actually have any bearing on what gets loaded. You could call these files anything you like and it will still work as long as the XML inside is correctly formed. I tend to use a reference back to the core file I borrowed the code from - so this file will mainly come from CoreSpellBooks.xml.

In the file, type the following:

Code: xml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Spells>
  3.     <Spellbook InternalName="MancersSpellbook">
  4.         <DisplayName>Mancers</DisplayName>
  5.         <Icon>Fire_Dot.png</Icon>
  6.         <Cost>3</Cost>
  7.         <SpellbookNode InternalName="Node00">
  8.             <NodeID>0</NodeID>
  9.             <SpellDef>SummonFireGiant</SpellDef>
  10.             <StartingKnown>1</StartingKnown>
  11.             <StartingResearch>1</StartingResearch>
  12.         </SpellbookNode>
  13.      </Spellbook>
  14.     
  15. </Spells>

So, everything is contained in a 'Spells' tag.

Then we have our SpellBook tag with the InternalName of 'MancersSpellbook'. MancersSpellbook is the name we ultimately use to reference and load the spell book.

The DisplayName is the name of the spell book.

The Icon is the image it will use. If you want your own, just build a PNG file and store that in your Mods directory.

SpellbookNode and its NodeID are references.

SpellDef is the name of the spell you will be calling. These are defined in the various CoreSpells_ files. In this case Fire Giants are defined in CoreSpells_FIRE_Strategic.xml. You can create your own spells but I won't be going into that sort of detail here. If i was I would create another XML file called DasTut_CoreSpells_Mancers.xml and work in that.

StartingKnown with a value of 1 tell the game that if you have the Mancers spell book, you start off knowing this spell. Which is what we want in this example.

Right. At this point we have our spell book but the game doesn't know that our Mancers want to use it. We'll soon fix that.

The current problem with the core files is that all the Kingdom races are the same and use the Altarian spells, techs, etc etc. We're going to change this.

Open your DasTut_RaceConfig.xml file again and add the following under the Altar RaceType:

Code: xml
  1.     <RaceConfig InternalName="KingdomOfCapitar">
  2.         <Spellbook>MancersSpellbook</Spellbook><!-- Adds to basic spell books loaded from core -->
  3.     </RaceConfig>

We are now using a RaceConfig with an InternalName of "KingdomOfCapitar" which corresponds to the core files.

So the full code should now be:

Code: xml
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <RaceConfigs>
  3.     <DataChecksum NoParse="1">
  4.         <Ignore>DisplayName, ShortName, Capitol, Description, UnitSkinColor, UnitHairColor, UnitClothColor, BuildingPrimaryColor, BuildingSecondaryColor, BuildingRoofColor, BuildingStyle, UnitStyle, WorkerName</Ignore>
  5.         <Translate>DisplayName, ShortName, Capitol, Description, WorkerName</Translate>
  6.     </DataChecksum>
  7.     <RaceConfig InternalName="KingdomOfAltar">
  8.         <HideInSetupLists>1</HideInSetupLists> <!-- Hides the race -->
  9.     </RaceConfig>
  10.     <RaceConfig InternalName="KingdomOfCapitar">
  11.         <Spellbook>MancersSpellbook</Spellbook><!-- Adds to basic spell books loaded from core -->
  12.     </RaceConfig>
  13. </RaceConfigs>

Note the command <Spellbook>MancersSpellbook</Spellbook> where 'MancersSpellbook' is the same name as the Spellbook InternalName from the start of this chapter.

Basically we've just added (not replaced) the Mancers spell book to the Capitar Mancers. You can have multiple spell books for each race. In the core files the Mancers start with the Life spell book, and that isn't replaced.

Try the game again. You'll now see you have the FireGiant spell available right from the start as long as you choose the Capitar Mancers race.

Reason for Karma (Optional)
Successfully updated karma reason!
September 7, 2010 6:26:05 AM from Elemental Forums Elemental Forums

Chapter 3. Custom Techs - My Warfare techs are too powerful! Take them away!

Once again, all the tech trees are basically shared across all the Kingdom and Empire races. In the case of the Kingdom races they all share the Altar tech tree.

So lets fix this up.

We are going to seriously nerf our Mancers and only allow them two Warfare techs. And we are going to define these techs ourself.

Create a new XML file called 'DasTut_Techs_Mancers.xml'.

In this file place the following:

Code: xml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Techs>
  3.     <DataChecksum NoParse="1">
  4.         <Ignore>DisplayName,Description,Image,Color,HotColor,Icon</Ignore>
  5.         <Translate>DisplayName,Description</Translate>
  6.     </DataChecksum>
  7.     <TechDef InternalName="Logistics_Mancers">
  8.         <DisplayName>Mancer Logistics</DisplayName>
  9.         <Description>This breakthrough allows us to form Parties of units. By grouping soldiers into units and training them to work together to overcome opposition, they become a much greater threat than they would be as individuals.</Description>
  10.         <Image>Medallions_Advanced_Foot_Solders.png</Image>
  11.         <Color>182,7,3</Color>
  12.         <HotColor>255,48,0</HotColor>
  13.         <Rarity>100</Rarity>
  14.         <Category>Warfare</Category>
  15.         <Infinite>0</Infinite>
  16.         <AppearanceChance>100</AppearanceChance>
  17.         <AIData AIPersonality="AI_General">
  18.             <AIResearchPriority>50</AIResearchPriority>
  19.             <AITradeToGetValue>75</AITradeToGetValue>
  20.             <AITradeOutValue>90</AITradeOutValue>
  21.             <AIAtWarMultiplier>2.0</AIAtWarMultiplier>
  22.             <AIEarlyBuildUpMultiplier>0.25</AIEarlyBuildUpMultiplier>
  23.         </AIData>
  24.     </TechDef>
  25.     <TechDef InternalName="City_Defenses_Mancers">
  26.         <DisplayName>Mancer Defenses</DisplayName>
  27.         <Description>This breakthrough allows us to construct Hedge Wall improvements. Walls are the penultimate line of defense against the encroaching wastelands and are a great boon to the stalwart soldiers defending the settlements.</Description>
  28.         <Image>CityWalls_Medallion_Full.png</Image>
  29.         <Rarity>100</Rarity>
  30.         <Category>Warfare</Category>
  31.         <Infinite>0</Infinite>
  32.         <AppearanceChance>100</AppearanceChance>
  33.         <GameModifier>
  34.             <ModType>Player</ModType>
  35.             <Attribute>AbilityBonus</Attribute>
  36.             <StrVal>A_CityDefense</StrVal>
  37.             <Value>25</Value>
  38.         </GameModifier>
  39.         <Prereq>
  40.             <Type>Tech</Type>
  41.             <Attribute>Logistics_Mancers</Attribute>
  42.             <Value>0</Value>
  43.         </Prereq>
  44.         <AIData AIPersonality="AI_General">
  45.             <AIResearchPriority>50</AIResearchPriority>
  46.             <AITradeToGetValue>75</AITradeToGetValue>
  47.             <AITradeOutValue>90</AITradeOutValue>
  48.             <AIAtWarMultiplier>2.0</AIAtWarMultiplier>
  49.             <AIEarlyBuildUpMultiplier>0.25</AIEarlyBuildUpMultiplier>
  50.         </AIData>
  51.     </TechDef>
  52. </Techs>

These were pretty much copied directly from 'Techs_Amarian.xml' in the core game files.

The changes are:

<TechDef InternalName="Logistics_Mancers"> - which defines the identifiable name of the tech. We'll need this later.

<DisplayName>Mancer Logistics</DisplayName> - I just modified the name of the tech here. This displays in the game references.

And the second tech:

<TechDef InternalName="City_Defenses_Mancers"> - which once again is the ID name. We won't need this later as all the magic happens in the tech itself.

<DisplayName>Mancer Defenses</DisplayName> - is the display name within the game.

Code: xml
  1.         <Prereq>
  2.             <Type>Tech</Type>
  3.             <Attribute>Logistics_Mancers</Attribute>
  4.             <Value>0</Value>
  5.         </Prereq>

... tells it that you can't start researching this until after you have researched 'Logistics_Mancers' - which we defined above.

Code: xml
  1.         <GameModifier>
  2.             <ModType>Player</ModType>
  3.             <Attribute>AbilityBonus</Attribute>
  4.             <StrVal>A_CityDefense</StrVal>
  5.             <Value>25</Value>
  6.         </GameModifier>

... tells the game to give you a 25% city defensive bonus.

So at this stage we have defined our techs, but now we need to define the tech tree for our race.

Create a new file called 'DasTut_TechTree_Mancers.xml'. Now, unlike spell books, tech trees are unique. So you must define the whole tree for our race. The easiest way is just to copy the corresponding core file and edit it. Copy the contents from 'C:\Program Files\Stardock Games\Elemental\data\English\TechTree_Amarian.xml' and paste it into your new 'DasTut_TechTree_Mancers.xml' file.

There is a lot of content here so I'm only going to highlight the bits I changed:

Code: xml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <TechTrees>
  3.     <TechTree InternalName="TechTree_Mancers">
  4.     <DisplayName>The Knowledge of the Mancers</DisplayName>
  5.     <!--** The Five Categories **-->
  6.     <Category>Civilization</Category>
  7.         ...
  8.     
  9.     <Category>Warfare</Category>
  10.         <Tech>Logistics_Mancers</Tech>
  11.             <Tech>City_Defenses_Mancers</Tech>
  12.         
  13.     <Category>Magic</Category>
  14.         ...
  15.         
  16.     </TechTree>
  17. </TechTrees>

The changes are:

<TechTree InternalName="TechTree_Mancers"> with our "TechTree_Mancers". We'll use that in a minute.

<DisplayName>The Knowledge of the Mancers</DisplayName> which is the game description of our tech tree.

Code: xml
  1.     <Category>Warfare</Category>
  2.         <Tech>Logistics_Mancers</Tech>
  3.             <Tech>City_Defenses_Mancers</Tech>

... which defines the Warfare category and references our two new techs underneath it. The indenting doesn't matter but it does help to see the hierarchy of the techs.

OK. So we now have a tech tree with a couple of custom techs. But our Mancers don't know they need to be using it.

Back to 'DasTut_RaceConfig.xml again!

Add <TechTree>TechTree_Mancers</TechTree> into the <RaceConfig InternalName="KingdomOfCapitar"> cluster.

So now our "KingdomOfCapitar" RaceConfig should show:

Code: xml
  1.     <RaceConfig InternalName="KingdomOfCapitar">
  2.         <TechTree>TechTree_Mancers</TechTree> <!-- Replaces the tech tree -->
  3.         <Spellbook>MancersSpellbook</Spellbook><!-- Adds to basic spell books loaded from core -->
  4.     </RaceConfig>

Save and run the game. The techs display but other than the 25% defence boost, they actually don't do anything.

This post is becoming a bit long so +1 to the first to figure out what you need to do to make this work and show sample XML. The clues are in CoreUnitGroupingType.xml for the Logistics tech and line 336 of KingdomSpecialImprovements.xml (inside the Core Improvements subdirectory).

Reason for Karma (Optional)
Successfully updated karma reason!
September 7, 2010 6:26:31 AM from Elemental Forums Elemental Forums

Chapter 4. Custom Buildings - Making a unique building for our city

The idea in this tutorial is to make a unique building that only our Mancers can build. Now, I'm going to take a heap of short-cuts with this. For example, I'm not going to make a unique building icon.

What we will be building is a forge for our city. To be exact it will be a Golem forge where our Mancers can build Golems (another chapter).

Start by building a tile in the Workshop. I built one that looked like a forge and called it 'Das_Golem_Foundry_01.xml'.

It is stored in 'My Documents\My Games\Elemental\Tiles'. but can also be placed in the Mods folder if you like.

Then I used this to build a second tile of it under construction. This was called 'Das_Golem_Foundry_Build_01.xml'.

Now, into the XML code.

Create a new XML file called 'DasTut_ImprovementTypes'. The put in the following code:

Code: xml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <ImprovementTypes>
  3.     <DataChecksum NoParse="1">
  4.         <Ignore>DisplayName</Ignore>
  5.         <Translate>DisplayName</Translate>
  6.     </DataChecksum>
  7.     <ImprovementType InternalName="Das_ClaimedGolem">
  8.         <DisplayName>Golem Foundry</DisplayName>
  9.         <Description>This foundry will send our nearest settlements golems to train.</Description>
  10.         <TileDesign>Das_Golem_Foundry_01</TileDesign>
  11.         <ConstructionTileDesign>Das_Golem_Foundry_Build_01</ConstructionTileDesign>
  12.         <SupportedTerrainType>City</SupportedTerrainType>
  13.         <SupportedTerrainType>Land</SupportedTerrainType>
  14.         <DrawnIcon>Gfx/TacticalIcons/Res_DrathVillage1.png</DrawnIcon>
  15.         <DrawnIconConstruction>Gfx/TacticalIcons/Res_DrathVillage1.png</DrawnIconConstruction>
  16.         <Thumbnail>Gfx/Medallions/RaceResource_Thumb.png</Thumbnail>
  17.         <RequiresCity>True</RequiresCity>
  18.         <ReqCityLevel>1</ReqCityLevel>
  19.         <AllowedPerCity>1</AllowedPerCity>
  20.         <SpecialBuildingType>GolemRecruiting</SpecialBuildingType>
  21.         <Medallions>
  22.             <All>Gfx/Medallions/M_Drath_Warrion_01_Card.png</All>
  23.             <Border_All></Border_All>
  24.         </Medallions><!-- Prerequisites -->
  25.          <GameModifier>
  26.             <ModType>ConstructionResourceCost</ModType>
  27.             <Attribute>Gold</Attribute>
  28.             <Value>-20</Value>
  29.             <PerTurn>0</PerTurn>
  30.         </GameModifier>
  31.         <GameModifier>
  32.             <ModType>ConstructionResourceCost</ModType>
  33.             <Attribute>Materials</Attribute>
  34.             <Value>-1</Value>
  35.             <PerTurn>0</PerTurn>
  36.         </GameModifier>
  37.         <!-- Cost -->
  38.         <LaborToBuild>2.0</LaborToBuild>
  39.         <Prereq>
  40.             <Type>Race</Type>
  41.             <Attribute>Mancers</Attribute>
  42.         </Prereq>
  43.     </ImprovementType>
  44. </ImprovementTypes>

I originally borrowed the code from 'RecruitableImprovements.xml' and made my own changes.

<ImprovementType InternalName="Das_ClaimedGolem"> gives us our unique identifier of "Das_ClaimedGolem" which we will use later.

<TileDesign>Das_Golem_Foundry_01</TileDesign> Points to the tile we created.

<ConstructionTileDesign>Das_Golem_Foundry_Build_01</ConstructionTileDesign> points to the tile to be used while the building is under construction.

You can see I haven't created a unique icon for this and am just using the Drath icons and thumbnails and medallions.

<RequiresCity>True</RequiresCity> so it can only be built in a city tile.

<ReqCityLevel>1</ReqCityLevel> is just a level 1 city (this will ultimately be a powerful building so really should have a requirement of a much higher city level).

<AllowedPerCity>1</AllowedPerCity> can only build one per city.

<SpecialBuildingType>GolemRecruiting</SpecialBuildingType> tells it what we want it to do (we'll be using this in the next chapter).

I have two GameModifier commands so it costs 20 gold and 1 material. Cheap at twice the price! Basically at this stage I want this to be available early so I can test it.

Finally I have a prerequesite

Code: xml
  1.         <Prereq>
  2.             <Type>Race</Type>
  3.             <Attribute>Mancers</Attribute>
  4.         </Prereq>

... but we don't have a race type of Mancers. Remember at the start of these tutorials that all the races are either Men or Fallen. Hopefully this will change officially at some point, but luckily we can over-ride this.

Reopen your DasTut_RaceConfig.xml file.

And then edit the following into the KingdomOfCapitar RaceConfig:

Code: xml
  1.         <RaceClassification>Mancers</RaceClassification>
  2.         <RaceDisplayName>Mancers</RaceDisplayName>
  3.         <RaceInternalName>Race_Type_Mancers</RaceInternalName>

So now the file should look like this:

Code: xml
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <RaceConfigs>
  3.     <DataChecksum NoParse="1">
  4.         <Ignore>DisplayName, ShortName, Capitol, Description, UnitSkinColor, UnitHairColor, UnitClothColor, BuildingPrimaryColor, BuildingSecondaryColor, BuildingRoofColor, BuildingStyle, UnitStyle, WorkerName</Ignore>
  5.         <Translate>DisplayName, ShortName, Capitol, Description, WorkerName</Translate>
  6.     </DataChecksum>
  7.     <RaceConfig InternalName="KingdomOfAltar">
  8.         <HideInSetupLists>1</HideInSetupLists> <!-- Hides the race -->
  9.     </RaceConfig>
  10.     <RaceConfig InternalName="KingdomOfCapitar">
  11.         <RaceClassification>Mancers</RaceClassification>
  12.         <RaceDisplayName>Mancers</RaceDisplayName>
  13.         <RaceInternalName>Race_Type_Mancers</RaceInternalName>
  14.         <TechTree>TechTree_Mancers</TechTree> <!-- Replaces the tech tree -->
  15.         <Spellbook>MancersSpellbook</Spellbook><!-- Adds to basic spell books loaded from core -->
  16.     </RaceConfig>
  17. </RaceConfigs>

What we have done is given this a race classification of 'Mancers', which will over-ride the default 'Men' classification.

But we aren't quite finished yet. The core files also have a RaceType command that also needs to be over-written.

Create another XML file called 'DasTut_RaceTypes.xml and place the following in there:

Code: xml
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <RaceTypes>
  3.   <DataChecksum NoParse="1">
  4.     <Ignore>DisplayName, UnitScale, UnitSkinColor, UnitHairColor</Ignore>
  5.     <Translate>DisplayName</Translate>
  6.   </DataChecksum>
  7.    <RaceType InternalName="Race_Type_Mancers">
  8.     <DisplayName>Mancers</DisplayName>
  9.     <RaceClassification>Mancers</RaceClassification>
  10.   </RaceType>
  11. </RaceTypes>

What this does is basically cements the RaceClassification. I'm not exactly sure why there are two areas but things can be a little flaky if both aren't changed.

OK. Start the game and found your first city. You should now see the Golem Forge in your build list. Grab some materials and you can now build it.

It doesn't actually do anything at this stage so the next chapter will cover how we will get it to build Golems for us.

Reason for Karma (Optional)
Successfully updated karma reason!
September 7, 2010 6:27:10 AM from Elemental Forums Elemental Forums

Chapter 5. Custom Units - Bring forth the Golems.

So at this stage we have Golem Forge building that only the Capitar Mancers can construct. Now we need to make it build Golems.

Create another XML file and call this one 'DasTut_UnitTypes.xml'.

The following code was heavily borrowed from 'CoreMonsterUnitTypes.xml' so place this into your new file:

Code: xml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <UnitTypes>
  3.     <DataChecksum NoParse="1">
  4.         <Ignore>DisplayName,Quote,ModelPath,ModelScale,AnimationPack,MovingSfx</Ignore>
  5.         <Translate>DisplayName,Quote</Translate>
  6.     </DataChecksum>
  7.     
  8.   <UnitType InternalName="Das_SteelGolem">
  9.     <EyeTexture>gfx/eyes/male_brown_eye.png</EyeTexture>
  10.     <!-- base data-->
  11.     <DisplayName>Steel Golem</DisplayName>
  12.     <Quote>'Mindless destruction and power.'</Quote>
  13.     <!-- graphical data-->
  14.     <ModelPath>gfx/hkb/Monsters/M_Golem_Mesh_01.hkb</ModelPath>
  15.     <SkeletonPath>Gfx\HKB\Units\K_Male_Skeleton_01.hkb</SkeletonPath>
  16.     <Texture_Skin>Gfx\HKB\Monsters\M_Golem_Texture_01.png</Texture_Skin>
  17.     <ModelScale>1.4</ModelScale>
  18.     <MaxScaleMainMap>0.8</MaxScaleMainMap>
  19.     <Color_Skin>128,128,160,200</Color_Skin>
  20.     <AnimationPack>GolemAnimationPack</AnimationPack>
  21.     <!-- particles-->
  22.     <OnHitParticleName>Golem_Hit</OnHitParticleName>
  23.     <OnAttackParticleName>Golem_Attack</OnAttackParticleName>
  24.     <Medallions InternalName="">
  25.       <All>M_Golem_ObsidianGolem_Card_01.png</All>
  26.     </Medallions>
  27.     <!-- soundFX -->
  28.     <SoundPack>SoundPack_Golem1</SoundPack>
  29.     <CutSceneDataPack>ObsidianGolemUnitCutscenePack</CutSceneDataPack>
  30.     <!-- levels -->
  31.     <LevelMilestone InternalName="L1">
  32.       <Level>1</Level>
  33.       <UnitStat_HitPoints>0</UnitStat_HitPoints>
  34.       <UnitStat_Attack>6</UnitStat_Attack>
  35.       <UnitStat_Defense>6</UnitStat_Defense>
  36.       <UnitStat_CombatSpeed>2</UnitStat_CombatSpeed>
  37.       <UnitStat_Strength>64.0</UnitStat_Strength>
  38.       <UnitStat_Wisdom>1.0</UnitStat_Wisdom>
  39.       <UnitStat_Dexterity>10.0</UnitStat_Dexterity>
  40.       <UnitStat_Intelligence>1.0</UnitStat_Intelligence>
  41.       <UnitStat_Charisma>1.0</UnitStat_Charisma>
  42.       <UnitStat_Constitution>29.0</UnitStat_Constitution>
  43.       <UnitStat_Sight>2</UnitStat_Sight>
  44.       <UnitStat_Essence>7</UnitStat_Essence>
  45.     </LevelMilestone>
  46.     <LevelMilestone InternalName="L30">
  47.       <Level>30</Level>
  48.       <UnitStat_HitPoints>0</UnitStat_HitPoints>
  49.       <UnitStat_Attack>12</UnitStat_Attack>
  50.       <UnitStat_Defense>12</UnitStat_Defense>
  51.       <UnitStat_CombatSpeed>2</UnitStat_CombatSpeed>
  52.       <UnitStat_Strength>65</UnitStat_Strength>
  53.       <UnitStat_Wisdom>1.0</UnitStat_Wisdom>
  54.       <UnitStat_Dexterity>10.0</UnitStat_Dexterity>
  55.       <UnitStat_Intelligence>1.0</UnitStat_Intelligence>
  56.       <UnitStat_Charisma>1.0</UnitStat_Charisma>
  57.       <UnitStat_Constitution>58.0</UnitStat_Constitution>
  58.       <UnitStat_Sight>2</UnitStat_Sight>
  59.       <UnitStat_Essence>7</UnitStat_Essence>
  60.     </LevelMilestone>
  61.     <SelectedAbilityBonusOption>Immunity</SelectedAbilityBonusOption>
  62.     <Backstory>
  63.       Forged of steel and blood.
  64.       </Backstory>
  65.      <Prereq>
  66.       <Type>BuildingRequirement</Type>
  67.       <Attribute>GolemRecruiting</Attribute>
  68.     </Prereq>
  69.     <CanBeDesigned>1</CanBeDesigned>
  70.     <!-- This lets it show up in the train wnd -->
  71.     <IsUniqueButBuildable>1</IsUniqueButBuildable>
  72.     <!-- This keeps it out of the unit design wnd -->
  73.   </UnitType>
  74.  
  75. </UnitTypes>

I'm going to gloss over many of the settings in this file, but basically I'm just using a model and animation pack that already comes with the game. To build my own model and animate it would be exponentially harder. Perhaps one day...

The important settings are:

<UnitType InternalName="Das_SteelGolem"> to cive it a unique identifier.

<DisplayName>Steel Golem</DisplayName> is the name within the game.

<Color_Skin>128,128,160,200</Color_Skin> gives it a light blue colour. This is in RGBA format (Red, Green, Blue, Alpha). A number from 0 to 255 is acceptable. Alpha is the amount of transparency used on the texture map to show through onto your Color_Skin setting.

Code: xml
  1.      <Prereq>
  2.       <Type>BuildingRequirement</Type>
  3.       <Attribute>GolemRecruiting</Attribute>
  4.     </Prereq>

... is the prerequisite that only allows us to build them if we have building in the city with GolemRecruiting. We set this up in the previous chapter if you remember.

<CanBeDesigned>1</CanBeDesigned> allows the unit to display in the army selection window.

<IsUniqueButBuildable>1</IsUniqueButBuildable> keeps it out of the unit design window (we don't have any items it can use anyway).

Fire up the game and try it out. Once you build the Golem Forge...

... you can now build Steel Golems.

These are waaaayyyy overpowered!

Reason for Karma (Optional)
Successfully updated karma reason!
September 7, 2010 6:27:31 AM from Elemental Forums Elemental Forums

Chapter 6. Custom Items - Mancer Polearms FTW!

I'm wanting a special polearm that does a lot of damage and also increases combat speed. And I only want my Mancer units to be able to use it.

Now we have already made sure that our Capitar race is no longer classified as 'Men' but is now classified as 'Mancers'. So we'll have a look in the core files and borrow some basic code. In particular we'll look at CoreWeapons.xml which already has the main weapons in the game.

Create a new XML file in your Mods area called 'DasTut_Items_Mancers.xml'. In this place the following code:

Code: xml
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <GameItemTypes>
  3.     <DataChecksum NoParse="1">
  4.         <Ignore>DispName</Ignore>
  5.         <Translate>DisplayName,Description</Translate>
  6.     </DataChecksum>
  7.     
  8.      <GameItemType InternalName="Das_MancerStaff">
  9.         <DisplayName>Mancer Polearm</DisplayName>
  10.         <Description>A tall polearm used by Mancer guards.</Description>
  11.         <ShopValue>45</ShopValue>
  12.         <!-- Equipment Type -->
  13.         <Type>Weapon</Type>
  14.         <CanBeEquipped>1</CanBeEquipped>
  15.         <CustomizationPointCost>8</CustomizationPointCost>
  16.         <WeaponType>Spear</WeaponType>
  17.         <Type>Defense</Type>
  18.         <EquipSFX>Equip_WoodenItem_01</EquipSFX>
  19.         <EquipSFX>Equip_WoodenItem_02</EquipSFX>
  20.         <EquipSFX>Equip_WoodenItem_03</EquipSFX>
  21.         <EquipSFX>Equip_WoodenItem_04</EquipSFX>
  22.         <AttackSFX>Hit_WoodSpear1</AttackSFX>
  23.         <!-- Equipment Graphics -->
  24.         <IconFile>Staff_Icon.png</IconFile>
  25.         <TintR>0</TintR>
  26.         <TintG>0</TintG>
  27.         <TintB>0</TintB>
  28.         <!-- Particles -->
  29.         <OnHitParticleName>Staff_Attack</OnHitParticleName>
  30.         <GameItemTypeModel>
  31.             <ModelFile>gfx/hkb/weapons/K_Staff_Wood_01.hkb</ModelFile>
  32.             <Texture_All>Gfx\HKB\Items\K_Accessories_Texture_02.png</Texture_All>
  33.             <Attachment>hand_right_Lcf</Attachment>
  34.         </GameItemTypeModel>
  35.         <!-- Equipment Production Requirements -->
  36.         <ProductionRequirement>
  37.             <Type>Resource</Type>
  38.             <Attribute>Gold</Attribute>
  39.             <Value>16</Value>
  40.         </ProductionRequirement>
  41.         <ProductionRequirement>
  42.             <Type>Resource</Type>
  43.             <Attribute>Materials</Attribute>
  44.             <Value>1.0</Value>
  45.         </ProductionRequirement>
  46.         <!-- Equipment Prerequisites -->
  47.         <Prereq>
  48.             <Type>Race</Type>
  49.             <Attribute>Mancers</Attribute>
  50.         </Prereq>
  51.         <!-- Equipment Modifiers -->
  52.         <GameModifier>
  53.             <ModType>Unit</ModType>
  54.             <Attribute>AdjustUnitStat</Attribute>
  55.             <StrVal>UnitStat_Attack</StrVal>
  56.             <Value>8.0</Value>
  57.         </GameModifier>
  58.         <GameModifier>
  59.             <ModType>Unit</ModType>
  60.             <Attribute>AdjustUnitStat</Attribute>
  61.             <StrVal>UnitStat_BluntDamage</StrVal>
  62.         </GameModifier>
  63.         <GameModifier>
  64.             <ModType>Unit</ModType>
  65.             <Attribute>AdjustUnitStat</Attribute>
  66.             <StrVal>UnitStat_CombatSpeed</StrVal>
  67.             <Value>0.75</Value>
  68.         </GameModifier>
  69.     </GameItemType>
  70. </GameItemTypes>

Points of note:

<GameItemType InternalName="Das_MancerStaff"> is the unique identifier.

<DisplayName>Mancer Polearm</DisplayName> is the name of the weapon.

Code: xml
  1.         <Prereq>
  2.             <Type>Race</Type>
  3.             <Attribute>Mancers</Attribute>
  4.         </Prereq>

... constrains its use to our Mancers.

And the various GameModifiers provide its stats.

And that's all there is to making race-specific weapons and items. Start up the game and have a look.

Reason for Karma (Optional)
Successfully updated karma reason!
September 7, 2010 6:04:26 PM from Elemental Forums Elemental Forums

Chapter 7. How this might all come together.

The premise behind this tutorial is to show how various elements slot in together and also to show how you can individualise the game experience.

So the question is, why would you use any of this. Here is just one possible scenario...

You want to build an elven race that can field amazing archers, build mighty ent units as well as summon some small sprite scout units. In fact, lets say it is part of a total conversion mod where you will be bringing in all the standard fantasy races.

You don't want the existing races showing up - so you hide them all as per Chapter 1 and then introduce your own races.

Your elven race would have very different sets of spells. From healing and entangle in tactical battles, through to summoning various woodland creatures in strategic play. Chapter 2 shows how you might approach this.

The elves would have their own specific techs, such as to build special building such as the ent forest. They would also have weaponry upgrades that focus primarily on archery. Chapter 3 shows how this is done.

Chapter 4 explains how you would tackle building the ent forest at your cities.

Chapter 5 shows clues on how you could build ent units from your ent forest.

And Chapter 6 explains how you could provide your elven units with superior bows.

 

I hope you have enjoyed this tutorial. It was much much longer writing this than fiddling about with the actual XML files.

Please feel free to comment or ask questions.

Reason for Karma (Optional)
Successfully updated karma reason!
September 7, 2010 6:27:49 PM from Elemental Forums Elemental Forums

thanks! This will go along way towards helping me learn stuff!

Reason for Karma (Optional)
Successfully updated karma reason!
September 8, 2010 8:20:55 AM from Elemental Forums Elemental Forums

Hope it helps.

I've now put in a heap of screen shots as well as a link to the completed files.

At present the XML display in this forum is completely broken. It is a really easy fix and so I've submitted a request to get this rectified. In the meantime my apologies about the lack of legibility of the code.

Reason for Karma (Optional)
Successfully updated karma reason!
September 8, 2010 10:42:00 AM from Elemental Forums Elemental Forums

Very usefull thanks I will certainly be refering to this while modding.

Reason for Karma (Optional)
Successfully updated karma reason!
September 8, 2010 10:58:55 AM from Elemental Forums Elemental Forums

Thank you so much for your explanation!

 

I find this incredibly useful and clear,  a well deserved    for you!

Reason for Karma (Optional)
Successfully updated karma reason!
September 8, 2010 2:24:00 PM from Elemental Forums Elemental Forums

That's really good stuff man, well done .

Reason for Karma (Optional)
Successfully updated karma reason!
September 8, 2010 2:29:11 PM from Elemental Forums Elemental Forums

Quoting Raven X,
That's really good stuff man, well done .

Seconded!

Reason for Karma (Optional)
Successfully updated karma reason!
September 8, 2010 7:35:57 PM from Elemental Forums Elemental Forums

First of all..excellent Tutorial, it really made me want to mod something. Tried to mod a Wolf Den, but couldn't put it on game, the new file we have to creates goes to which folder??

And second question, the part of the Recruitable Golem, is it possible to design the golem with human weapons? Or even maybe in the future with their own items??

thanks a lot !

Reason for Karma (Optional)
Successfully updated karma reason!
September 10, 2010 8:35:52 PM from Elemental Forums Elemental Forums

Thanks for the comments.

Quoting felipecarmonabr,
First of all..excellent Tutorial, it really made me want to mod something. Tried to mod a Wolf Den, but couldn't put it on game, the new file we have to creates goes to which folder??

And second question, the part of the Recruitable Golem, is it possible to design the golem with human weapons? Or even maybe in the future with their own items??

thanks a lot !

When you create your wolf den you would have created a specific tile (or perhaps also a 'build' tile that shows while it is under construction). This will be placed automatically in your My Documents\My Games\Elemental\Tiles directory. I leave them in there until I'm ready to distribute them then I move them into the Program Files\Stardock Games\Elemental\Mods directory.

The next part, making them accessible to the game, is more a question of how you want the game to have access to it.

If it is to be randomly placed then you'll need to look at how these are coded in CoreResources.xml.

If it is to be part of our city then the tutorial above would explain how.

 

Your second question about changing weapons is one I haven't experimented with but I think it could be done. Darklings change their weapons and they do this through and <Equipment> tag.

Eg.

<Equipment>WoodSpear1</Equipment>

But I'd guess that the model itself needs to know how to use weapons before it can wield them.

Reason for Karma (Optional)
Successfully updated karma reason!
September 11, 2010 2:17:23 AM from Elemental Forums Elemental Forums

Good stuff!  Answers some of the questions I had.

Reason for Karma (Optional)
Successfully updated karma reason!
October 29, 2010 7:06:47 PM from Elemental Forums Elemental Forums

Wow this is great! Thanks for the info.

Reason for Karma (Optional)
Successfully updated karma reason!
Stardock Forums v1.0.0.0    #108432  walnut2   Server Load Time: 00:00:00.0002407   Page Render Time: