News

Custom Ability for Resistance acting weird, and more.

ResistanceBonus seems capped at 100%? and how to make each colony passively generate legion

Posted on Sunday, May 9, 2021

Hello, there. I happen to be new to modding xml, basically 0 xml knowledge aside from copying and tweaking existing ones

I ran into a bit of a dead end. I was trying to make a custom race ability with these features:

  1. Adds 1 defending legion to every planet successfully colonized/invaded (this one works)
  2. Adds 1 defending legion to home planet at the start of the game (this doesn't work)
  3. Boosts resistance by 500%, in other words, making their resistance 6x stronger (this doesn't work, image included)
  4. Boosts soldiering by 25% (this one works).
  5. Every colony passively generates 0.02 legion per turn (this doesn't work)

(I was thinking it would be more fun to make uber races with unique abilities instead of the regular ones but with gifted AI)

This is what's under the custom ability xml (in order):

 

Feature 1 works (Adds 1 defending legion to every planet successfully colonized/invaded)

<Triggers>

      <OnEvent>OnConquerPlanet</OnEvent>

      <Scope>Global</Scope>

      <Target> 

        <TargetType>Colony</TargetType>

      </Target>

      <Lifetime>Instant</Lifetime>

      <Modifier>

        <EffectType>Garrisons</EffectType>

        <Target>

          <TargetType>Colony</TargetType>

        </Target>

        <BonusType>Flat</BonusType>

        <Value>1</Value>

      </Modifier>

    </Triggers>

<Triggers>

      <OnEvent>OnColonizePlanet</OnEvent>

      <Scope>Global</Scope>

      <Target> 

        <TargetType>Colony</TargetType>

      </Target>

      <Lifetime>Instant</Lifetime>

      <Modifier>

        <EffectType>Garrisons</EffectType>

        <Target>

          <TargetType>Colony</TargetType>

        </Target>

        <BonusType>Flat</BonusType>

        <Value>1</Value>

      </Modifier>

    </Triggers>

 

Feature 2 doesn't work (Adds 1 defending legion to home planet at the start of the game)

<Triggers>

      <OnEvent>OnStartTurn</OnEvent>

      <CriteriaTurnNum>1</CriteriaTurnNum>

      <Scope>Global</Scope>

      <Target> 

       <TargetType>Colony</TargetType>

      </Target>

     <Lifetime>Instant</Lifetime>

       <Modifier>

        <EffectType>Garrisons</EffectType>

        <Target>

          <TargetType>Colony</TargetType>

        </Target>

        <BonusType>Flat</BonusType>

        <Value>1</Value>

      </Modifier>

    </Triggers>

 

Feature 3 acts weird (Boosts resistance by 500%, in other words, making their resistance 6x stronger):

  • It shows ingame that I do have +500% Resistance modifier from the ability, but the final sum only shows +100%, so then I tried to change it to +5000% to see if it does anything to increase the 100% value shown, turns out even at +5000%, the 100% stays 100%, seems like it is capped at that value, while I was wondering if there is a way to get 6x stronger resistance by just using this modifier. I could try by giving them 6 garrisoned legions instead of 1, but that would be a hard resistance to maintain by the AI because it would take 6 fresh legions to replenish the equivalent strength of the resistance instead of just 1 legion.
  • The resistance cap was further suggested by how easy 3-legions enemy transports took out the 1-legion defended planet (intended with 6x resistance).

<Mod>

      <EffectType>ResistanceBonus</EffectType>

      <Scope>Global</Scope>

      <Target>

        <TargetType>Colony</TargetType>

      </Target>

      <BonusType>Flat</BonusType>

      <Value>5.0</Value>

    </Mod>

 

 

Feature 4 works (Boosts soldiering by 25%)

<Mod>

      <EffectType>Soldiering</EffectType>

      <Target>

        <TargetType>Faction</TargetType>

      </Target>

      <BonusType>Flat</BonusType>

      <Value>0.25</Value>

 

    </Mod>

 

Feature 5 doesn't work (Every colony passively generates 0.02 legion per turn). In this case, I have yet to find an existing xml that does this for me to copy and tweak, so it made me think that it might need an actual work from scratch maybe? I have tried looking into Unrelenting ability xml (it gives +1 influence per colony per turn) to no results because apparently its xml is not as broken down as most of the other abilities. Nevertheless, I came up with something (that I was definitely sure wouldn't work, but purely just for the sake of doing something about it)

<Triggers>

      <OnEvent>OnStartTurn</OnEvent>

      <CriteriaTurnNum>1</CriteriaTurnNum>

      <Scope>Global</Scope>

      <Target> 

       <TargetType>Colony</TargetType>

      </Target>

     <Lifetime>Instant</Lifetime>

      <PerformAction>

        <Action>AwardSpecificResource</Action>

        <ValueParam>1</ValueParam>

        <StringParam>LegionsAvailable</StringParam>

      </PerformAction>

 

    </Triggers>

 

Is there a way to make each feature works well, in this case?

Thank you, in advance.