Heavenfall Heavenfall

[eLIB] UnitStat Background Mod v.ZG for FE

[eLIB] UnitStat Background Mod v.ZG for FE

 

This library mod is for other modders to include in their mods. There is no point downloading this on its own as a player.

 

UnitStat Background Mod v.ZF = FE 1.34


As part of making the game have greater depth, which is the purpose of any mod, I will be releasing a UnitStat Background mod. The purpose of this library-type mod is to flag unittypes, items and traits with certain UnitStats that will allow the modders to identify them in various scenarios. It is a bit difficult to explain, so I will simply give an example: Imagine a dragon has UnitStat_BG_IsDragon = 1. Then we put this modifier on a weapon:

            <GameModifier>
                <ModType>Unit</ModType>
                <Attribute>AdjustUnitStat</Attribute>
                <StrVal>UnitStat_Accuracy</StrVal>
                <StrVal2>UnitStat_BG_IsDragon</StrVal2>
                <Value>10</Value>
                <vsHigher>1</vsHigher>
            </GameModifier>

The result is a weapon that gains +10 accuracy whenever it attacks against a dragon. Voilá, a dragon-slaying weapon. Or a trait. Such UnitStats can also be referred to in Calculate tags in spells, for example to make a damage spell deal even more damage against a dragon.

Note that this mod will only function as a library of back-ground unitstats. It will be up to the modders to use the unitstats as they see fit.

 

I want to open up the floor for what unitstat flags the modding community expect to find in such a mod.

 

This is my planned list of unitstats. Note that these unitstats will not have defaultvalue set to 0 for all units, they will simply have 0 by virtue of not having it. 

Equipment UnitStats:

UnitStat_BG_IsUsingMount - 1 for mounted units, 0 for un-mounted units

Unit UnitStats: (stats marked ^ are given through traits to help players understand what is what)

UnitStat_BG_IsChampion - 1 for champions and sovereigns
UnitStat_BG_IsSovereign - 1 for sovereigns, 0 for others (note that everyone with IsSovereign also have IsChampion)
UnitStat_BG_IsMilitia^ - 1 for city militia, 0 for all others
UnitStat_BG_IsHumanoid - 1 for any unit that resembles a human in shape, not necessarily in size
UnitStat_BG_IsNotAlive^ - 1 for any unit that does not have blood pumping in its veins, is incapable of consuming nutrition, and is incapable of reproduction
UnitStat_BG_IsEmpire - 1 for sovereigns, champions and designed units from empire factions. 0 for others
UnitStat_BG_IsKingdom - 1 for sovereigns, champions and designed units from Kingdom factions. 0 for others
UnitStat_BG_IsRace_ - These unitstats are given to mark all champions, sovereigns and designed units from certain racetypes. These are the "races" that appear in Unit Details when you create a normal unit. The wildcard (*) is replaced by the name of the race as it appears in-game. The vanilla game contains 10 races that have the following names: Altarians, Mancers, Ironeers, Amarians, Tarthans, Krax, Wraiths, Trogs, Urxen, Quendar. For example, all of the race Altarians have UnitStat_BG_IsRace_Altarians = 1
UnitStat_BG_IsMonster - for all units considered monsters. Note that this applies to recruited monsters as well. Anything that is not humanoid is considered a monster.
UnitStat_BG_IsDragon - 1 for dragon monsters, 0 for others
UnitStat_BG_IsElemental - 1 for elementals, 0 for others
UnitStat_BG_IsBeast - 1 for beasts, 0 for others
UnitStat_BG_IsTwisted - 1 for Twisted creatures, 0 for others
UnitStat_BG_IsConstruct - 1 for construct creatures, 0 for others (basically golems)
UnitStat_BG_IsDemon^ - 1 for demons, 0 for others
UnitStat_BG_IsGod^ - 1 for the 5 elemental gods found in the wildlands and other godtype units at your discretion, 0 for others
UnitStat_BG_IsSummoned^ - 1 for units that are specifically summoned through magical spells, and NOT those trained. 0 for others
UnitStat_BG_IsImmortal^ - 1 for certain units that cannot die from old age. In the core game, these include: Titans, Dragons and Butchermen, Elemental gods (NOT all elementals!). 0 for all others. Keep in mind constructs are not immortal and may die from old age (they basically turn to dust after a few thousand years), but they are also UnitStat_BG_IsNotAlive^ 1.
UnitStat_BG_IsOversized^ - It is 1 for units that are substantially larger than a single human-sized mounted man. Note that this indicates that a singular unit of this sort is oversized - a unit does not become oversized if it goes from 1 to 9 members. Dragons, Giant Slags, Giant Drakes, elemental gods, and so on. It is 0 for all others.
UnitStat_BG_IsMale - 1 for units specifically marked male. 0 for others. Note: This is only applied to champions and sovereigns and troops. Practically noone else has a gender. It is perfectly possible for a unit to have 0 in both _IsMale and _IsFemale.
UnitStat_BG_IsFemale - 1 for units specifically marked female. 0 for others. Note: This is only applied to champions and sovereigns and troops. Practically noone else has a gender. It is perfectly possible for a unit to have 0 in both _IsMale and _IsFemale.
UnitStat_BG_IsFlying^ - 0 (default) = incapable of flight. 1 = Capable of Flying (does not need to be constantly flying)

Other Custom UnitStats:

UnitStat_BG_HasInjuries - 0 for all, each injury suffered by a champion adds +1. Note that there are many "flaws" that are NOT injuries. This tag is specifically for champion injuries suffered due to incapacitation in combat.
UnitStat_BG_Spellbooks - between 0 and 5, depending on how many spellbooks this champion/sov/unit has. It is enough to have rank 1 in a spellbook to get +1 in this unitstat.
UnitStat_BG_GreyMagic - Between 0 and 25+, depending on how many spelltraits this champion/sov/unit has. Each spelltrait adds 1, so a champion with Death2 Fire3 would have UnitStat_BG_GreyMagic = 5.

Non-unit Stats
A_Additive_TileYieldGrain - Faction-wide bonus additive to Grains. Ex: +1 Grain in every city
A_Additive_TileYieldMaterials - Faction-wide bonus additive to Materials. Ex: -1 Material in every city
A_Additive_TileYieldEssence - Faction-wide bonus additive to Essence. Ex: -1 Essence in every city

 


 

Currently disabled

UnitStat_BG_IsInSwamp - 0 for all units, 1 for those who are occupying a Swamp tile on the strategic map
UnitStat_BG_IsInPlains - 0 for all units, 1 for those who are occupying a Plains tile on the strategic map
UnitStat_BG_IsInHills - 0 for all units, 1 for those who are occupying a Hills tile on the strategic map
UnitStat_BG_IsInDesert - 0 for all units, 1 for those who are occupying a Desert tile on the strategic map
UnitStat_BG_IsInForest - 0 for all units, 1 for those who are occupying a Forest tile on the strategic map
UnitStat_BG_IsInCity - 0 for all units, 1 for those who are occupying a City tile on the strategic map
UnitStat_BG_IsInRiver - 0 for all units, 1 for those who are occupying a River tile on the strategic map



UnitStat_BG_IsUsingSmallShield - 1 for units with a small or normal shield equipped, 0 for others. Does not mark tower shields.
UnitStat_BG_IsUsingTowerShield - 1 for units with a tower shield equipped, 0 for others. Does not mark non-tower shields
UnitStat_BG_IsUsingSpear - 1 for units with a spear, 0 for others
UnitStat_BG_IsUsingStaff - 1 for units with a staff, 0 for others
UnitStat_BG_IsUsingBow - 1 for units with a bow, 0 for others
UnitStat_BG_IsUsingMace - 1 for units with a mace, 0 for others
UnitStat_BG_IsUsingSword - 1 for units with a sword, 0 for others
UnitStat_BG_IsUsingAxe - 1 for units with a axe, 0 for others
UnitStat_BG_IsUsingDagger - 1 for units with a dagger, 0 for others

UnitStat_BG_IsUsingTwoHanded - 1 for units with a Two-handed weapon equipped, 0 for others. This counts for all weaponry that requires both hands to use, such as staffs, bows and spear.
UnitStat_BG_IsUsingOneHanded - 1 for units with a one-handed weapon equipped, 0 for others.
UnitStat_BG_IsUsingDualWield - 1 for units with two one-handed weapons equipped, 0 for others
UnitStat_BG_IsWearingLeather - This value is between 0 and 7 - each equipped leatherpiece adds 1, chest and leggings add 2 instead of 1
UnitStat_BG_IsWearingChainmail - This value is between 0 and 7 - each equipped chainmailpiece adds 1, chest and leggings add 2 instead of 1
UnitStat_BG_IsWearingPlate - This value is between 0 and 7 - each equipped platepiece adds 1, chest and leggings add 2 instead of 1
UnitStat_Bg_MagicalNature - A custom value given to items of a magical nature. Any non-magical item should have nothing (0). As a base-line, magical items will start at UnitStat_Bg_MagicalNature = 100. Particularly powerful, or reality-bending items might have 200 or even 300. There is no clear line between rarity of items and this stat, because the game has many "uncommon" magical and non-magical items. Items will display their number in the item tooltip, unless it is 0 in case it won't be mentioned. Accessories can also have this stat.
UnitStat_BG_IsRanged - 1 for any weapon that turns the main attack of a unit into a ranged attack. 0 for others
UnitStat_BG_IsMelee - 1 for any melee weapon, and any unarmed monster. 0 for others


 

 

 

92,374 views 145 replies
Reply #76 Top

Version C: http://dl.dropbox.com/u/32649007/A_LIB_UnitStat_BG_vC.rar

changelist:
Updated weapons to have one of the following:
UnitStat_BG_IsUsingSpear
UnitStat_BG_IsUsingStaff
UnitStat_BG_IsUsingBow
UnitStat_BG_IsUsingMace
UnitStat_BG_IsUsingSword
UnitStat_BG_IsUsingAxe
UnitStat_BG_IsUsingDagger

In addition, all weapons have one of the following:
UnitStat_BG_IsUsingTwoHanded (including bows, staffs, spears and all other weapons that require both hands to use)
UnitStat_BG_IsUsingOneHanded
UnitStat_BG_IsUsingDualwield (again, this is not used in the core game, but it will be in mods so that's why its there)

UnitStat_BG_IsInHills - this stat was visible for testing purposes, it is now appropriately hidden
UnitStat_BG_MagicalNature - I am aware that this creates issues at the unit design window (it pushes wages off the list, you can scroll down to it though). I'm working on a fix.

Also, I've done some formatting on some files - CoreItems.xml, CoreArmor.xml, CoreUnits.xml, CoreMonsterUnitTypes.xml. Besides the next note, no actual data was changed in those files.

Finally, I've reduced all the likelihood tags by ~75% for all the gameitemtype in CoreWeapons, CoreItems.xml and CoreArmor.xml. See this post for an explanation: https://forums.elementalgame.com/418506/get;3105148
 

(updating main post now)

Reply #77 Top

I left a WIP file in by mistake, terrainmod_replaceterrains.xml should not be in the mod. Version D is uploaded, and the only difference is that that file is now "empty".

http://dl.dropbox.com/u/32649007/A_LIB_UnitStat_BG_vD.rar

Reply #78 Top

I just noticed that the UnitStat_BG_IsSovereign wasn't applied when creating custom sovereigns. It should be. I'll fix it in the next version F, which will be out when the next FE patch is released.

Reply #79 Top

If anyone can think of a reason to keep the metal/crystal cost stats on equipment, please say so now. Otherwise I'm going to remove them. The problem is the same as before - the costs only exist for unit design items, not magical items found in the wild (which is mostly what champions wear). Also, they are not accurate if you have abilities like Armorer to reduce metalcost of produced units.

This makes them inaccurate and useless. Instead of using metalcost or crystalcost, I would recommend using plate/chainmail armor and/or magicalnature stat.

Reply #80 Top

Uploaded version G, which is equal to 0.90 FE. Removed metalcost, diplomatic cost  and crystalcost.

Reply #81 Top

H=0.91

Reply #82 Top

J = 0.912

Ironeer's Iron Golem is now appropriately marked as _IsConstruct _IsMonster _IsNotAlive^

Reply #83 Top

There's a small bug with token of the wolf. It will summon the right animal, but it will be 1 level too low, and named Sand Golem. I'll fix it in next version.

Reply #84 Top

Uploaded K. Only fix is for token of the wolf. Also updated to 0.913.

Reply #85 Top

version L uploaded

Reducing the Likelihood of items caused the random itemdrop to bug out. Everything now has normal likelihood again.

Reply #86 Top

So I was doing some testing and I noticed that this mod was breaking random drops from monsters. That is, of course, unacceptable. So for now, I've disabled the following unitstats:

UnitStat_BG_IsUsingSmallShield - 1 for units with a small or normal shield equipped, 0 for others. Does not mark tower shields.
UnitStat_BG_IsUsingTowerShield - 1 for units with a tower shield equipped, 0 for others. Does not mark non-tower shields
UnitStat_BG_IsUsingSpear - 1 for units with a spear, 0 for others
UnitStat_BG_IsUsingStaff - 1 for units with a staff, 0 for others
UnitStat_BG_IsUsingBow - 1 for units with a bow, 0 for others
UnitStat_BG_IsUsingMace - 1 for units with a mace, 0 for others
UnitStat_BG_IsUsingSword - 1 for units with a sword, 0 for others
UnitStat_BG_IsUsingAxe - 1 for units with a axe, 0 for others
UnitStat_BG_IsUsingDagger - 1 for units with a dagger, 0 for others

UnitStat_BG_IsUsingTwoHanded - 1 for units with a Two-handed weapon equipped, 0 for others. This counts for all weaponry that requires both hands to use, such as staffs, bows and spear.
UnitStat_BG_IsUsingOneHanded - 1 for units with a one-handed weapon equipped, 0 for others.
UnitStat_BG_IsUsingDualWield - 1 for units with two one-handed weapons equipped, 0 for others
UnitStat_BG_IsWearingLeather - This value is between 0 and 7 - each equipped leatherpiece adds 1, chest and leggings add 2 instead of 1
UnitStat_BG_IsWearingChainmail - This value is between 0 and 7 - each equipped chainmailpiece adds 1, chest and leggings add 2 instead of 1
UnitStat_BG_IsWearingPlate - This value is between 0 and 7 - each equipped platepiece adds 1, chest and leggings add 2 instead of 1
UnitStat_Bg_MagicalNature - A custom value given to items of a magical nature. Any non-magical item should have nothing (0). As a base-line, magical items will start at UnitStat_Bg_MagicalNature = 100. Particularly powerful, or reality-bending items might have 200 or even 300. There is no clear line between rarity of items and this stat, because the game has many "uncommon" magical and non-magical items. Items will display their number in the item tooltip, unless it is 0 in case it won't be mentioned. Accessories can also have this stat.
UnitStat_BG_IsRanged - 1 for any weapon that turns the main attack of a unit into a ranged attack. 0 for others
UnitStat_BG_IsMelee - 1 for any melee weapon, and any unarmed monster. 0 for others

and no items from the core game are overwritten any more except mounts which for some reason don't break the game (possibly because they have no likelihood but who knows).

I've sent a PM to Derek Paxton about the issue. Hopefully it gets fixed. Otherwise, those unitstats will stay disabled. Working on a new version to upload.

 

Edit: Uploaded real L

L basically removes the above unitstats, and fixes a bug where players would see clothing items (and other useless crap) drop from high-level monsters.

Reply #87 Top

M = 0.914

Reply #88 Top

Uploaded .O which is 0.915 (I forgot to upload .N)

- Fixed an issue with Iron Golems and the trait Not alive. Iron golems no longer count as Not Alive.

- Added new stat

UnitStat_BG_IsDemon^ - 1 for demons, 0 for others

in vanilla game that trait is given to Lurk AssasinDemon CyndrumDemon CrowDemon DeathDemon (and their summoned copies)

- Resoln elementals from faction ability Binding now come with the trait Summoned

Reply #89 Top

Just a heads up, I'm going to remove Magical Nature from the mod when beta 4 hits. It is a useless stat and takes way too much time to maintain to be worth it for such a small use.

Reply #90 Top

I forgot to update this separate topic to version P, but here's version Q anyway.

In version Q I changed all references to UnitStat_BG_IsMounted to the correct UnitStat_BG_IsUsingMount. I frankly don't remember that P version was, it was likely just an update to Beta 4.

Edit: Oh yeah, now I remember.

UnitStat_BG_ResistBlunt - resistance stat for blunt damage
UnitStat_BG_ResistPierce - resistance stat for pierce damage
UnitStat_BG_ResistCutting - resistance stat for cutting damage

Those have been integrated into the vanilla game so they were removed from this mod.

UnitStat_ResistCutting
UnitStat_ResistPierce
UnitStat_ResistBlunt

Reply #91 Top

Quoting Heavenfall, reply 91
Those have been integrated into the vanilla game so they were removed from this mod.

UnitStat_ResistCutting
UnitStat_ResistPierce
UnitStat_ResistBlunt

Good stuff, here.

Reply #92 Top

Version R has a new file in /CoreReplacementFiles/ named vsUnitType_Overwrite.xml

It contains ability rewrite and item overwrite of certain weapons that performed effects dependent on target's <CreatureType>. These effects were changed to use background unitstats instead. Example below.

Before:

           <GameModifier>
                <ModType>Unit</ModType>
                <Attribute>AdjustUnitStat</Attribute>
                <StrVal>UnitStat_Attack_Blunt</StrVal>
                <StrVal2>Twisted</StrVal2>
                <Value>7</Value>
                <Provides>+7 Attack vs Twisted</Provides>
                <vsUnitType>1</vsUnitType>
            </GameModifier>

After:

    <GameModifier>
      <ModType>Unit</ModType>
      <Attribute>AdjustUnitStat</Attribute>
      <StrVal>UnitStat_Attack_Blunt</StrVal>
      <StrVal2>UnitStat_BG_IsTwisted</StrVal2>
      <Value>7</Value>
      <Provides>+7 Attack vs Twisted unless user is Twisted</Provides>
      <vsHigher>1</vsHigher>
    </GameModifier>

 

Reply #93 Top

Version s

New file: tokensummon_Overwrite.xml. Alters the various items that summons monsters to summon monsters that count as Summoned instead (say that five times in a row).

Reply #94 Top

T uploaded, updated to 0.980

Added A_Additive_TileYieldEssence to lib_allowglobalyieldmod.xml

Reply #95 Top

i have 1 doubt, do i need to put stats into core units or can i work around someway

 

for example is summoned

can i make the summon spell add this modifier someway or do i need to put it somewhere into the summoned unit stats?

Reply #96 Top

The mod includes replacements for all core units. If you want to make your own units you'll need to put your own unitstats in. Check out UnitStat_BG_abilityspecials.xml for some sample traits.

Reply #97 Top

ah ok you did rewrite 2 copies for each like fire elemental normal and fire elemental summoned

 

uhmm ok, ill think how i can use this

 

Reply #98 Top

What about a stat that makes tile yield calculations? Can we mod the tile to add 3 points of BG_UnitStat_Grain to a city? If so, that stat could do the calculation, instead of the current calc that looks directly at the tile yield, which is buggy at best.

Reply #99 Top

I don't see a way to accomplish that given how dynamic the tile yields are.

Reply #100 Top

What do you mean? As long as every adjustment to tile yield gives +X to the stat, it should work fine.