Is there a way to test for unit values in spell prereq?

I've been stuck for days on this. Beginning to think it will not work.

Trying to use this in a spell:

 

Code: xml
  1.         <Prereq>
  2.             <Type>Unit</Type>
  3.             <Attribute>UnitStat_Kos_Flag2</Attribute>
  4.             <Value>1</Value>
  5.         </Prereq>
  6. also tried:
  7.         <Prereq>
  8.             <Target>Unit</Target>
  9.             <Attribute>UnitStat_Kos_Flag2</Attribute>
  10.             <Value>1</Value>
  11.         </Prereq>

I really need a check in the prereq to test for value, but it could be anything > 0.

Any ideas?

14,063 views 12 replies
Reply #1 Top

Use this

   <Prereq>
      <Type>UnitStat</Type>
      <Attribute>UnitStat_Goes_here</Attribute>
      <Value>1</Value>
    </Prereq>

 also works in abilitybonusoptions (aka traits) for level-up

+1 Loading…
Reply #2 Top

Quoting Heavenfall, reply 1
Use this

   <Prereq>
      <Type>UnitStat</Type>
      <Attribute>UnitStat_Goes_here</Attribute>
      <Value>1</Value>
    </Prereq>

 also works in abilitybonusoptions (aka traits) for level-up

 

Awesome! How did you figure out to use UnitStat for type? I searched those files for hours.

 

At any rate, it works now and +1 Karma :)

Reply #3 Top

I believe it was used in an early beta build for something, can't remember what now.

Edit: It's actually still in use in CoreSpells.xml

 <Prereq>
            <Type>UnitStat</Type>
            <Attribute>UnitStat_HitPoints</Attribute>
            <Value>4</Value>
        </Prereq>

Reply #4 Top

Ok, so now I'm stuck on this...

On each Pathofthewhatever...

I am using this code:

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

 

I was hoping by specifying SetUnitStat it would assign it a value of 1, but it simply adds to the Flag1.

Any hope of fixing that? ;)

Reply #5 Top

Why not adjustunitstat?

Reply #6 Top

Quoting Heavenfall, reply 6
Why not adjustunitstat?

 

I need the value to be 0 or 1 only and since I allow multi-paths, if I use adjustunitstat it goes to 2 or more. I want to be able to test for a 1 there (path has been chosen), no matter how many paths or which path. I am thinking maybe that BoolVal1 thing could fit but haven't figured it out either.

 

I could do this if I could figure out how to test for value > 0 in prereq but I have had no luck with that.

Reply #7 Top

If you set a prereq unitstat it is always >=.

 

Reply #8 Top

Quoting Heavenfall, reply 8
If you set a prereq unitstat it is always >=.

 

 

Really? I figured if I tested for 1 then an actual value of 2 would fail...thanks alot and back to fixing this up now :)

 

edit:

If I use the same internal names from CoreAbilities in my mod file, and put two different prereqs in two different sections, will they be added to the originals, or are they viewed as replacing, or are all 3 separate? i.e....

 

Code: xml
  1.     &lt;AbilityBonus InternalName="Fire1Ability"&gt;
  2.         &lt;AbilityBonusType&gt;Unit_Level&lt;/AbilityBonusType&gt;
  3.         &lt;AbilityBonusOption InternalName="Fire1"&gt;
  4.             &lt;Likelihood&gt;400&lt;/Likelihood&gt;
  5.         &lt;Prereq&gt;
  6.                 &lt;Type&gt;AbilityBonusOption&lt;/Type&gt;
  7.                 &lt;Target&gt;Unit&lt;/Target&gt;
  8.                 &lt;Attribute&gt;PathOfTheMage&lt;/Attribute&gt;
  9.         &lt;/Prereq&gt;
  10.         &lt;/AbilityBonusOption&gt;
  11.     &lt;/AbilityBonus&gt;
  12.     &lt;AbilityBonus InternalName="Fire1Ability"&gt;
  13.         &lt;AbilityBonusType&gt;Unit_Level&lt;/AbilityBonusType&gt;
  14.         &lt;AbilityBonusOption InternalName="Fire1"&gt;
  15.             &lt;Likelihood&gt;50&lt;/Likelihood&gt;
  16.         &lt;Prereq&gt;
  17.             &lt;Type&gt;UnitStat&lt;/Type&gt;
  18.             &lt;Target&gt;Unit&lt;/Target&gt;
  19.             &lt;Attribute&gt;UnitStat_Kos_Flag1&lt;/Attribute&gt;
  20.             &lt;Value&gt;1&lt;/Value&gt;
  21.         &lt;/Prereq&gt;
  22.         &lt;/AbilityBonusOption&gt;
  23.     &lt;/AbilityBonus&gt;

 

Will that be tested as 3 different choices or be a no way to succeed? Or?

Reply #10 Top

So if I change the AbilityBonus internal name and retain the AbilityBonusOption names would I be able to use 3 separate ability sections with different prereq's and still assign the ABO correctly? I'm guessing by 'we can block the originals' = give them unattainable prereqs?

 

Sorry to ask so many questions but I just can't seem to understand all the intricacies of the data formats and syntax.

Reply #11 Top

That's an interesting idea, I don't know what happens if you change the abilitybonus internalname.

ABO? Don't know what that means.

You want to have three different ways of getting a trait? I don't think that's doable, although some have said that if you simply include multiple unitstat prereqs in the same abilitybonusoption it only needs one to appear. I don't know, never tried.

Yes, giving them unobtainable prereqs blocks them from appearing (but not being given out to champions in unittypes for example).

 Other than that, you are entering the area where I have no answers. You'll have to try it for yourself and see how it works.

Reply #12 Top

Thanks for all the help Heavenfall :)

ABO - was short for AbilityBonusOption