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,372 views 145 replies
Reply #126 Top

Just throwing one out there that isn't in the weapons list - what about the "battle mage" troop classes? Such as folks with ranged flame and ice staves?

Reply #127 Top

The weapons aren't activated, it breaks the drop system when I do unfortunately.

Reply #128 Top

I was actually always wondering about this as when you recruit different champions they instantly gain your factions bonuses as well as their natural  factions bonuses.  So if you are an Altar faction and you recruit a Tarth hero that hero gains nothing for movement but does get the 10% xp bonus.  Vice versus happens as well, if you have a faction with the movement bonus and recruit monsters/champions they inherit that movement bonus.  This seems extremely strange in that regard and if possible would make more sense to limit it to original factional humanoids trained by that faction.

Reply #129 Top

is the following the proper way to add crit vs mounted to spears?(i have a +dmg too) 

... and is there a way to make weapons that are more powerful only in the hands of a mounted unit? ... i want to make swords and lances designed to be used Only with cavalry (or id just give a bonus if they are using mounts)

<GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_ChanceToCrit</StrVal>
            <StrVal2>UnitStat_BG_IsUsingMount</StrVal2>
            <Value>4</Value>
        </GameModifier>

\/  to save space on this post lol..... thanks heavenfall! that'll work perfect!

and donald duck rocks lol

Reply #130 Top

You also need <vsHigher>1</vsHigher>. This would make the ability "+4 Crit against mounted units unless this unit is mounted".

Or, for cavalry, you could do <vsLower>1</vsLower>. This would make the ability "+4 Crit against un-mounted units unless this unit is un-mounted"

Reply #131 Top

This directly relates to the tag you suggested I put in DogsOfWar... I was wondering what the tags were for.  Thanks for this, Heavenfall, this opens up a world of possibilities.

Reply #132 Top

Quoting Heavenfall, reply 127
The weapons aren't activated, it breaks the drop system when I do unfortunately.
Just to clarify.

You're saying that, for example, modifying the weapon file so that axes give the unit wielding them a sort of "is axeman" quantifier results in the game's loot system throwing a wobbly?

Because that seems strange considering the item will only be, essentially, gaining an extra unique ability - much like armour penetration or extra counter attacks. I don't see how adding this affects the random loot table at all.

Edit: I am trying to manually add these features to my own weapon balancing mod. I realise you haven't included YOUR version of CoreWeapons and CoreArmour and actually I'm cool with that as I wasn't going to use them anyway.

If I was going to use this version by adding things like "UnitStat_BG_IsRanged" or "UnitStat_BG_IsUsingMace" how exactly should I input that code?

Looking at the mounts section I notice the code is input immediately before the display name - which is also quite a bit before the random loot generation code. Perhaps that's why the random loot is providing to be such an issue?

I would really love to use these mod tools towards developing more distinct unit roles based upon their equipment but the unfortunate fact is I don't quite understand how you're applying it.

Below for example:

<GameItemType InternalName="BasicHorseMount">
<GameModifier InternalName="_IsUsingMount">
<ModType>Unit</ModType>
<Attribute>AdjustUnitStat</Attribute>
<StrVal>UnitStat_BG_IsUsingMount</StrVal>
<Value>1</Value>
<Provides>Unit counts as Mounted</Provides>
</GameModifier>
<GameModifier InternalName="_IsUsingMount">
<ModType>Unit</ModType>
<Attribute>AdjustUnitStat</Attribute>
<StrVal>UnitStat_BG_IsFlying</StrVal>
<Value>1</Value>
<Provides>This unit is capable of flight and counts as Flying</Provides>
</GameModifier>I notice that - apparently - basic horse mounts can fly? Is that supposed to be there? Also, why does this information have to be immediately after the internal name? Couldn't this information be provided in the attributes section?
<DisplayName>Horse</DisplayName>
<Description>Horses grant your units more speed in combat and in travel, allow them to carry more weight and make them immune to being knocked prone.</Description>
<Type>Mount</Type>
<CanBeEquipped>1</CanBeEquipped>
<ShopValue>120</ShopValue>
<ProductionRequirement>
<Type>Resource</Type>
<Attribute>Horses</Attribute>
<Value>1</Value>
</ProductionRequirement>
<GameModifier>
<ModType>Unit</ModType>
<Attribute>AdjustUnitStat</Attribute>
<StrVal>UnitStat_ChanceToAvoidProne</StrVal>
<Value>100</Value>
</GameModifier>
<GameModifier>
<ModType>Unit</ModType>
<Attribute>AdjustUnitStat</Attribute>
<StrVal>UnitStat_DodgeAgainstRanged</StrVal>
<Value>25</Value>
</GameModifier>
<GameModifier>
<ModType>Unit</ModType>
<Attribute>AdjustUnitStat</Attribute>
<StrVal>UnitStat_Moves</StrVal>
<Value>2</Value>
</GameModifier>
<GameModifier>
<ModType>Unit</ModType>
<Attribute>AdjustUnitStat</Attribute>
<StrVal>UnitStat_WeightCapacity</StrVal>
<Value>20</Value>
</GameModifier>
<CutSceneDataPack>HorseMountCutScenePack</CutSceneDataPack>
<IsAvailableForSovereignCustomization>0</IsAvailableForSovereignCustomization>
<Prereq>
<Type>RestrictedAbilityBonusOption</Type>
<Attribute>LegacyOfSerrane</Attribute>
<Target>Player</Target>
</Prereq>
<Prereq>
<Type>Tech</Type>
<Attribute>Mounted_Warfare</Attribute>
</Prereq>
<AIData AIPersonality="AI_General">
<AIPrefType>AIPrefType_MOUNT</AIPrefType>
</AIData>
<ArtDef>BasicHorseMount_ArtDef</ArtDef>
</GameItemType>

Sorry to bother you with this, I just really want to understand this tool.

Reply #133 Top

 

Quoting sjcroft1, reply 133
You're saying that, for example, modifying the weapon file so that axes give the unit wielding them a sort of "is axeman" quantifier results in the game's loot system throwing a wobbly?

Yes.

There is no "loot table", the information about how an item drops is included in the item itself. I don't know why it throws a wobbly, but it does. You'll start getting hairstyles and human heads and other cosmetic items from monster drops. I haven't really explored the issue much more than that in recent days, I just know it's a bad idea.

Reply #134 Top

I hope you don't miss the edit to my post above. I understand that there is no actual loot 'table' in the game, rather the CoreWeapons and CoreArmor file is used to determine what stuff drops.

My hypothesis is that the location of the class attributes being added to the weapon occurring before the weapon's actual in-game name and not alongside other attributes is removing them from the games internal "loot table".

Noticing that mounts don't have a <Likelihood> code to them at all so that's why it probably doesn't affect the loot table, mounts were never even considered in the process.

Reply #135 Top

Yeah the flying mount was fixed err.... but I just fixed it in Stormworld without updating this topic. Didn't think anyone used it. Heh. Just move that modifier to the dragon mount and you are up to date.

As for the location of the modifier exactly, I don't think it matters at all. That's not how objects work in general. But I could be wrong.

Reply #136 Top

Something I noticed about adding new prereqs to attempt to use stats like what you are referring to here is that they sort of work but do not unlock when a tech is reached for general sale.   Unless you also then make a specific building that also unlocks and force sells the item.  So while you can make champion/sov specific gear that has additional prereqs, that sometimes work(which ones do and don't would take far too long right now), they will not be available for troops specifically.

Reply #137 Top

Uploaded version ZD, fixing two issues

1) City Archers were not counted as Militia, they are now

2) The Flying modifier on Horse was moved to the Dragon mount

Reply #138 Top

Quoting Heavenfall, reply 138
2) The Flying modifier on Horse was moved to the Dragon mount


What no pegasus... I'm disappointed. :troll:

Reply #139 Top

ZE = FE 1.10

Reply #140 Top

Version ZE is up-to-date for 1.12

Reply #141 Top

I'm missing something here.  I can understand how to use the unitstats when you have a unit targeting another unit, but I can't seem to wrap my head around using these outside of that situation.  I tried studying how the "Reliquary_InfiniteHealingPotion" functioned with Immortals, but I don't quite understand how the calculations work.

Basically, I'm wanting to add secondary effects/bonuses to equipment and spells when they're used by a sovereign.  How would you include UnitStat_BG_IsSovereign - 1 into an additional GameModifier?  Or if it's simpler, is it possible to call the <IsSovereign>1</IsSovereign> element owned by the unit (and how would that work)?

Reply #142 Top

ZF = 1.20

No changes to mod

Reply #143 Top


That Background Mod is awesome, and above all, very useful! just discovered it, and want to congratulate you for it. :thumbsup:

Reply #144 Top

@HF - Regarding the problems adding unitstats to items.... i'm wondering if this is still an issue.  In LH, shields have a unit stat, and a likelihood of drop etc... for example RoundShield has this stuff...

<GameModifier>
  <ModType>Unit</ModType>
  <Attribute>AdjustUnitStat</Attribute>
  <StrVal>UnitStat_IsShield</StrVal>
  <Value>1</Value>
  <Provides>Enables abilities that require Shields</Provides>
</GameModifier>
<IsAvailableForSovereignCustomization>0</IsAvailableForSovereignCustomization>
<Likelihood>400</Likelihood>
<RarityDisplay>Common</RarityDisplay>

So maybe it would be ok adding unitstats to weapons and such now?  When you had problems with this before... was it very obvious, i.e. did you get strange weapon drops pretty much straight away?

 

Reply #145 Top

Yeah, any random drops from monsters got messed up. It wasn't that they had unitstats, it was that I had to overwrite them all from /mods/ folder. I haven't checked LH yet.