Heavenfall Heavenfall

Guide to modding in Elemental (5/8 done)

Guide to modding in Elemental (5/8 done)

 

 

 

Each of these sections will be divided into two areas: Basic and Advanced. Basic information is enough to get you started. Advanced information takes you all the way to the end of what I know (well, not all the way, but very close)

I will use the line "****************************" to indicate that I've removed significant parts from the quote. This is just so I don't have to keep quoting large examples with tags that you don't need right now.

I will also use large questionmarks like this ? to pose questions for you to solve. They are essentially exercises, to make sure you're on board. Yes, it's a bit childish, but if you can't solve the exercise, then you've misunderstood something in the tutorial and you'll have a hard time moving on.

1. Starting

2. Items

3. Improvements

4. UnitTypes

5. RaceConfigs

6. Abilitybonuses

7. Spells

8. Techs

 

If you are very eager to jump into the modding, I suggest you read only the first section. After that, you should be set to start copypasting various xml to create new things or modify existing content in the game.

37,405 views 45 replies +3 Loading…
Reply #26 Top

I believe the engine will assume anything above 1 IS 1.

 

Reply #27 Top

Nice work. :)

Reply #28 Top

Updated the improvement with the following text

 

I'm breaking the format here a bit, the workshop in the link only has the first of these four choices, <IgnoreDuplicateImpLimit>. I quoted these 4 tags because they all impact how many of this building can be constructed. Only one of these tags should ever be included in a building.

The first one, <IgnoreDuplicateImpLimit>, used for workshops, tells the game that this building may be infinitely repeated in a city, if the player has free resources, specialists and Open tiles. If this is NOT set, only one building may be built per city level (a level 2 city would be able to build 2).

The second one, <AllowedPerCity>, is a value that tells the game the building may only be constructed a certain amount of times in one specific city. Values larger than 1 are valid, the number representing the upper limit.

The third one, <AllowedPerFaction>, is a value that tells the game the building may only be constructed a certain amount of times in total for a player. Values larger than 1 are valid, the number representing the upper limit.

The fourth one, <AllowedPerGame>, is a value that tells the game the building may only be constructed a certain amount of times in total in the world - ie by all factions put together. I do not think any other value than 1 is valid.

Edit: It appears that combinations of the following tags are possible: <AllowedPerFaction>, <AllowedPerCity> and <IgnoreDuplicateImpLimit>. Remember if <IgnoreDuplicateImpLimit> is not used, only one building may be built per city level. <AllowedPerGame> does not seem to work well these other tags.

End of quote

Thanks impinc

Reply #29 Top

I don't know how to mod but I do know how to program my tv remote. I'll pick this up in a jiffy!

Seriously though, thanks. Following.

Reply #30 Top

Quoting AlLanMandragoran, reply 29
I don't know how to mod but I do know how to program my tv remote. I'll pick this up in a jiffy!

Seriously though, thanks. Following.
End of AlLanMandragoran's quote

Well that puts you 2 steps ahead of myself. I have to have my 9 years daughter program the TV remote. X(

Following as well.

Reply #31 Top

Added 4th section on unittypes.

Reply #32 Top

Added 5th section, and added a piece to the Improvements section about cityhub improvementtypes.

Reply #33 Top

Fixed an error in the 5th section


    <TraderUnitType>expandedfactions_golemking_TraderTest</TraderUnitType>
    <StartingUnitType>Expandedfactions_golemking_Soldier</StartingUnitType>
    <StartingUnitType>expandedfactions_golemking_Pioneer</StartingUnitType>
    <ShopkeeperUnitType>expandedfactions_golemking_Shopkeeper</ShopkeeperUnitType>
End of quote

The first tag references a unittype that will function as a trader. For information on what a trader is, see the UnitTypes section.

The <StartingUnitType> tag references a unittype that will be automatically available to the player when he starts up the game. The default here is to include a pioneer and a basic peasant. These unittypes require the <IsStartingUnitType>1</IsStartingUnitType>.

The last tag references a unittype that will act as the shopkeeper for the faction. A shopkeeper is the model shown when the player browses the item store in a city.

Reply #34 Top

Question: Where does the ModelUnitType come from?  For example, your Elf model unit types are CPELFMale and CPELFFemale.  How does the game go from CPELF race type, to CPELFMale and CPELFFemale?

 

I guess my problem is, I've created a bunch of High Elf hair styles, but those are not showing up in Sovereign creation.  Instead, I'm getting all the generic Kingdom stuff.

Reply #35 Top

modeltypes are an example of in-between file variables. They are essentially defined by their reference.

+1 Loading…
Reply #36 Top

If I'm creating a high elf female, how does the game know to allow only hair styles for a high elf female? 

On a sudden inspiration, I created a high elf female to see what UnitModelType she was given at creation and she was created as a KingdomFemale.  Any idea how I get her to create as a HighElfFemale?

Reply #37 Top

The UnitModelType is inherited from the original unittype, referenced in the racetype.

See the advanced section on unittypes, heading "Randomized clothes, heads, hairstyles and skins"

Reply #38 Top

1. Thanks for the guide.

2. I try to create magic staffs with range attack. But there are some things i can't change like sound and icons. What am i doing wrong?

The damage should be also modified by the level of the charakter but i can't find any unitstats for this.

Then the damage should ignore armor, can be influenced by magicresistance and should be calculated in the combat rating. Any idea how to do this?

Thanks for the answers.

 

PS: Sorry for me bad english. :blush:

Reply #39 Top

BTW, Heavenfall.  Thanks for all you do to help us!  You are a prince among men!!

 

Anyone know why my High Elf race has no body types in sovereign creation?

 

Nevermind.  I found the animation pack. And with this, I have Character Creation working.  Now let's see what I can do with equipment.  With luck, I'll inherit everything from CPELF and be golden!

 

Reply #40 Top

viperfld,

I don't know of one that specifically references level.  There isn't one in the CoreUnitStat.  HF, any idea how the game keeps up with champion's level?

 

You can try this:

 

      <Calculate InternalName="DamageTemp" ValueOwner="CastingUnit">
        <Expression><![CDATA[[UnitStat_Attack] * [Level]]]></Expression>
      </Calculate>



Reply #41 Top

There's no such tag at the moment.

Reply #42 Top

Here is what i've got so fare. First the part for the staff itself:

    <!-- Equipment Display Name/Description -->
    <GameItemType InternalName="Mage_Staff">
        <DisplayName>Mage Staff</DisplayName>
        <Description>A magical staff that fires magicbolts. Every shot costs 1 mana!</Description>

        <!-- Equipment Type -->
        <Type>Weapon</Type>
        <CanBeEquipped>1</CanBeEquipped>
        <IsAvailableForSovereignCustomization>False</IsAvailableForSovereignCustomization>
        <IsAvailableForUnitDesign>False</IsAvailableForUnitDesign>
        <WeaponType>Spear</WeaponType>
        <TacticalRange>10</TacticalRange>
        
        <!-- *** For Tests *** -->
        <ShopValue>5</ShopValue>

        <!-- SoundFX-Files -->
        <EquipSFX>Equip_WoodenItem_01</EquipSFX>
        <EquipSFX>Equip_WoodenItem_02</EquipSFX>
        <EquipSFX>Equip_WoodenItem_03</EquipSFX>
        <EquipSFX>Equip_WoodenItem_04</EquipSFX>
        
        <!-- *** For Tests *** -->
        <AttackSFX>Hit_Axe1</AttackSFX>
        <!--
        <AttackSFX>Hit_MetalSpear2</AttackSFX>
        <AttackSFX>Hit_MetalSpear3</AttackSFX>
        -->
    
        <!-- Equipment Graphics -->
        <IconFile>Pariden_Staff_Icon.png</IconFile>
        <TintR>0</TintR>
        <TintG>0</TintG>
        <TintB>0</TintB>

        <!-- Particles -->
        <!--<OnHitParticleName>Staff_Attack</OnHitParticleName> -->

        <GameItemTypeModel>
            <ModelFile>Gfx\HKB\Items\pariden_Staff.hkb</ModelFile>
            <Texture_All>Gfx\HKB\Items\K_Accessories_Texture_02.png</Texture_All>
            <Attachment>hand_right_Lcf</Attachment>
        </GameItemTypeModel>
        
        <!-- Equipment Modifiers -->
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>UnlockRangedAction</Attribute>
            <StrVal>BasicMagicStaffAttack</StrVal>
        </GameModifier>
        
        <!-- **** Test **** -->
        <!--
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Attack</StrVal>
            <Calculate InternalName = "None" ValueOwner="CastingUnit">
                <Expression><![CDATA[0 -[UnitStat_Attack]]]></Expression>
            </Calculate>
            <Calculate InternalName = "BaseDamage" ValueOwner="CastingUnit">
                <Expression><![CDATA[[None]+1]]></Expression>
            </Calculate>
            <Calculate InternalName = "TotalDamage" ValueOwner="CastingUnit">
                <Expression><![CDATA[[BaseDamage]+[UnitStat_Intelligence]]]></Expression>
            </Calculate>
        </GameModifier>
        -->
    </GameItemType>

 

Next the ranged attack spell used by the staff:

   <SpellDef InternalName="BasicMagicStaffAttack">
        <DisplayName>Magic Staff Attack</DisplayName>
        <Description>Attack a unit from a distance with a single magical bolt from your magic staff.</Description>
        <Image>Action_MagicBolt.png</Image>
        <IconFG>Action_MagicBolt.png</IconFG>
        <IconBG>Action_MagicBolt.png</IconBG>
        <IconColor>255,255,255</IconColor>
        <Range>2.0</Range>
        <MoveCost>10</MoveCost>
        <SpellType>Strategic</SpellType>
        <SpellClass>Offensive</SpellClass>
        <IsRangedAttack>1</IsRangedAttack>
        <SpellTargetType>EnemyUnit</SpellTargetType>
        <SpellResourceCost>
            <Resource>Mana</Resource>
            <Amount>1</Amount>
        </SpellResourceCost>
        <ValidTerrainCategory>Land</ValidTerrainCategory>
        <ValidTerrainCategory>Beach</ValidTerrainCategory>
        <ValidTerrainCategory>Forest</ValidTerrainCategory>
        <ValidTerrainCategory>City</ValidTerrainCategory>
        <ValidTerrainCategory>Water</ValidTerrainCategory>
        <ValidTerrainCategory>Cliff</ValidTerrainCategory>
        <ValidTerrainCategory>Mountain</ValidTerrainCategory>
        <GameModifier InternalName="MagicStaffDamage">
            <ModType>Unit</ModType>
            <Attribute>CurHealth</Attribute>
            <!-- Use the unit's attack stat to determine damage done by the magic staff -->
            <Calculate InternalName = "DamageFromIntelligence" ValueOwner="CastingUnit">
                <Expression><![CDATA[[UnitStat_Intelligence]*-1]]></Expression>
            </Calculate>
            <Calculate InternalName = "Value" ValueOwner="CastingUnit">
                <Expression><![CDATA[[DamageFromIntelligence]+-1]]></Expression>
            </Calculate>
        </GameModifier>
        <SpellCastEffectName>Magic_Staff_Bolt</SpellCastEffectName>
        <SpellCastEffectScale>0.50</SpellCastEffectScale>
        <SpellCastProjectile>1</SpellCastProjectile>
        <SpellCastProjectileSpeed>750</SpellCastProjectileSpeed>
        <!--
        <SoundFX>FireShard_SFX_02</SoundFX>
        -->
    </SpellDef>

 

Besides the problem with the missing level-tag the sounds also seem not to work. It always playes the attacksounds of normal staff.

Reply #43 Top

Quoting Heavenfall, reply 3

Code: xml
  1. &lt;RequiresCity&gt;True&lt;/RequiresCity&gt;


This tag has no apparent function. It is included in most buildings. A few have it set to false, but this doesn't appear to break them. I haven't tried not including this.
End of Heavenfall's quote


<RequiresCity> - Seems only to apply when <RequiresResource> is set to true. In every instance where there is a tag for <RR>, it is set to true and is accompanied by a <RC> tag set to false. Some improvements (such as huts and studies) which do not require a resource node, do not have a setting for <RR>. Yet there is still a setting for <RC> which is set to true. Setting <RC> to False in these instances seems to do nothing. You must still build your improvements in a space connected to your city.

It's a one way street however. For an improvement which normally has an <RR> setting, (farms, mines, element shrines), if you change <RC> to True then the improvement can no longer be built unless it is touching your city.

Quoting Heavenfall, reply 3
3. Improvements (buildings)
To create a building that can be built on top of a world resource,...

Note that each world resource can only have one building on top of it per player. With that I mean that there is no choice for the player, if multiple buildings are available on top of a resource. You need to make sure that the player always has only one building to construct on top of a resource.
End of Heavenfall's quote


I have been experimenting with this and these are my results:

If you try to create an alternate improvement type to go on the same resource node (different "InternalName"), it will simply be ignored by the game and will build the original improvement type.

If you use the same InternalName and set your new improvement to build on an existing resource node, it will combine both the improvement you created and the originally intended improvement. When you go to build it, it will display 2 build costs, and once it is built it will produce both the original output, plus the output from what you designed.

You can change the in-game name and tiles used for an original resource improvement without a problem. To get around the double cost/production problem you can set your new improvement to cost zero to build, and subtract every turn the same amount of resources that the original one produces. This basically works, there is a flaw that it shows an original resource icon on the pop-up picture when you hover over the building, along with an icon for your new replacement resource.

I'm guessing all this can be avoided by simply creating a new resource node that can even be visually identical to the one you are replacing, and then just setting the <Rarity> of the original resource to 0. But I haven't tried it yet.

Reply #44 Top

See the following headlines in the improvements section, troglyte

Modifying existing improvementtypes

Disabling an improvement without changing core files

I added the bit about <RequiresCity>
 

Reply #45 Top

This thread, more than any of the ones that currently are, should be stickied!