Some More Modding Questions

As seen below we have a ManaFromKills UnitStat. Is it possible to add a new UnitStat that gives another resource from kills instead of Mana? I don't understand how modding UnitStats works since they don't appear to contain active code of any type. If it is not possible can you get a resources from kills or victories another way?

    <UnitStatType InternalName="UnitStat_ManaFromKills">
        <DisplayName>Mana From Kills</DisplayName>
        <DisplayNameShort>MFK</DisplayNameShort>
        <Description>Amount of mana this unit melee recovers when killing an enemy unit.</Description>
        <Icon>Piercing_Stat_Icon.png</Icon>
        <Hidden>1</Hidden>
        <DefaultValue>0.0</DefaultValue>
        <UnitStatGrouping>CombatStat</UnitStatGrouping>
    </UnitStatType>

 

I also have tried modding the Heroic trait xml to give research instead of prestige, but it leads to the CorePlayerAbilities file which once again does not appear to have active code.

If anyone has any ideas on how to help I would be very appreciative.

23,972 views 32 replies
Reply #1 Top

Those three are hardcoded. So is the effect that gives you population per defeated humanoid enemy.

I don't understand how modding UnitStats works since they don't appear to contain active code of any type.

I use them as containers for unit values. You are right, a unitstat on its own (mostly) does nothing. But you can do stuff with it. For example, you can make traits only appear for champions with certain stats. Or spells. Or you can use the unitstats inside calculate tags in spells. Or comparison modifiers such as this

      <Description>As long as this unit is riding a Dire Bear mount, this unit will ignore 33% of Pierce damage from all sources unless enemy is also riding a Dire Bear mount.</Description>
      <GameModifier>
        <ModType>Unit</ModType>
        <Attribute>AdjustUnitStat</Attribute>
        <StrVal>UnitStat_ResistPierce</StrVal>
        <StrVal2>UnitStat_EquippedPrimalBear</StrVal2>
        <Value>33</Value>
        <Provides>Ignores 33% of Pierce damage while mounted on Dire Bear</Provides>
        <vsLower>1</vsLower>
      </GameModifier>

 

+1 Loading…
Reply #2 Top

If it is not possible can you get a resources from kills or victories another way?

It is generally not possible. There is a specific case, which is when a spell kills a target from its own effects. In that case, the spell can give stuff. So, it is not possible to have a vampire create blood resources every time it attacks kills someone. But it is possible to have a special "vampire bite" ability that creates resources like blood if it kills the target.

 

Reply #3 Top

Wow thanks for the quick reply Heavenfall.

Darn I was hoping there was at least a work around. Oh well back to the drawing board.

Reply #4 Top

What exactly do you want to do? Maybe there is a different way to do it.

Reply #5 Top

I was just brainstorming and experimenting with ideas for interesting faction traits. Trying to create some factions to fill out larger maps. Basically I was trying to find a way to create a trait that would reward a warlike player with resources.

I have also really been trying to come up with a way to implement an Archeology trait that somehow allows players to get research by rediscovering lost technologies. Right now it makes Monuments/ScenicViews produce research however that's not enough so I was hoping to make quests have research rewards, but that obviously didn't work. I would be happy to hear any ideas you may have.

Reply #6 Top

You could use mana from kills and then have a spell that produces research from mana. Then limit that faction's spells so that this is their primary way to do research or however you want to balance it. 

 

Also, quests can give research. Just copy over the game modifier from the research goodie hut into the rewards section of the quest. 

Reply #7 Top

Quoting seanw3, reply 7

Also, quests can give research. Just copy over the game modifier from the research goodie hut into the rewards section of the quest. 

This!!

Most of what I've learned to do I learned from studying the game's xml files.  If you want to learn to really use traits, study Heaven's mod.  Traits are a really great boon to modders and Heaven has done great stuff with them.  Sean has done some amazing work with quests so I would study his mods stuff.  Note that quest rewards can be multiple items or a random selection between several different items or both depending on the xml.

Another area ripe for modding is spells.  You can do a lot with spells and weapons can be made to trigger spells (proc) on a successful attack.  Ironically, ranged weapons essentially use a spell under the hood to do damage but for some reason they don't behave like normal weapons when it comes to proccing on hits.

 

 

Reply #8 Top

I was thinking about making some bows that do special stuff at some point. Tri-fire, freezing shot, fireball, reallly anything but poison can be put into a standard bow attack.

Reply #9 Top

Hmmm I have a new problem. I am trying to add a new buildible monster but no matter what I do it won't show up in game. I am basing it off the Bound Widows, and even if I just slightly change the display and internal name of the widow I don't see it show up...

Edit: Nvm, I figured it out. You have to remove the StartingUnit tag.

Reply #10 Top

lol another question. I'm trying to create a summoned monster that will respawn upon death like a champion. I have tried experimenting with Deathward and making the unit a champion but nothing seems to work. Also how do henchmen work. I don't see a tag for not respawning upon death and not getting normal traits.

Reply #11 Top

No idea.

Reply #12 Top

There seems to be limits on units created after the game starts. Even using UnitJoinArmy instead of summoning you don't get equipment and they can't respawn on death. So I guess you can't have champions as quest rewards either.

Reply #13 Top

I would bet that we will get the ability to add a champion from a quest. I will have to test this out at some point because I am almost sure I have done it at some point. Have you tried specifying a hero that already exists in the coreunits.xml? 

Reply #14 Top

Yeah I did, but I was doing it wrong and fixed it. Normal units and champions use slightly different xml when using UnitJoinArmy. Even as I wrote that last sentence I realized i must have been wrong and looked it up.

Although making my unit a champion isn't working out and I can't seem to apply Deathward to it off spawn or make it respawn any other way. Any idea on how to make a non-champion unit respawn?

Reply #15 Top

Maybe you are not defining your unit as a hero correctly?

 

Reply #16 Top

This is the modifier to summon create a champion

        <GameModifier InternalName="Reward2">
                <ModType>Unit</ModType>
                <Attribute>UnitJoinArmy</Attribute>

                <StrVal>Undead_Zalos</StrVal>
                <UnitClass>Champion</UnitClass>
    </GameModifier>

if you do that with StrVal being the internalname of a champion, you'll get a fully functional one (edit: it may not be able to marry if you run with dynasties on).

Champions that are monsters are a bad idea, since they'll gobble up equipment when used by the AI.

Reply #17 Top

Quoting seanw3, reply 9
I was thinking about making some bows that do special stuff at some point. Tri-fire, freezing shot, fireball, reallly anything but poison can be put into a standard bow attack.

Unless this has been fixed in one of the more recent releases, ranged attacks are so nerfed that it's pretty hard to get a bow to do anything interesting.   I have yet to figure out how to get one to proc on hit the way a sword will.  The best I was able to do was to do damage of a particular type (i.e. cold attack). I could not get the successful bow hit to trigger more than one spell nor could I figure out how to make the spell do more than one damage type or trigger a different spell.

Poison won't stack so if a weapon has a poison attack, and since poison is basically a spell and the game mechanics will not allow you to cast a spell on a target that already has that spell active, you can't attack that target again with that weapon until that spell is gone.  Heck, I'd be happy if the new poison attack overlaid the old and in essence extending the DOT by a round.  The best I was able to do was to, in addition to the poison damage, knock the target down and have them stay on the ground the duration of the poison - in effect making the poison incapacitate more than kill.  That at least frees you to attack another target or cast spells/buffs.  That is at least useful if the archer is also a mage or you have multiple enemies.   In fact, it is pretty handy if you have multiple enemies and an army of your own since a knocked down opponent loses a lot of their defensive ability making them an easy target for your troops.

However, if anyone has figured out how to make either of these work better, I'd love to see your XML.

Reply #18 Top

Quoting DsRaider, reply 11
lol another question. I'm trying to create a summoned monster that will respawn upon death like a champion. I have tried experimenting with Deathward and making the unit a champion but nothing seems to work. Also how do henchmen work. I don't see a tag for not respawning upon death and not getting normal traits.

You can't have a monster resummon on death but you can have a monster automatically summon at the start of every battle.  It's not quite the same thing though.  It would lose any equipment or buffs it had.  But it would heal all damage and debuffs.

Reply #19 Top

Bows can do alot, but you have to think of them as spells, not melee. I made that poison comment to suggest that a spell can't cause another spell. I am pretty sure you can make a bow do fire, frost, and lightning in the same shot. I can also add abilities to the unit that is using the bow. With that I can do alot more stuff. Three shots would be possible in a single turn for instance by triggering the unit gains instant action ability twice. The trick is to think about bows as anything but melee.

 

You can have the bow do maybe 3 different ability attacks that each cast a different spell on hit. Making a spell do fire and ice damage should be simple enough, so I think you may mean something else. If you want poison to stack, you need to make new poisons with different names. Poison A, B, C, D will all apply on hit if each one has a 25% chance to apply. After a few shots, all the poisons will be applied and the unit will be mostly dead. I think poison in general needs to do more damage and units should get a general resistance to it, with spells for healer champions to cure it.

Reply #20 Top

Quoting seanw3, reply 20
Bows can do alot, but you have to think of them as spells, not melee. I made that poison comment to suggest that a spell can't cause another spell. I am pretty sure you can make a bow do fire, frost, and lightning in the same shot. I can also add abilities to the unit that is using the bow. With that I can do alot more stuff. Three shots would be possible in a single turn for instance by triggering the unit gains instant action ability twice. The trick is to think about bows as anything but melee.

 

You can have the bow do maybe 3 different ability attacks that each cast a different spell on hit. Making a spell do fire and ice damage should be simple enough, so I think you may mean something else. If you want poison to stack, you need to make new poisons with different names. Poison A, B, C, D will all apply on hit if each one has a 25% chance to apply. After a few shots, all the poisons will be applied and the unit will be mostly dead. I think poison in general needs to do more damage and units should get a general resistance to it, with spells for healer champions to cure it.

 

Bows giving stats to wielder works just fine.  Where I ran into problems was trying to put multiple spell effects on a bow.  Admitted, I might have been doing somethign wrong.  but when I tried to put fire and cold damage on a bow (Actually I think it was normal pierce and fire on top of that) only one of the damage types seemed to apply.  I played around with a few different ways of doing it for most of a day and couldn't get it to work.  If you can get it to work (and I hope you can!), I'd love it if you showed me your XML.

I like the idea of having four different poison spells!  Have enough different spells to cover the duration.   If your poison duration is 5, then have 5 or 6 poison spells so that you don't run out of unique spells until after the first one drops. That way you can keep firing even at a big monster.

Reply #21 Top

Or we could have Path of the Assassin have Poison 1 added to any weapon. Then we can add 2,3,4,5,6,7,8,9,10 as he or she levels. Just thought about that. I am in Path mode right now.

 

Reply #22 Top

So basically, the higher the level of the assassin, the more he can stack poison?  I like it!!

Reply #23 Top

I am going to try to convince the devs that damage needs to come from unit skill, not weapons of doom. I am looking at you Void Sword!

Reply #24 Top

i just took a look at the XML for some of the bows I was experimenting with and it refreshed my memory somewhat.  Below is one I got to work though I don't recall for sure how well it worked.  It supposedly did pierce and cold attack but I'm thinking it didn't do but one of them.  (Sorry, the memory is kinda foggy as I never used this in an actual game) I think the issue has to do with the bow spell using that <Attribute>DefendableDamage</Attribute> tag.  The damage the bow attack does is passed to the spell (based on the attack rating of the bow) and that process seems to block the spell from doing any other damage.  Like I said, I was able to get other, non-damage spells to work.  In this case, the cold damage had a "chilling" effect on your agility and cast a "Slow" on the target.   Perhaps if you got rid of the damage being passed to the arrow spell, it might open up damage from within the spell.  Maybe getting rid of the <IsRangedAttack> will help.  I don't remember if I ever tried that or not.

    <GameItemType InternalName="AIM_CalaQuessirLongbowBoreal">
        <DisplayName>Cala'Quessir Boreal Longbow</DisplayName>
        <Description>Fire fast, the arrows start to freeze when the bow is drawn.  </Description>
        <Type>Weapon</Type>
        <Type>Defense</Type>
        <WeaponType>Bow</WeaponType>
        <CanBeEquipped>1</CanBeEquipped>
        <ShopValue>1720</ShopValue>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Accuracy</StrVal>
            <Value>4</Value>
        </GameModifier>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Attack_Pierce</StrVal>
            <Value>10</Value>
        </GameModifier>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Attack_Cold</StrVal>
            <Value>1</Value>
            <PerLevel>1</PerLevel>
            <Provides>+1 Cold Attack per Level</Provides>
        </GameModifier>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_CurrentWeight</StrVal>
            <Value>8</Value>
        </GameModifier>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>UnlockRangedAction</Attribute>
            <StrVal>AIM_BowAttack_Freezing</StrVal>
            <Provides>Ranged attack</Provides>
        </GameModifier>
        <IsAvailableForSovereignCustomization>0</IsAvailableForSovereignCustomization>
        <Likelihood>250</Likelihood>
        <RarityDisplay>UltraRare</RarityDisplay>
        <TacticalRange>8</TacticalRange>
        <HeroOnly>1</HeroOnly>
        <IsAvailableForUnitDesign>0</IsAvailableForUnitDesign>
        <Prereq>
            <Type>Race</Type>
            <Attribute>Race_Type_CalaQuessirs</Attribute>
        </Prereq>
        <Prereq>
            <Type>Tech</Type>
            <Attribute>AIM_CalaQuessir_Arcane_Bows</Attribute>
        </Prereq>
        <Prereq>
            <Type>UnitStat_Level</Type>
            <Attribute>9</Attribute>
        </Prereq>
        <AIData AIPersonality="AI_General">
            <AIPrefType>AIPrefType_BOW</AIPrefType>
            <AIPriority>40</AIPriority>
        </AIData>
        <ArtDef>AIM_Longbow_Freezing_ArtDef</ArtDef>
        <GameItemTypeArtDef InternalName="AIM_Longbow_Freezing_ArtDef">
            <GameItemTypeModelPack InternalName="AIM_Longbow_Freezing_Default">
                <IconFile>W_Longbow_Yew_Masterwork_Icon_01.png</IconFile>
                <TintR>0</TintR>
                <TintG>0</TintG>
                <TintB>0</TintB>
                <AttackSFX>Hit_Arrow1</AttackSFX>
                <AttackSFX>Hit_Arrow2</AttackSFX>
                <EquipSFX>Equip_BowandArrow_01</EquipSFX>
                <EquipSFX>Equip_BowandArrow_02</EquipSFX>
                <EquipSFX>Equip_BowandArrow_03</EquipSFX>
                <SoundPack>SoundPack_Bow</SoundPack>
                <GameItemTypeModel>
                    <ModelFile>Gfx\HKB\Weapons\W_Longbow_Yew_Perfect_01.hkb</ModelFile>
                    <Texture_All>Gfx\HKB\Armor\FE_Weapons_02.png</Texture_All>
                    <Attachment>hand_Left_Lcf</Attachment>
                    <Color_All>232,158,28</Color_All>
                </GameItemTypeModel>
                <GameItemTypeModel>
                    <ModelFile>Gfx\HKB\Armor\K_ArcherQuiver_01.hkb</ModelFile>
                    <Texture_All>Gfx\HKB\Armor\K_Female_Armor_Archer_Texture_01.dds</Texture_All>
                    <Attachment>back_Lcf</Attachment>
                </GameItemTypeModel>
            </GameItemTypeModelPack>
        </GameItemTypeArtDef>
    </GameItemType>

    <SpellDef InternalName="AIM_BowAttack_Freezing">
        <DisplayName>Bow Attack Ice</DisplayName>
        <Description>Attack a unit from a distance with a single arrow from your bow.</Description>
        <Image>Action_BowArrow.png</Image>
        <IconFG>Action_BowArrow.png</IconFG>
        <IconBG>Action_BowArrow.png</IconBG>
        <IconColor>255,255,255</IconColor>
        <SpellType>Tactical</SpellType>
        <SpellClass>Offensive</SpellClass>
        <SpellSubClass>Damage</SpellSubClass>
        <SpellTargetType>EnemyUnit</SpellTargetType>
        <HideInHiergamenon>1</HideInHiergamenon>
        <IsCastable>0</IsCastable>
        <IsRangedAttack>1</IsRangedAttack>
        <IsResistable>1</IsResistable>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>DefendableDamage</Attribute>
        </GameModifier>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_CombatSpeed</StrVal>
            <DisplayName>Slowed</DisplayName>
            <Duration>-1</Duration>
            <Effect>E_Slow_Particle</Effect>
            <Calculate InternalName="Calc" ValueOwner="CastingUnit">
                <Expression><![CDATA[[UnitOwner_GetNumWaterShards] * -2]]></Expression>
            </Calculate>
            <Calculate InternalName="Value">
                <Expression><![CDATA[[Calc] - 4]]></Expression>
            </Calculate>
        </GameModifier>
        <AIData AIPersonality="AI_General">
            <AIPriority>5</AIPriority>
        </AIData>
        <HitSoundFX>Hit_Arrow1</HitSoundFX>
        <HitSoundFX>Hit_Arrow2</HitSoundFX>
        <MissSoundFX>Miss_Swing2</MissSoundFX>
        <SpellCastEffectName>AIM_FrostLongbow_Particle</SpellCastEffectName>
        <SpellCastEffectScale>0.3</SpellCastEffectScale>
        <SpellCastProjectile>1</SpellCastProjectile>
        <SpellCastProjectileSpeed>700</SpellCastProjectileSpeed>
        <SpellDefEffect>
            <EffectName>AIM_FrostLongbowImpact_Particle.xml</EffectName>
            <LocalPosition>0,0,0</LocalPosition>
            <EffectScale>1</EffectScale>
            <EffectDelay>0</EffectDelay>
            <SnapToTerrain>1</SnapToTerrain>
        </SpellDefEffect>
    </SpellDef>

Reply #25 Top

The way I would do it is to have all the pierce be done from the weapon xml and all the magic be done from the spell xml. I will rework it a bit and see how well I can get it to work. The other advantage of having the frost damage in the spell def is that you can then place that spell on different bows to greatly increase variety.