[Info] Class limitations for units

I figured out how to limit items to only be used by a specific class i.e. mages and what not.  I got the idea from Parrotmath and his Henchwoman mod.  Basically, and this is a LOT of work to do, you have to make a new generic unit like the henman/henchwoman and limit equipment that it only works with those types of unitmodeltypes.  I was trying to make traits to only work like this and was wondering if this worked with gear and it appears to.  So basically to make this work you would have to make two sets of gear one usable by trainable units and another usable by champions which area able to do whatever.

 

Basically make a mage generic unit and then make only certain items be compatible with that unitmodeltype and certain abailities that are also only compatible with that unitmodeltype as well.  So the unit is still customizable but only for what it can use.

 

Thats it.

 

I will work on this after my armor mod is done.

5,573 views 3 replies
Reply #1 Top

This is how the Juggernaut and Iron Golem works in the un-modded game. They have a <UnitModelType> that is not found in armour pieces so it cannot wear those. However, a weapon usually has no restrictions for their modeltypes, so those become available by default. This was also the reason Bows and Ranged Staffs and Mounts were given a ModelType.

In CoreUnits.xml:

<UnitModelType>IronGolem</UnitModelType>

<UnitModelType>JuggernautMale</UnitModelType>

An example of an Armorpiece's Artdef (notice that neither IronGolem nor JuggernautMale is in the list of SupportedUnitModelType):

    <GameItemTypeArtDef InternalName="Art_TitansCrown">
        <GameItemTypeModelPack InternalName="Art_TitansCrown_1">
            <SupportedUnitModelType>AmarianFemale</SupportedUnitModelType>
            <SupportedUnitModelType>AmarianMale</SupportedUnitModelType>
            <SupportedUnitModelType>EmpireFemale</SupportedUnitModelType>
            <SupportedUnitModelType>EmpireMale</SupportedUnitModelType>
            <SupportedUnitModelType>FallenFemale</SupportedUnitModelType>
            <SupportedUnitModelType>FallenMale</SupportedUnitModelType>
            <SupportedUnitModelType>HenchmanMale</SupportedUnitModelType>
            <SupportedUnitModelType>IroneerFemale</SupportedUnitModelType>
            <SupportedUnitModelType>IroneerMale</SupportedUnitModelType>
            <SupportedUnitModelType>KingdomFemale</SupportedUnitModelType>
            <SupportedUnitModelType>KingdomMale</SupportedUnitModelType>
            <SupportedUnitModelType>MancerFemale</SupportedUnitModelType>
            <SupportedUnitModelType>MancerMale</SupportedUnitModelType>
            <SupportedUnitModelType>QuendarFemale</SupportedUnitModelType>
            <SupportedUnitModelType>QuendarMale</SupportedUnitModelType>
            <SupportedUnitModelType>SlaveMale</SupportedUnitModelType>
            <SupportedUnitModelType>TarthanFemale</SupportedUnitModelType>
            <SupportedUnitModelType>TarthanMale</SupportedUnitModelType>
            <SupportedUnitModelType>UrxenFemale</SupportedUnitModelType>
            <SupportedUnitModelType>UrxenMale</SupportedUnitModelType>
            <SupportedUnitModelType>WraithFemale</SupportedUnitModelType>
            <SupportedUnitModelType>WraithMale</SupportedUnitModelType>
            <IconFile>VergaHelmet.png</IconFile>
            <TintR>0</TintR>
            <TintG>0</TintG>
            <TintB>0</TintB>
            <GameItemTypeModel>
                <ModelFile>Gfx\HKB\Armor\verga_helmet.hkb</ModelFile>
                <Texture_All>Gfx\HKB\Armor\verga_armor_texture.png</Texture_All>
                <Attachment>head_lcf</Attachment>
                <Color_Metal>80,80,80</Color_Metal>
            </GameItemTypeModel>
        </GameItemTypeModelPack>
    </GameItemTypeArtDef>

an example of a weapon which has NO supportedunitmodeltypes and is therefore supported by ALL unitmodeltypes:

       <GameItemTypeArtDef InternalName="Axe_ArtDef">
            <GameItemTypeModelPack InternalName="Axe_Default">
                <IconFile>W_Axe_Icon_01.png</IconFile>
                <TintR>0</TintR>
                <TintG>0</TintG>
                <TintB>0</TintB>
                <AttackSFX>Hit_Hammer1</AttackSFX>
                <AttackSFX>Hit_Hammer2</AttackSFX>
                <AttackSFX>Hit_Hammer3</AttackSFX>
                <EquipSFX>Equip_WoodenItem_01</EquipSFX>
                <EquipSFX>Equip_WoodenItem_02</EquipSFX>
                <EquipSFX>Equip_WoodenItem_03</EquipSFX>
                <GameItemTypeModel>
                    <ModelFile>gfx/hkb/Weapons/W_Axe_01.hkb</ModelFile>
                    <Texture_All>gfx/hkb/Weapons/FE_Weapons_01.png</Texture_All>
                    <Attachment>hand_right_Lcf</Attachment>
                </GameItemTypeModel>
            </GameItemTypeModelPack>
        </GameItemTypeArtDef>

 

Despite the appeal of the system, I strongly advise against using it for limiting items for heroes. The reason is that an item that does not support the modeltype of a hero will have the following bugs:

1) It will show up in the Shop if it is an item that you research for. The item will be purchaseable (cost money) but will not show up in the hero's inventory and it will fail to be equipped. Essentially, you pay but get nothing.

2) If a hero finds a random item in the world as a drop (from a monster, quest, or goodiehut) and the item does not support the hero's modeltype, the item will be irrevocably lost. The same will occur if the item is traded to the hero, created by a spell, or in any way ends up in the hero's inventory.

 

Reply #2 Top

Interestingly enough about the item thing not showing up in the inventory, it is actually there, it just has no art value.  Basically if you click in the next spot you can highlight it as being there.  I found this out when I messed up on an art file for an armor piece and it looked like my unit was naked so I bought the piece and nothing was there.  So I tried clicking around and was able to select it.  Still the point is that it would not be right and I understand that.  

That is also why I said you would have to make two different equipment types, one for heroes and one for trained units as you told before how to limit items being available for trained units only by making the shop value 0 and setting hero only items to have the appropriate hero only tag.

So in effect this will work on limiting equipment for trained units it doe not limit hero equipment at all if built right.  If anything this may help the AI be able to make specific strategies based upon a unit model type.  For instance make a light skirmisher unitmodel, set the AI value for it to to be a rushing unit that charges ahead.  Make a heavy skirmisher that could be a defensive unit that defends archers/mages.  I don't even know if this is even possible.

I will mess with this more later though after I finish tinkering with armor and weapons.  I have all of the normal armors rebuilt but I need to finish balancing the values before I make the magic versions then I will tackle the weapons.

Reply #3 Top

 

Would this work?

 

For example:

Make an ability for each weapon type such as Sword_Proficiency.

Use that as a prerequisite for all swords.

 

If there has to be a separate ability for champs and reg. units then the two separate abilities  - Sword_Prof_Champ and Sword_Prof_Unit - can be nested within the Sword_Proficiency.