Heavenfall Heavenfall

[eINFO] Some thoughts on what's new and possible with mods (in early beta 0.75)

[eINFO] Some thoughts on what's new and possible with mods (in early beta 0.75)

I've been looking into the xml a lot, and I've noted some key areas that I believe are possible to mod for a positive or expanded view of the game. Note, these are the things that are new to FE. There are many things that were possible in E:wom that still are in FE, but I won't mention them.

- The champion upgrade system is extremely sound, and practically limitless as long as we can keep things unique and interesting. The good thing about traits is that they can have prerequisites of any combination of unitstats, techs, and unitlevel. Of course, once you unleash the unitstats, you can practically do anything you want. For example, a magic sword can give you a hidden unitstat that allows you to later gain the trait bladesinger. A faction tech can allow you to gain new traits as well, or character backgrounds, or quests, or some debuff you happened to get in a fight, or injuries. Also, it's a little work but it's possible, each trait has a likelihood tag which is static, but because traits can be mutually exclusive we can dynamically increase the odds of a certain trait appearing by adding it twice or more (only risk is it appearing more than once).

- Speaking of injuries, unfortunately, they appear to be not at all so well implemented as traits (in terms of modding). They simply do not recognize either the prerequisite tag, or the likelihood tag. So, all we can really do to the injury system is add new ones and tweak their power.There is a potion that removes all injuries from a champion, so I guess it is only a matter of time before someone moves that function over to a spell.

- There is a fundamental game system open to modding when it comes to melee attacks. But we do not have access to the actual formula of attack vs defense. It's a lot to go into, but we can add new damagetypes such as blunt damage and so on and assign them to a certain defense, and create a %-resistance-unitstat as well. In addition, through hidden unitstats, we can create groups of units not directly obvious to the game - such as "Mounted - This unit counts as Mounted". We can then refer to this unitstat in bonuses. For example, it is a very small thing to make a special spear that deals 20% more damage against mounted units. Conversely, we can give mounted units a trait that allows them to deal special damage or defend themselves better against unmounted units. Mounted units is just an example, of course. We can also create other such groups, for example a set of weaponry that ignore shields on enemies, or specifically causes damage to magic armor but is weak against non-magical armor. Such things would take modding the items and/or units currently in-game. Really, anything that activates a unitstat can be used here - for example a trait that gives you +3 attack vs any enemy occupying a desert tile in strategic mode, or +3 if you are occupying a mountain tile. Also, the huge caveat here is the AI not knowing exactly how to use such mechanics.

- Speaking of the AI, it seems very keen on using custom unitdesigns and monsters and such. This is a vast improvement from E:wom. For unit designs, the AI seems capable of using the auto-upgrade system. Also, there are priority tags for magic items so the AI doesn't have to try to think how powerful a magic item is, we can just tell it.

- The spell system has many new neat features that are logical but were missing in E:wom. Most importantly, you may specify what casting the spell does to the caster, and the target, separately. In addition, we can specify what happens when a spell gets resisted. There's a lot of other neat possibilities as well, such as a "comet" spell that deals massive damage to one tile, and a lot less damage to those around. Also, we can specify if a spell stacks or not with itself.

- Speaking of spells, there's also a random spell in the game called Chaos, with a very interesting xml tag. I've only looked at it briefly, but it appears that we should be able to get item/unit procs working. Ie, when wearing this shield, anyone who attacks the wearer has a 20% of losing 5 dodge from a chill. There is a meleeappliesspell trigger, and a meleedefenseappliesspell trigger (which can also be used for non-procs obviously). There are some big limitations - you can only do one gamemodifier for the proc, it doesn't respect cooldown, it can't cost mana, and so on. Either way, in terms of increasing the variety of items this is great news. Also, I noticed there was a modifier for BattleAutoCastSpell, but I haven't tried it out. By the way, the random spell xml tag doesn't work in strategic mode currently, only in tactical mode.

- Wildlands seem possible to add. Also new sorts of terrains but only in coremods = bad idea in beta. Specifically, I'll be working on adding magma rivers, rivers of blood, poisoned river. I hate that every river is blue and cuddly.

- Cities also have a few new features in FE. Factions gain militia (which can be customized for factions btw), and buildings that summon defenders. Cities can also cast a defensive spell at the start of a tactical battle. Of course, there's the city level-up system for unique buildings (I haven't tested those out for prerequisites, but they are abilities like traits technically). Also, buildings that unlock local items. We should be able to add whole new types of functions like materials and grain, but I haven't tested that at all. Also, buildings can relate to their materials and grain in various ways. And then there's the obvious additions of buildings being able to add traits to trained units, or stats to defending units.

- One huge change from E:wom is the background handling of tile graphics and item art, but I haven't really been able to test those out yet since the workshop is locked. It looks like it will be very useful for adding new complete "factions" like another type of Kingdom. Also, I may be wrong, but it appears a specific tile can have different looks depending on the underlying terrain. Of course, cities are always cities but for world resources or even goodiehuts it may be interesting.

 


One thing I've noticed in regards to the spells is that every spell does something different. That's really impressive, in my opinion. There are not two spells in the game that deal damage in the same way, or give buffs/debuffs that are the same.

40,436 views 58 replies
Reply #26 Top

Quoting Heavenfall, reply 25
Edit: RavenX, be sure to tell me in PM when you want the guide to making a 3d model transparent. It's a bit of work and I'd rather delay until you actually plan to use it. 

You don't have to do a whole guide my friend. Incoming PM.

Reply #27 Top

Wow, thanks for the research you put into this. Reading this thread has me really excited to mod FE. 

A quick question...Has anyone tried modding the size of the models to create new creatures? The tags were there in WOM, but they didn't do anything IIRC. I will see if the tags are still there and try it if they are this evening if no one has looked/tried it yet.

Reply #28 Top

Those tags are still there, and they've been improved. A problem with increasing scale in E:wom was that certain models that were "skinned" to skeletons got distorted. This has been fixed. In addition, we have been given two different sets of scales - one for strategic map and one for tactical map. Furthermore, there is also a tactical-map only unitstat that also modifies size, so we can use that to affect unitsize dynamically in tactical combat (ex - a pet that starts out tiny but grows every level until its humongous).

 

Reply #29 Top

So dwarves and hobbitses are possible. Made my day.

Reply #30 Top

Quoting jshores, reply 29
So dwarves and hobbitses are possible. Made my day.

 

Confirmed, here is a tricksy hobbit that took about 30 seconds of xml modding to make:

 

Reply #31 Top

Is that an adamantium bullet in his sling?     :O

Reply #32 Top

Excellent read. Good to see you're getting off to an early and productive start, Heavenfall :D

Reply #33 Top

Heavenfall, do you know if there is a possibility to implement a "zone of control" buff effect? That is, an aura-like effect that affect units in the "zone of control"?

 

Also, do you know if it's possible to trigger some effect on a dodge, a miss? Or to check for a minimum value of ability/damage/etc?

Finally, is it possible to create a new damage type?

Reply #34 Top

Quoting Werewindlefr, reply 33
Heavenfall, do you know if there is a possibility to implement a "zone of control" buff effect? That is, an aura-like effect that affect units in the "zone of control"?

 

Also, do you know if it's possible to trigger some effect on a dodge, a miss? Or to check for a minimum value of ability/damage/etc?

Finally, is it possible to create a new damage type?

1) I know of no such spells, which probably means its not possible.

2) Counter-attacks trigger even if the attack is dodged or missed, that's all I can think of. Spells can also trigger specific things if resisted. I don't understand the second part of your question - you want to calculate something based on lowest value? Depends how good you are with +-*/ math. I remember I did this in E:wom:

       <GameModifier InternalName="TileDamageModifier_Instant">
            <ModType>Unit</ModType>
            <Attribute>CurHealth</Attribute>
            <Calculate InternalName="ExtraDamageFromShards" ValueOwner="CastingUnit">
                <Expression><![CDATA[[UnitStat_NumFireShards] * -1]]></Expression>
            </Calculate>
            <Calculate InternalName="ExtraDamageFromMagicPwr" ValueOwner="CastingUnit">
                <Expression><![CDATA[[UnitStat_Magicpwr] / 100]]></Expression>
            </Calculate>
            <Calculate InternalName="MinValue2">
                <Expression><![CDATA[[ExtraDamageFromShards] + -4]]></Expression>
            </Calculate>
            <Calculate InternalName="Value2">
                <Expression><![CDATA[[ExtraDamageFromMagicPwr] * [MinValue2]]]></Expression>
            </Calculate>
            <!--trick-->
            <Calculate InternalName="FetchTroopcount" ValueOwner="TargetUnit">
                <Expression><![CDATA[[Troopcount]+5]]></Expression>
            </Calculate>
            <Calculate InternalName="FetchTroopcount2">
                <Expression><![CDATA[[FetchTroopcount]-4]]></Expression>
            </Calculate>
            <Calculate InternalName="FetchTroopcount3">
                <Expression><![CDATA[[FetchTroopcount2]/5]]></Expression>
            </Calculate>
            <!-- end trick-->
            <Calculate InternalName="Value">
                <Expression><![CDATA[[Value2] * [FetchTroopcount3]]]></Expression>
            </Calculate>
        </GameModifier>

with the description "Target suffers damage modified by troopcount. Base damage is 16^ (+4^/fire shard). Each troopcount above/below 4 adds/removes 20% damage (3 men= -20%, 6 men= +40%)." but nobody appreciated the difficulty of making it happen. X(

3) Yes, you can add new damage types. I've made one damage type called Chaos that uses magic resistance as defense, and I made another one that bypasses all defenses. But, these things will still use accuracy/dodge and spell mastery / spell resist based on what type of attack it is.

Reply #35 Top

I don't understand the second part of your question - you want to calculate something based on lowest value?
.

 

I want to check for a requirement - like, killing a unit if it has less than 30HP, knocking it prone if it has less than 15 strength, etc.

 

with the description "Target suffers damage modified by troopcount. Base damage is 16^ (+4^/fire shard). Each troopcount above/below 4 adds/removes 20% damage (3 men= -20%, 6 men= +40%)." but nobody appreciated the difficulty of making it happen. X(
.

 

That's actually quite awesome.

 

Counter-attacks trigger even if the attack is dodged or missed, that's all I can think of. Spells can also trigger specific things if resisted.

So it might not be possible to create an ability that will proc only when the unit has dodged? A bit like backswing - except the defending unit uses it?

Reply #36 Top

No, sorry, defensive procs only happen when you get hit.

We can never check for requirements per se, there are no if/else/then things. But you might be able to juggle the numbers back and forward to reach a point where <30 means 0 and >30 means 1. I don't know about that, again, depends how good you are with the numbers.

Reply #37 Top

I did some random tweaking of the injury system in regards to this post: https://forums.elementalgame.com/416217

and I figured out a way for a champion to hold a trait that enables him to regenerate wounds. The idea is basically that when you level-up, you get a chance to "upgrade" your wound, ie heal it. The healing trait also has a modifier which makes it only available to those with a certain hidden unit_stat. That hidden unit_stat could for example be placed inside spells like Regeneration, or be given freely to certain heroes like Living Stone. Note the requirement to use the level-up system, which also means there's a trade off - you either get rid of the wound, or get another trait with stats. The concept is that something makes the hero capable of overcoming the most damaging wound - given enough time and effort.

Would also be fitting for a certain item, that would allow the champion the same thing. Reminds me about this piece from a famous poem:

Though they go mad they shall be sane,
Though they sink through the sea they shall rise again;
Though lovers be lost love shall not;
And death shall have no dominion.

I could also imagine a very powerful item that bestows the same stat to an entire army. Or a global spell that bestows it to all champions. Or simply a summon that through its very presence allows nearby champions to regenerate wounds. Those ideas are from dom3, by the way. I stoled.

Reply #38 Top

I've been experimenting with these triggers during the day and I've found some limitations

MeleeAppliesSpell - this trigger always casts the spell on whoever is hit. It is not possible to make this spell affect the attacker, it will only affect the defender. It is not technically "cast" by whoever had the modifier, so we cannot reference specific unitstats from the attacker. See: weapons with poison.

MeleeDefenseAppliesSpell - this trigger can take place both on the defender and the attacker. It reads stats from attacker and defender correctly, although they are "inverse", ie the caster is actually the defender and the target is the attacker. See: Shield of the sentinel. Mantle of Fire.

BattleAutoCastSpell - this trigger is currently bugged when called from items. It functions properly when called from traits. When called from items, the trigger will regularly go off multiple times in combat.

Reply #39 Top

Quoting RavenX, reply 3

Quoting Satrhan, reply 2 Do you know if it's possible to change the behaviour of monster lairs? So they could grow over time for instance, or send out raiding parties?

I believe they already do send out raiding parties. I've seen a Troll Lair spit out 3 seperate Troll Armies from the same lair over the coarse of a game.

 

I believe the amount they grow is dictated by this in ElementalDefs:

<!--  Spawn rate goes up every X turns (modifed by difficulty)   -->
  <MonsterPerTile>30</MonsterPerTile>

And I am sure this has something to do with it also:
 
<!--  ** for World SpawnRating incrementer formula. ie. m_fSpawnRatingTypeCounter_NPC += (Dividee / (numPlayers / DivisorDivisor )); **   -->
  <WorldSpawnRatingIncrementFormula_Dividee>1.0</WorldSpawnRatingIncrementFormula_Dividee>
  <WorldSpawnRatingIncrementFormula_DivisorDivisor>4.0</WorldSpawnRatingIncrementFormula_DivisorDivisor>
  <MonsterSpawnRateIncrease>50</MonsterSpawnRateIncrease>

I could always be wrong...
Reply #40 Top

Quoting Heavenfall, reply 38
I've been experimenting with these triggers during the day and I've found some limitations

MeleeAppliesSpell - this trigger always casts the spell on whoever is hit. It is not possible to make this spell affect the attacker, it will only affect the defender. It is not technically "cast" by whoever had the modifier, so we cannot reference specific unitstats from the attacker. See: weapons with poison.

MeleeDefenseAppliesSpell - this trigger can take place both on the defender and the attacker. It reads stats from attacker and defender correctly, although they are "inverse", ie the caster is actually the defender and the target is the attacker. See: Shield of the sentinel. Mantle of Fire.

BattleAutoCastSpell - this trigger is currently bugged when called from items. It functions properly when called from traits. When called from items, the trigger will regularly go off multiple times in combat.

Quoting myself above with some updated info.

 

MeleeAppliesSpell - this trigger always casts the spell on whoever is hit. It is not possible to make this spell affect the attacker, it will only affect the defender. It is not technically "cast" by whoever had the modifier, so we cannot reference specific unitstats from the attacker. See: weapons with poison. Spells cast like this do not respect requirements for mana to be cast.

 

MeleeDefenseAppliesSpell - this trigger can take place both on the defender and the attacker. It reads stats from attacker and defender correctly, although they are "inverse", ie the caster is actually the defender and the target is the attacker. See: Shield of the sentinel. Mantle of Fire. Spells cast like this do not respect requirements for mana to be cast.

 

BattleAutoCastSpell - this trigger is currently bugged when called from items. It functions properly when called from traits. When called from items, the trigger will regularly go off multiple times in combat. Spells cast like this require that the caster has the resources to cast it. If a spell requires 20 mana and you have 10, the spell will not be cast. Unknown if tactical mana reduction traits affect this value.

 

Reply #41 Top

Ran into a rather strange bug today, so just a heads up for folks.

 

       <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
        <StrVal>UnitStat_ResistBlunt</StrVal>
        <StrVal2>UnitStat_IsOrc</StrVal2>
            <Value>-1000</Value>
            <Duration>-1</Duration>
        <Effect>Y_Defend_Particle</Effect>
       <vsLower>1</vsLower>
        </GameModifier>

This modifier was in a spell, and applied to an enemy unit. The point was that if the unit later on would be attacked by an enemy unit that had a lower UnitStat_IsOrc, that unit would be able to deal +2000% blunt damage to the unit the spell was cast on.

The strangest thing happened, however... Even though the spell was applied correctly, and the effect played for a while, as soon as I hovered my mouse over the unit the debuff disappeared. I could hover over the unit in the unit list on the left and see the debuff, but if I hovered over it normally, the effect would immediately stop playing and the debuff would not be there. The offender is the <vsLower>1</vsLower>. If I removed that tag, the spell would work (although without the tag functionality). If I added it back in, the same problems appeared again.

Hopefully SD can get this fixed down the line sometime.

Reply #42 Top

I am glad you are testing these things. I am a little scared to really get into anything more than quest xml functionality because the game seems to be in such an infancy. One thing I find worrisome is how many quests have rewards that don't have a money value or are missing tags. I am starting to think these quest were done a while ago and no one has looked at them since. 

On an XML note, what does Strval stand for?

Reply #43 Top

stringvalue

Reply #44 Top

As some of you may be aware, I've been building custom units for a faction I'm working on. I'm glad to announce that the AI seem to have no problems building such units, as long as you remember to include a <Class> tag in the unittype.This is a completely new step from E:wom, where the AI would simply design terrible units on its own and build only those.

For example I had a particular custom unit that would unlock at a certain tech, and cost a special resource, and didn't hold any apparent military value in itself (low hp, att, def). I couldn't get the AI to build it. But after I used <Class>Defender</Class>, one of the class tags for the pre-designed unit designs for the vanilla faction, then the AI started using the design.

There are also other classes, like <Class>Archer</Class> and <Class>Horseman</Class>. So my guess is this class-tag is actually telling the AI what kind of unit it is. It is logical to assume that the AI also has some sort of mechanic that gets decided per game, so they can for example train extra amounts of archers, or mounted units, if the AI preferences say so (see AIMilitaryStrategyTypes.xml).

Full list of the classes currently in-game as of 0.77 beta

<Class>Archer</Class> (archers)

<Class>Defender</Class> (early defending unit, has a shield. Probably upgrades all the way to the endgame)

<Class>Peasant</Class> (starting unit, does not auto-upgrade into armor or weapons)

<Class>Horseman</Class> (its mounted. duh)

<Class>Light</Class> ("warriors", quick to train, good in early game, only has a 1handed weapon and apparently no shield? no weapon upgrade)

<Class>Medium</Class> (medium melee, two-handed weapon that doesn't upgrade. Note - all medium class are specially designed, like "Battleborn" for trogs)

<Class>Baron</Class> (heavy melee, twohanded sword that doesn't upgrade, but it starts with Greatsword which is one of the strongest weapons)

<Class>Pioneer</Class> (pioneer.)

<Class>Scout</Class> (scout. quick mover, bad att/def)

<Class>Spearman</Class> (description says well-suited to fight armored enemies)

Now, I have no idea how these are used by the AI - ie, does it build spearmen if the enemy builds defenders? I doubt that. More likely, these are groups for randomness. I think the AI just chooses a class at random, then selects a unittype that has the class and it can build. It is also likely to assume that it abandons some classes later in the game, such as peasant class and light class. But that's an assumption.

Reply #45 Top

It might be a matter of distribution. I wonder if FB is trying to get mixed units tactics by giving the AI a need to have several classes in one army. I noticed in the AI xml that there is also logic for units to move to a specific square to get a bonus. I thought that these tags were simply to allow each unit to know which bonuses to want. 

If so, we could make a <Class>Archer</Class> and define this unit to go after accuracy tile bonuses on the tactical map.

It would be even better if this tag worked for the strategic level. Then we could have a <Class>Swamp</Class> and make them want to hang out on swamp tiles. 

Reply #46 Top

That'd be neat, but let's not give Frogboy any ideas about unnecessarily complicated strategic movements. The game is already failing to make even basic ones, such as producing their own mega-armies.

Reply #47 Top

Then I certainly won't mention the part about telling the AI to attack when a unit is vulnerable due to the tile he is on.  :D

Reply #48 Top

Consider that any tile which does impact a unit, also impacts its combat rating. It is only our modded stuff that the AI is failing to consider. It has no problem taking into accounts the variable effect of a city wall.

Reply #49 Top

Thanks for that bit of info Heavenfall. It's a bit sad if the AI chooses at random, but having these classes by them selves could be usefull. I'm thinking about doing a mod that would rely on pre-designed units, so it's good to see the AI would at least build them.

Reply #50 Top

I haven't met an AI in any 4x tbs that doesn't select units with a large degree of randomness. MoM, dom3, homm, aow, you name it. There is no real good alternative, and the more special abilities there are the more difficult it is for the AI to assess. The only alternative I can think of is what they did in shogun2, where the AI simply instantly spawned pre-made armies inside the fog of war as you were exploring.