Restricting Weapons From My Custom Race

I'm brainstorming for ideas here.  I'm hoping to avoid custom a tech tree because that would likely cause me to have to have an entire inventory of replacement items.

What I want is to restrict my custom race from using any weapons except spears and bows and from using any armor but leather or custom chitin armor.  Like I said, I'm looking for another option besides a custom tech tree.  Anyone have any ideas?

8,873 views 6 replies
Reply #1 Top

Probably the easiest way would be to add a custom trait for your faction, then go through all the items that you want to restrict and add a prereq tag with the RestrictedAbilityBonusOption type and your trait as the attribute (see archery tech and how it is excluded from no range weapon for an example).  Then add your chitin armor requiring that same trait. Takes a bit of work, but no modding of the tech tree needed.

Reply #2 Top

That's how I do it. For example my frost giants are restricted from some fire attack items. In this case, my frost giants have a faction ability named FrostGiant_Frostfire:

  <GameItemType InternalName="RingOfEmbers">
    <Prereq>
      <Type>RestrictedAbilityBonusOption</Type>
      <Attribute>FrostGiant_Frostfire</Attribute>
      <Target>Player</Target>
    </Prereq>
    <DisplayName>Ring of Embers</DisplayName>
    <Description>This ring protects the wearer from fire.</Description>
    <Type>Accessory</Type>
    <CanBeEquipped>1</CanBeEquipped>
    <AdditionalTrainingTurns>5</AdditionalTrainingTurns>
    <ShopValue>150</ShopValue>
    <ProductionRequirement>
      <Type>Resource</Type>
      <Attribute>RefinedCrystal</Attribute>
      <Value>1</Value>
    </ProductionRequirement>
    <GameModifier>
      <ModType>Unit</ModType>
      <Attribute>AdjustUnitStat</Attribute>
      <StrVal>UnitStat_Attack_Fire</StrVal>
      <Value>1</Value>
    </GameModifier>
    <GameModifier>
      <ModType>Unit</ModType>
      <Attribute>AdjustUnitStat</Attribute>
      <StrVal>UnitStat_ResistFire</StrVal>
      <Value>25</Value>
      <Provides>+25% Fire Resistance</Provides>
    </GameModifier>
    <IsAvailableForSovereignCustomization>0</IsAvailableForSovereignCustomization>
    <Likelihood>250</Likelihood>
    <RarityDisplay>Uncommon</RarityDisplay>
    <IsUsable>0</IsUsable>
    <Prereq>
      <Type>Tech</Type>
      <Attribute>Channeling</Attribute>
    </Prereq>
    <ArtDef>RingOfEmbers_ArtDef</ArtDef>
  </GameItemType>
End of quote

Reply #3 Top

I had thought about a custom trait.  Indeed, I have a number of custom items that have a trait associated with them to prevent other races from being able to use them.  But having to add a trait to all weapons and armor in the game is only slightly less onerous than creating a custom tech tree.

OTOH: Heaven, I was impressed with what you were able to do in Stormworld with just traits and no custom tech trees. 

The other side of this is, I don't want my faction able to produce those items either as I don't want to be able to create trained units with those items nor do I want them showing up in my shops.  I suppose custom traits will prevent that as well.

Reply #4 Top


I have been testing this with a sovereign of an ability bonus option that matches the one listed in the prereq.

    <Prereq>      

<Type>RestrictedAbilityBonusOption</Type>      

<Attribute>FrostGiant_Frostfire</Attribute>      

<Target>Player</Target>    

</Prereq>

 in fact I even cut and paste your code for the ring right into an xml matched the ability option I am trying to block, verified in game that the sovereign has the ability yet through every permutation I have tried he can equip the ring. Any advice?

WTB console output.

Reply #5 Top

Items can only be limited by unit level for heroes if they are in his backpack.

Edit: We have a request in here: ยดhttps://forums.elementalgame.com/433089/get;3242322 to expand this, go bump it if you support it.

Reply #6 Top

Please bump that thread, its annoying that we are currently restricted, it prevents a lot of different options from being added to the game.