New 'mount' item, model disappears when I select item. Help!

Hey guys!

As you may remember, a few weeks back I posted some code for roadbuilding units.  This worked pretty well, but at the time I was trying to disallow mounts for roadbuilding units, as a mechanism for slowing them down.  My rationale for this was I wanted something that would allow players to tweak the existing road networks, without excessively nerfing the trait ability that allows champions and Capitar to do this (i.e. Champions with the Roadbuilding ability and Capitar can do it much faster than these units can).

So, I ended up deciding to make the roadbuilding equipment a 'mount', with a prerequisite perk/trait/ability 'Roadbuilding'.  I didn't want the crews to actually be shown as mounted, however, as the horses required are workhorses to haul/pull things around, and are not the riding variety, so I tried borrowing code from a ring-type item (i.e. art def code that doesn't actually change/modify the model as far as I can tell).

BTW, I'm still pondering the balance on this thing (resource requirements), but that's not relevant to the problem at hand.

Problem is that the model disappears when I select the roadbuilding equipment.  The 'man with shovel' icon shows up fine, but selecting it disappears the unit model in the unit building window.  I haven't been able to figure this one out... Help!

Relevant Code below:

Code: xml
  1. <GameItemTypes>
  2.     <GameItemType InternalName="RoadbuildingEquipment">
  3.         <DisplayName>Roadbuilding Equipment</DisplayName>
  4.         <Description>Provides the unit with the necessary horses and equipment needed for roadbuilding</Description>
  5.         <Type>Mount</Type>
  6.         <CanBeEquipped>1</CanBeEquipped>
  7.         <AdditionalTrainingTurns>20</AdditionalTrainingTurns>
  8.         <HideInHiergamenon>1</HideInHiergamenon>
  9.         <ShopValue>120</ShopValue>
  10.             <Cost>50</Cost><Type>Army</Type>
  11.             <GameModifier>
  12.                 <ModType>Unit</ModType>
  13.                 <Attribute>UnlockAction</Attribute>
  14.                 <StrVal>BuildRoad</StrVal>
  15.                 <Provides>Allows the unit to build roads</Provides>
  16.             </GameModifier>
  17.             <GameModifier>
  18.                 <ModType>Unit</ModType>
  19.                 <Attribute>AdjustUnitStat</Attribute>
  20.                 <StrVal>UnitStat_Moves</StrVal>
  21.                 <Value>-1</Value>
  22.                 <Provides>Reduces Movement to 1</Provides>
  23.             </GameModifier>
  24.         <ProductionRequirement>
  25.             <Type>Resource</Type>
  26.             <Attribute>Population</Attribute>
  27.             <Value>10</Value>
  28.         </ProductionRequirement>
  29.         <ProductionRequirement>
  30.             <Type>Resource</Type>
  31.             <Attribute>Horses</Attribute>
  32.             <Value>2</Value>
  33.         </ProductionRequirement>
  34.             <AdditionalTrainingTurns>48</AdditionalTrainingTurns>
  35.         <IsAvailableForSovereignCustomization>0</IsAvailableForSovereignCustomization>
  36.         <Prereq>
  37.             <Type>UnitStat</Type>
  38.             <Attribute>UnitStat_BuildRoads</Attribute>
  39.             <Value>1</Value>
  40.         </Prereq>
  41.         <ArtDef>BuildRoadsItem_ArtDef</ArtDef>
  42.         <GameItemTypeArtDef InternalName="BuildRoadsItem_ArtDef">
  43.             <GameItemTypeModelPack InternalName="BuildRoadsItem_Default">
  44.                 <IconFile>Digger.png</IconFile>
  45.                 <TintR>240</TintR>
  46.                 <TintG>10</TintG>
  47.                 <TintB>10</TintB>
  48.                 <SFX>Hit_Hammer1</SFX>
  49.                 <SFX>Hit_Hammer2</SFX>
  50.                 <SFX>Hit_Hammer3</SFX>
  51.                 <GameItemTypeModel>
  52.                 </GameItemTypeModel>
  53.             </GameItemTypeModelPack>
  54.         </GameItemTypeArtDef>
  55.             <AIData AIPersonality="AI_General">
  56.                 <AIPrefType>AIPrefType_MOUNT</AIPrefType>
  57.             </AIData>
  58.     </GameItemType>
  59. </GameItemTypes>

6,843 views 10 replies
Reply #1 Top

You need a proper gameitemtypeartdef like they have in coremounts.xml. Using the mount equipment type without including an actual mount is not an option.

Reply #2 Top

I haven't tried this at all, but if their code is sloppy in the .exe it might work. Try putting two types, so first <Type>Cloak</Type> then <Type>Mount</Type>. This may allow you to take up the mount slot without including an actual mount in the artdef.

Reply #3 Top

Quoting Heavenfall, reply 2

I haven't tried this at all, but if their code is sloppy in the .exe it might work. Try putting two types, so first <Type>Cloak</Type> then <Type>Mount</Type>. This may allow you to take up the mount slot without including an actual mount in the artdef.

I think that would force the item to take up two slots, both the mounted and the cloak. Similar to adding these types in my Armored Militia mod

One could include it as an accessory and you would not have that problem.

Also, you could see if you can make the pony gray to look more like a donkey and ride around with that, A donkey is a rideable workhorse.

Reply #4 Top

Quoting parrottmath, reply 3
I think that would force the item to take up two slots, both the mounted and the cloak. Similar to adding these types in my Armored Militia mod

Yeah, that's the point. Type Cloak was just an example.

Anyway what's the purpose of limiting them from equipping mounts? That doesn't make sense to me. The goal appears to be to have a way to dynamically add road-building to any unit designed. A pikeman, a crossbowman... a knight. It is as unlikely that a mounted unit carries various equipment as it is unlikely that an unmounted unit carries the same equipment.

Reply #5 Top

Something else you could try is to have a prereq unitstat X on both the item and mounts. Then, add -1 unitstat X to both mounts and the item. That way, you should be able to make them mutually exclusive. But I am not sure if the unit design window supports unitstat prereqs - I recall that they didn't in FE but they have improved some parts of the prereq/trait system since.

Reply #6 Top


I would conquer with Heavenfall... make it an accessory type (remove mounted). It seems more appropriate for that type. If you are worried about the unit movement from getting too much with mounted there are ways to force movement to be exactly 2.

Reply #7 Top

Hey guys!

The POINT is to limit the unit to one move per turn (roadbulding equipment is SLOOOOW, plus I'm trying not to show up Capitar and the Sov trait).  I did successfully assign a -1 move before with the roadbuilding trait, but if you added a mount afterwords in unit design, you ended up with a move of 2 or 3, hence allowing multiple sections of road to be built in a turn, which is what I DON'T want.  So by 'filling up' the mount slot with the roadbuilding equipment, this prevents someone from equipping a horse or warg and hence increasing the movement.

Keep in mind that in this case Road Building is an ability that fills up a perk slot during unit design, which is the idea I'm working with.  I've also done this with pioneers/city building (successfully), but that's not relevant to my issue.

I did try a multiplier of .25, to reduce movement below 1 (game would round up to 1 hopefully), but the game essentially ignored my math (still had move of 2, or 3/4 with warg/horse).  I copied some code convention from some 'bonus percentage' item, didn't work out.

I wasn't sure about how to go about filling multiple types before (I assumed you could do this, just never researched it).  I'll try your 'double slot' suggestion Heavenfall and let you know how it goes.

I had HOPED that calling mount wouldn't automatically make a model call, since as far as I can tell rings, etc. do not have models attached to them, but c'est la vie.  Also, I figured if some modder had done something similar (i.e. make a 'null' call for a model, so the original model is not modified), y'all would know about it.

Keep the suggestions coming!  I'd like to get this mini mod done and released soon!

Reply #8 Top

Try using SetUnitStat

       <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>SetUnitStat</Attribute>
            <StrVal>UnitStat_Moves</StrVal>
            <Value>1</Value>
        </GameModifier>

This should set the stat to be 1 no matter what adjustments are made.

But if that doesn't work then, I think they only hid the encumberance stuff so you could set it to

        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_CurrentWeight</StrVal>
            <Value>100</Value>
        </GameModifier>

This would force the character to also have a -8 initiative penalty in combat, but you can fix that by adding

       <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_CombatSpeed</StrVal>
            <Value>8</Value>
        </GameModifier>

Reply #9 Top

You could try to replace the model with the caravan unit, if all else fails. See if you could color it differently. That would probably look appropriate.

Reply #10 Top

OK, so I wasn't able to figure out how to get the figure from disappearing.

However, upon further review, I discovered the <Multiplier> tag... I haven't done a lot of modding (mostly tech trees and other stuff), so I missed this one.

It looks like assigning a <Multiplier> of .2 will 'cancel out' the movement bonus of+2 (.25 would do it too, but soaking up 5 MP requires the .2). At least in the build window, this is still showing a move of 1 (actually shows 0, but then says 1 move).  Haven't built a unit yet to make sure it can move...

So, you could still buy horses (on top of the horse requirement I have already).  Heading to work, so I haven't had a chance to test a <Multiplier> of .3 yet to see if this will allow a move of 2 with horses or Wargs.  Will experiment later.

Will keep everyone posted.  I'd still like to figure out how to 'fill/block' the mount slot without losing the 3D model, if you are trying to disallow a mount, but that's an issue for another day.