Unit Design - Unit Propery sheet - category logical operators

Post Reply
Stratego (dev)
Site Admin
Posts: 15748
Joined: Fri Apr 25, 2014 9:28 pm

Unit Design - Unit Propery sheet - category logical operators

Post by Stratego (dev) »

New codewords can be used to set AND and NOT operators within category definitions.

cases where you can use:
All place where you fill "unitTypes" definition you can set "categories" and in these you can use this feature.
eg in:
- trnBuilders
- trnModifiers
- trnBonusList
and so on.


"AND(" and ")" : AND codeword makes all categories listed later until ")" codeword treated as inside logical AND brackets, so unit has to have all categories (or not have in case of negations) to be added to proper list.

"NOT" : makes all units in next category excluded from final list, but "NOT" inside AND brackets are treated separately, so categories: ["AND(", "FOOT", "NOT", "MELEE", ")", "MELEE_FOOT"] should have all foot units, but "categories":["FOOT", "NOT", "MELEE", "MELEE_FOOT"] would have no melee foot units.

Example excluding multiple categories from a bigger category
If you want all air units that are not jet planes, not seaplanes than use this form:
{"categories":["AND(", "U_AIR_UNITS", "NOT", "U_JET", "NOT", "U_PLANES_SEAPLANE", "NOT", "U_PLANES_NO_AIRCARRIER", ")"]},

ATTENTION! a category will be evaluated properly ONLY if it has at least one unit assigned to it!

Example:
Affecting living knights, all melee foot and archers, but none of all this can be mechanical:
In json [and(, mounted, melee, not, undead, ), and(, melee, foot, ), archers, not, mechanical]

So normal NOT is global for bonus, but in AND brackets it only excludes within it.
User avatar
makazuwr32
Posts: 7830
Joined: Tue Oct 17, 2017 9:29 am
Location: Moscow, Russia

Re: Unit Design - Unit Propery sheet - category logical operators

Post by makazuwr32 »

Great!

@Alexander82
makazuwr32 wrote: Mon Sep 16, 2019 7:54 amWhen you ask to change something argument why...
Put some numbers, compare to what other races have and so on...
© by Makazuwr32™.
AoF Dev Co-Leader
Image
Stratego (dev)
Site Admin
Posts: 15748
Joined: Fri Apr 25, 2014 9:28 pm

Re: Unit Design - Unit Propery sheet - category logical operators

Post by Stratego (dev) »

ATTENTION! a category will be evaluated properly ONLY if it has at least one unit assigned to it!
User avatar
L4cus
Posts: 2358
Joined: Fri Jan 31, 2020 7:51 pm
Location: Perú

Re: Unit Design - Unit Propery sheet - category logical operators

Post by L4cus »

does "trnModifiers" still work?
Extra ecclesiam nulla salus...
AOD, a new variant...
viewforum.php?f=230
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Unit Design - Unit Propery sheet - category logical operators

Post by Midonik »

No - you must now use trnValidTargets on techs instead.
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
User avatar
L4cus
Posts: 2358
Joined: Fri Jan 31, 2020 7:51 pm
Location: Perú

Re: Unit Design - Unit Propery sheet - category logical operators

Post by L4cus »

good
Extra ecclesiam nulla salus...
AOD, a new variant...
viewforum.php?f=230
Stratego (dev)
Site Admin
Posts: 15748
Joined: Fri Apr 25, 2014 9:28 pm

Re: Unit Design - Unit Propery sheet - category logical operators

Post by Stratego (dev) »

new example:
Example excluding multiple categories from a bigger category
If you want all air units that are not jet planes, not seaplanes than use this form:
{"categories":["AND(", "U_AIR_UNITS", "NOT", "U_JET", "NOT", "U_PLANES_SEAPLANE", "NOT", "U_PLANES_NO_AIRCARRIER", ")"]},
Stratego (dev)
Site Admin
Posts: 15748
Joined: Fri Apr 25, 2014 9:28 pm

Re: Unit Design - Unit Propery sheet - category logical operators

Post by Stratego (dev) »

fixed example updated above.
Post Reply

Return to “Unit Design”