Unit Design - referencing other units as templates

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

Unit Design - referencing other units as templates

Post by Stratego (dev) »

I have implemented a few places where you can reference other units if they are similar than it will "inherit" other units settings.

eg.
All/some archers are basically having same movement, bonuses, build places (where they spawn) and so on -> so you can reference the basic archer from the other archer's jsons.

So currently here are the places where there are possiblility to reference other units or dedicated "template" units.
1. trnWalkTerrain
2. trnBonusList
3. all generic unitlist based things (trnRevokerTechs, trnEquivalents, trnRequires, trnBestAgainstMeWater, trnBestAgainstMeGround, trnBuilders, trnModifiers, trnCanNotCarryMe, trnCanCarryThese, trnCanNotCarryThese)

all above places you can use a unit referencing, referencing it as a "template",
here are the cases


trnWalkTerrain

Code: Select all

         "rangeWalk":3,
         "trnWalkTerrain":[
              {"copyFromUnitTerrain":"UNIT_ARCHER"}
            ],
meaning this unit will use the same terrain affinity setting as the UNIT_ARCHER unit.


Full extra:
you can mix the two: use a template and add few more lines (however it will only ADD them not replacing any in template)

Code: Select all


         "rangeWalk":3,
         "trnWalkTerrain":[
              {"copyFromUnit":"UNIT_ARCHER"},
              {"terrainType":"TERRAINS_SOMETERRAIN", "modifier":2}
            ],

trnBonusList

also works for bonuses (that is not a single unitlist but a weighted array of lists)
this case you can combine the template items with new additional items in current json like in example:

Code: Select all

         

         "trnBonusList":[
            {"copyFromUnitBonus":"UNIT_ARCHER"},
            {"modifier":0.8,"unitList":{"categories":["U_SIEGE_MACHINE"]}}
    ],

generic unitlist based things
trnRevokerTechs, trnEquivalents, trnRequires, trnBestAgainstMeWater, trnBestAgainstMeGround, trnBuilders, trnModifiers, trnCanNotCarryMe, trnCanCarryThese, trnCanNotCarryThese

in all above cases the referencing looks like this, and the list will be overwrittem by the list in the "template" unit:

Code: Select all

"trnBuilders":{"copyFromUnit":"UNIT_ARCHER"},

Warning!
Templating ONLY usable INSIDE unit jsons!
In These objects you must not use it (might be not complete list, the key is non-unit jsons)
- consts.json - terrainAffects - trnAffectedUnits
- effects jsons - trnSpecCostTypeList
- buildlist.json - buildpriors
- achievements.json - what and withs
...
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Unit Design - referencing other units as templates

Post by Stratego (dev) »

Warning!
Templating ONLY usable INSIDE unit jsons!
In These objects you must not use it (might be not complete list, the key is non-unit jsons)
- consts.json - terrainAffects - trnAffectedUnits
- effects jsons - trnSpecCostTypeList
- buildlist.json - buildpriors
- achievements.json - what and withs
...
Post Reply

Return to “Unit Design”