[eLIB] UnitStat Background Mod v.ZG for FE

By on February 16, 2012 4:16:09 PM from Elemental Forums Elemental Forums

Heavenfall

Join Date 07/2008
+436

 

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


 

 

 

Locked Post 145 Replies +2
Search this post
Subscription Options


Reason for Karma (Optional)
Successfully updated karma reason!
February 17, 2012 10:49:59 AM from Elemental Forums Elemental Forums

Complex issue. I think that it could make more sense to hate intelligent beings (Sov, Champs and regular troops, maybe some recruited creatures).

Recruited champions of other factions? Each faction could have an "Oath of Fealty" custom spell to add the proper faction stat (keeping the old one so he is dual aligned, or setting all the other faction stats to 0).

May consider to use also/instead race for hatred mechanics?

Reason for Karma (Optional)
Successfully updated karma reason!
February 17, 2012 10:57:26 AM from Elemental Forums Elemental Forums

Hmm good point... it would make it a LOT easier to use race instead of faction. Most importantly, it's already visualized in the UI so the player would know exactly when it works. Ex - "Unit deals 25% more damage against the Altarian race". Another bonus of that is that it would apply to custom factions as well, which I'm struggling to implement.

An oath of fealty spell would be neat, but it wouldn't be in this mod. It would be one of those things you could do with this mod. I don't want to put any "content" like that in this mod, it should work 100% in the background like any library.

Reason for Karma (Optional)
Successfully updated karma reason!
February 17, 2012 4:22:04 PM from Elemental Forums Elemental Forums

Due to this bug: http://forums.elementalgame.com/417079/get;3084892

until it is fixed, I have no means of creating faction-wide bonuses to unitstats. Therefore, the following unitstats will be changed to apply only to core units such as sovereigns, champions and designed trained units:

UnitStat_BG_IsEmpire - 1 for all units owned by factions that are Empire, 0 for others
UnitStat_BG_IsKingdom - 1 for all units owned by factions that are Kingdom, 0 for others
UnitStat_BG_IsFaction_* - These UnitStat values will be given to all factions. Each faction will have their own value, which is 1 for that faction. An example: UnitStat_BG_IsFaction_KingdomOfAltar = 1 for the Altar faction, 0 for everyone else. Note the wildcard is the same as the internalname of the raceconfig. Also note that this +1 is given to ALL units owned by the faction, regardless of their origin
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.

I will update the main post in a sec

Edit: The new descriptions:

 

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

Edit: Also added UnitStat_BG_IsUsingOneHanded

Reason for Karma (Optional)
Successfully updated karma reason!
February 18, 2012 6:59:35 AM from Elemental Forums Elemental Forums

I'm changing this

UnitStat_BG_IsAlive - 1 for any unit that has blood pumping in its veins, is capable of consuming nutrition, and is capable of reproduction

to this

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

The reason is 95% of the units in the game are alive, so it is far easier to mark those that are non-living. Examples of non-living: catapults, all constructs, some elementals, butchermen. I'm on the fence about assassin demons and death demons. While they may be "alive", their kind of life is probably so alien to what we think of life that it shouldn't be called life.

Reason for Karma (Optional)
Successfully updated karma reason!
February 18, 2012 7:52:12 AM from Elemental Forums Elemental Forums

Added

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.

Reason for Karma (Optional)
Successfully updated karma reason!
February 18, 2012 10:28:46 AM from Elemental Forums Elemental Forums

Added

UnitStat_BG_ResistBlunt - Functions like normal resistance stats, but against Blunt damage
UnitStat_BG_ResistCutting - Functions like normal resistance stats, but against Cutting damage
UnitStat_BG_ResistPierce - Functions like normal resistance stats, but against Piercing damage

edit: No, I removed them again. They don't belong here. I'll have to put them in their own lib.

Edit2: added

UnitStat_BG_DiplomaticCapitalCost - This value represents the total diplomatic capital required to produce this unit.

Reason for Karma (Optional)
Successfully updated karma reason!
February 18, 2012 2:07:34 PM from Elemental Forums Elemental Forums

I think a hired champion should have both the faction it is born as tagged and should also be tagged for the faction that hired it. 

Quoting Heavenfall,
Philosophically speaking, the champion could probably "hate" the catapult as it was something they produced. But is it the gut-wrenching, foaming-at-the-mouth hate he would feel for the people? I don't think so.

I don't know, I think you may be over-rationalizing a tad.  I think the hatred of a construct or summons of a hated enemy would be just as deep as the hatred for the hated people themselves.

Reason for Karma (Optional)
Successfully updated karma reason!
February 18, 2012 2:15:43 PM from Elemental Forums Elemental Forums

why have a gender tag for troops? Why not just Sovereigns and their Champions?

(or are we making an Amazon faction? )

Reason for Karma (Optional)
Successfully updated karma reason!
February 18, 2012 2:32:16 PM from Elemental Forums Elemental Forums

@mqqiffle for now the discussion is moot, due to a modbug I had to go another way. There is no easy way to create faction-wide unitstats, so I give them out individually where it fits instead.

@Tasunke it's a way to distinguish the vanilla units from each other. What importance will the stat have? That is not for me to decide. I am merely providing it for the modders (and my other mods). And, at the end of the day, there ARE female troops in the game. So why shouldn't I tag them as such? If you want to build a spell that only affects female sovereigns and champions but not troops, you can still do that.

Reason for Karma (Optional)
Successfully updated karma reason!
February 18, 2012 2:42:05 PM from Elemental Forums Elemental Forums

k

Reason for Karma (Optional)
Successfully updated karma reason!
February 19, 2012 2:56:44 AM from Elemental Forums Elemental Forums

Changed _IsUsingShield and added another one to supplement


UnitStat_BG_IsUsingAnyShield - 1 for all units using any shield, 0 for others
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

Reason for Karma (Optional)
Successfully updated karma reason!
February 19, 2012 4:16:20 AM from Elemental Forums Elemental Forums

Making sure the UI keeps the player informed:

Hmm... would "Equipment is made of Metal (x)" make more sense?

 

Reason for Karma (Optional)
Successfully updated karma reason!
February 19, 2012 6:44:53 AM from Elemental Forums Elemental Forums

Added

UnitStat_BG_IsUsingStaff - 1 for units with a staff equipped, 0 for others

and removed

UnitStat_BG_IsUsingAnyShield - 1 for all units using any shield, 0 for others

(it is just a repeat of UsingSmallShield and UsingTowerShield)

 

 

I'm also unsure about keeping these two:

UnitStat_BG_MetalCost - This value  represents the total metal required to produce this unit.
UnitStat_BG_CrystalCost - This value represents the total crystal required to produce this unit.

since most magical items don't have any cost associated with them, is there any use in such a stat?

Reason for Karma (Optional)
Successfully updated karma reason!
February 20, 2012 5:27:47 AM from Elemental Forums Elemental Forums

This value

UnitStat_Bg_MagicalNature - this unitstat, which can be found on items, will also be found on some units, and is again something similar to its earlier function - to point out particularly mystical or magical units. The value is 0 for those considered non-magical, such as a spider or an ogre. It will be 100 for most units considered magical, and up to 300 for those units that are completely magical in nature such as a Fire Elemental.

is going to change substantially. If champions are going to walk around all decked out in armor, a mount, weapons and accessories, then their range in that stat is going to be 0-2500. For the stat to make any sense, it has to reflect that range for pure magical monsters without any equipment. Since the stat also reflects the POWER of the magic, as well as its quantity, 2500 will be given to the elemental gods. Elementals in particular will be given high values, a fire elemental would land somewhere around 1500. I'll try to set the values as best I can, but they will be arbitrary based on descriptions and power from stats. The stat will also change based on the level the unit had when it was created. That means higher level units may have higher _magicalnature but it will not go up when a unit levels up. 

Reason for Karma (Optional)
Successfully updated karma reason!
February 20, 2012 9:01:55 AM from Elemental Forums Elemental Forums

isRanged, isMelee and isSpellCaster would be useful. Might seem redundant to have both isMelee and isRanged, but units like pioneers might be considered 0 for both. Also, there might be cases where Spellbook is 0 and the unit is still a caster.

Reason for Karma (Optional)
Successfully updated karma reason!
February 20, 2012 9:14:23 AM from Elemental Forums Elemental Forums

From what I understand, in beta 2 all champions will be able to cast spells. So unless I'm mistaken, you can check for champion or sovereign instead to see if they are spellcasters.

isRanged and isMelee also good ideas. Currently, the only ranged weaponry available are bows. But there has been hints that that will change in beta 2. If there is any main ranged attacks other than bows, I will add isRanged and isMelee. Otherwise, currently, if you are using bow you are ranged, otherwise you are melee.

Edit: Thinking about it again, modders may not want to adhere to that philosophy even if the vanilla game does. I'll add IsSpellcaster, IsRanged and IsMelee

Reason for Karma (Optional)
Successfully updated karma reason!
February 20, 2012 9:51:26 AM from Elemental Forums Elemental Forums

Hmm... IsSpellcaster is tricky. I don't think it's possible to include any monster that can use a spell in that definition (the XML would be very, very messy). I'll have to think about how to do that in a way that is apparent to the player.

added

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

Reason for Karma (Optional)
Successfully updated karma reason!
February 20, 2012 4:28:29 PM from Elemental Forums Elemental Forums

Quoting Heavenfall,
Making sure the UI keeps the player informed:



Hmm... would "Equipment is made of Metal (x)" make more sense?

 

 

IMO I would say "Unit counts as wearing plate" (no "some")

and "Equipment is made of (x) metal"

 

These construct sentences were are used to 

Reason for Karma (Optional)
Successfully updated karma reason!
February 20, 2012 4:53:34 PM from Elemental Forums Elemental Forums

For armors such as plate, I would say: "Armor type: Plate +X"

For the material stuff, Eviliron's idea is good.

Reason for Karma (Optional)
Successfully updated karma reason!
February 21, 2012 4:02:29 AM from Elemental Forums Elemental Forums

Changed accordingly.

Also added

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.

Reason for Karma (Optional)
Successfully updated karma reason!
February 21, 2012 4:34:18 AM from Elemental Forums Elemental Forums

Quoting Capn Darwin,

For creatures how about IsOversizedTarget. Allow us to tack on more damage from AOE spells or hit easier with thrown/projected weapons.

I'm adding this one in as well.

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.

 

Reason for Karma (Optional)
Successfully updated karma reason!
February 21, 2012 5:38:46 AM from Elemental Forums Elemental Forums

On second thought, better to have it inside brackets to not confuse for an armor bonus, so "Armor type: Plate (+2)" is probably best.

Reason for Karma (Optional)
Successfully updated karma reason!
February 21, 2012 5:41:34 AM from Elemental Forums Elemental Forums

Yeah, that's how I did it.

Reason for Karma (Optional)
Successfully updated karma reason!
February 25, 2012 4:23:16 AM from Elemental Forums Elemental Forums

Here is an early version of the mod. It's up-to-date for 0.86. This is for modders only.

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

You'll also find 3 example mods in the folder. Remember to delete those for any potential release you make.

The first is a trait that becomes available for anyone with at least 3 injuries at level-up: Battleborn: +5 defense

The second is a trait that becomes available for anyone that follows path of the mage, has at least 4 spellbooks and 12 total spellranks at level-up: Master of the Arcane: +20 spell mastery.

The third is a mod called Hate and Fear, that adds stuff to all most champions in the world such as things they hate or fear, and things that hate or fear them. For example, a champion may have "Feared by the Gods: -40% physical damage from all Gods".

 

Edit: Two things are not in yet. Spells do not cause +Magical nature. And the terrain modifiers are turned off for now, there were some issues with tactical combat.

Edit2: _IsUsingStaff didn't make it in.

Edit3: Uploaded new version, IsUsingStaff is in, and so is waringchainmail wearingplate and wearingleather.

Reason for Karma (Optional)
Successfully updated karma reason!
February 25, 2012 1:51:42 PM from Elemental Forums Elemental Forums

HF, Your CoreSpells shows two SummonEarthElementals. They appear to be identical. Core Units has the Likihood mis-spell in it.

Rest of the Mod is awesome. Thanks for all of the hard work!

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