Game definition jsons - Transformation definitions

Learn the .json format
used to define characteristics of units and other game elements
Post Reply
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Game definition jsons - Transformation definitions

Post by Stratego (dev) »

in tarnsforms.json you can define how transformations should behave (eg. centaur ranged/melee form transition)

Options

also there are options how the transformed units should keep the enchants it had prior, or keep the hp - or starting as new unit and so on, here are the options:
// KEEP_HP = needHPTransfer (as a percentage of max hp);
// KEEP_HP_VALUE (the plain hp value)
// KEEP_NAME = needNameTransfer
// KEEP_ENCHANTS = needEnchantTransfer
// TO_GAIA = needChangePlayerToGaia
// TO_EFFECT_CASTER_PLAYER -> the new unit after transform will be owned by the player that the original caster was of the executing effect (eg. zombi infection)
// RESET_ACTION_MOVEMENT reinitialize Action And Movement (sets to max)
// RESET_MOVEMENT reinitialize the movement (sets to max)
// RESET_ACTION reinitialize the action movement (sets to max)
// CLEAR_ACTION, clears action (set to no actions left)
// CLEAR_MOVEMENT, clears movement (set to no movement left)
// CLEAR_ACTION_MOVEMENT clears action and movement

// DROP_ID = needDropID
// TO_LATEST_TYPE = means if knight to be spawned and player has heavy knight than spawn heavy instead.

Tech dependency:
trnTechDepTrn; //techDependentTransform from json format: TECH_XXX:TRN_YYY meaning on given tech use that transform instead, order of rows matters (the latest definition will be used first)!


3 ways of using a transformation
You have 3 option to use a transformation definition (in transforms.json)
1. You can set it in the unit definition
2. you can set it in the transformation effect itself
3. you can set it in the transformation effect itself but overwriting the target unit form (you can use generalized transformation definition)


1. setting in unit definition
The classic way
- you set the "trnTransformTo1" field in the unit defintion
- you give an ability to unit that is SYSTEM_SPECIAL_EFFECT_TRANSFORM1 type
OR
- you set the "trnTransformToGroups" field in the unit defintion
- you give an ability to unit that is SYSTEM_SPECIAL_EFFECT_TRANSFORM_BY_GROUP type AND the dataString value to the group nyme you used in trnTransformToGroups

the logic will find the target transformation definition from the unit.

2. setting in transformation effect
This case
- you leave empty the "trnTransformTo1" field in the unit defintion
- but you set the "trnTransformTo" field in the transformation effect itself

this is also written in effects:
"trnTransformTo" ----------------------------------------------------------------------transformation ID, used for case of SYSTEM_SPECIAL_EFFECT_TRANSFORM1, if null than the Unit.transformTo1 value will be used
viewtopic.php?f=215&t=3565#p34393


3. Generalized tranformations:
This case you
- you leave empty the "trnTransformTo1" field in the unit defintion
- you set the "trnTransformTo" field in the transformation effect itself - here you can use a general transformation see below:

You dont need to make new transformations for each unit type, only one general for most unit transformations like "TO_ANYTHING"
as from now you can set the target unit type in the Effect definition trnActionUnitID field.
(2023.01.15 change: remark: as the trnActionUnitID can contain unit ID for this transform, and also can contain effect affect "filtering" unit id (that must be IS_EFFECT_AFFECT type) from now these are harmonized, and from now you can filter transformations with the classic validTargets setting in an effect-affect json)

i made it in AOS like this to test

Code: Select all

{"name": "TO_SPECIFIED_UNIT_FORM", "units": ["UNIT_NEUTRAL_STONE_STATUE"], "needs": ["KEEP_HP", "KEEP_NAME", "KEEP_ENCHANTS"]}
and in the trebuchet transform effect

Code: Select all

         "trnActionUnitID":"UNIT_TREBUCHET_STAND",
         ...
         "trnTransformTo":"TO_SPECIFIED_UNIT_FORM",

Sample json content:

Code: Select all

[
{"name": "TO_TREASURE_SHIP",     "units": ["UNIT_UND_TREASURE_SHIP"],              "needs": []},
{"name": "SPECTRAL_REAPER",      "units": ["UNIT_UND_SPECTRAL_RIDER_UNM"],         "needs": ["KEEP_ENCHANTS"]},
{"name": "TO_UNDEAD_ARCHER",     "units": ["UNIT_UND_SKELETON_ARCHER"],            "needs": ["KEEP_ENCHANTS"]},
{"name": "TO_UNDEAD_SPEARMAN",   "units": ["UNIT_UND_SKELETON_SPEARMAN"],          "needs": ["KEEP_ENCHANTS"]},
{"name": "TO_UNDEAD_SWORDMAN",   "units": ["UNIT_UND_SKELETON"],                   "needs": ["KEEP_ENCHANTS"],   "trnTechDepTrn": ["TECH_UND_UPGRADE_UNIT_SKELETON_ARMORED:TO_UNDEAD_ARCHER", "TECH_UND_UPGRADE_UNIT_SKELETON_GOLDEN:TO_UNDEAD_MAGE"]},
{"name": "TO_CORPSE_HUMAN",      "units": ["UNIT_DEAD_HUMAN1"],                    "needs": ["TO_GAIA", "DROP_ID"]},
{"name": "TO_CORPSE_MOUNTED",    "units": ["UNIT_DEAD_MOUNTED1"],                  "needs": ["TO_GAIA", "DROP_ID"]},
{"name": "TO_CORPSE_SPEARMAN",   "units": ["UNIT_DEAD_SPEARMAN1"],                 "needs": ["TO_GAIA", "DROP_ID"]},
{"name": "TO_CORPSE_ARCHER",     "units": ["UNIT_DEAD_ARCHER1"],                   "needs": ["TO_GAIA", "DROP_ID"]},
{"name": "TO_CORPSE_SHIP",       "units": ["UNIT_DEAD_SHIP"],                      "needs": ["TO_GAIA", "DROP_ID"]},
{"name": "TO_CENTAUR_MELEE",     "units": ["UNIT_ELF_CENTAUR_MELEE"],              "needs": ["KEEP_HP", "KEEP_NAME", "KEEP_ENCHANTS"]},
{"name": "TO_CENTAUR_RANGER",    "units": ["UNIT_ELF_CENTAUR_RANGED"],             "needs": ["KEEP_HP", "KEEP_NAME", "KEEP_ENCHANTS"]},
{"name": "TO_FRODO",             "units": ["UNIT_HOBBIT_FRODO"],                   "needs": ["KEEP_HP", "KEEP_NAME", "KEEP_ENCHANTS"]},
{"name": "TO_FRODO_RINGED",      "units": ["UNIT_FARAMIR_RANGED"],                 "needs": ["KEEP_HP", "KEEP_NAME", "KEEP_ENCHANTS"]},
{"name": "TO_FARAMIR_RANGED",    "units": ["UNIT_UND_TREASURE_SHIP"],              "needs": ["KEEP_HP", "KEEP_NAME", "KEEP_ENCHANTS"]},
{"name": "TO_FARAMIR_MELEE",     "units": ["UNIT_FARAMIR"],                        "needs": ["KEEP_HP", "KEEP_NAME", "KEEP_ENCHANTS"]},
{"name": "VAMPIRE_BAT",          "units": ["UNIT_UND_VAMPIRE_BAT_FORM"],           "needs": ["KEEP_HP", "KEEP_NAME", "KEEP_ENCHANTS"]}
]
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Game definition jsons - Transformation definitions

Post by Stratego (dev) »

new transformations in aof for the dying units turning to corpse
{"name": "TO_CORPSE_HUMAN", "units": ["UNIT_DEAD_HUMAN1"], "needs": ["TO_GAIA", "DROP_ID"]},
{"name": "TO_CORPSE_MOUNTED", "units": ["UNIT_DEAD_MOUNTED1"], "needs": ["TO_GAIA", "DROP_ID"]},
{"name": "TO_CORPSE_SPEARMAN", "units": ["UNIT_DEAD_SPEARMAN1"], "needs": ["TO_GAIA", "DROP_ID"]},
{"name": "TO_CORPSE_ARCHER", "units": ["UNIT_DEAD_ARCHER1"], "needs": ["TO_GAIA", "DROP_ID"]},
{"name": "TO_CORPSE_SHIP", "units": ["UNIT_DEAD_SHIP"], "needs": ["TO_GAIA", "DROP_ID"]},
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Game definition jsons - Transformation definitions

Post by Stratego (dev) »

trnTechDepTrn
trnTechDepTrn; //techDependentTransform from json format: TECH_XXX:TRN_YYY meaning on given tech use that transform instead, order of rows matters (the latest definition will be used first)!
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Game definition jsons - Transformation definitions

Post by Stratego (dev) »

new option
// TO_LATEST_TYPE = means if knight to be spawned and player has heavy knight than spawn heavy instead.
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Game definition jsons - Transformation definitions

Post by Stratego (dev) »

// KEEP_HP = needHPTransfer (as a percentage of max hp);
// KEEP_HP_VALUE (the plain hp value)

change in usage of keep hp, and a new keep_hp_vaule
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Game definition jsons - Transformation definitions

Post by Stratego (dev) »

Generalized tranformations:
you dont need to make new transformations for each unit type, only one general for most unit transformations like "TO_ANYTHING"
as from now you can set the target unit type in the trnActionUnitID field.

i made it in AOS like this to test

Code: Select all

{"name": "TO_SPECIFIED_UNIT_FORM", "units": ["UNIT_NEUTRAL_STONE_STATUE"], "needs": ["KEEP_HP", "KEEP_NAME", "KEEP_ENCHANTS"]}
and in the trebuchet transform effect

Code: Select all

         "trnActionUnitID":"UNIT_TREBUCHET_STAND",
         ...
         "trnTransformTo":"TO_SPECIFIED_UNIT_FORM",
User avatar
L4cus
Posts: 2358
Joined: Fri Jan 31, 2020 7:51 pm
Location: Perú

Re: Game definition jsons - Transformation definitions

Post by L4cus »

okok, i need a tutorial about this!
Extra ecclesiam nulla salus...
AOD, a new variant...
viewforum.php?f=230
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Game definition jsons - Transformation definitions

Post by Stratego (dev) »

new options
// RESET_MOVEMENT reinitialize the movement
// RESET_ACTION reinitialize the action movement
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Game definition jsons - Transformation definitions

Post by Stratego (dev) »

new option

// TO_EFFECT_CASTER_PLAYER -> the new unit after transform will be owned by the player that the original caster was of the executing effect (eg. zombi infection)
User avatar
makazuwr32
Posts: 7830
Joined: Tue Oct 17, 2017 9:29 am
Location: Moscow, Russia

Re: Game definition jsons - Transformation definitions

Post by makazuwr32 »

Good.
This will come in handy for various parasite-based spells.
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: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Game definition jsons - Transformation definitions

Post by Stratego (dev) »

new options
// CLEAR_ACTION, clears action (set to no actions left)
// CLEAR_MOVEMENT, clears movement (set to no movement left)
// CLEAR_ACTION_MOVEMENT clears action and movement
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Game definition jsons - Transformation definitions

Post by Stratego (dev) »

(2023.01.15 change: remark: as the trnActionUnitID can contain unit ID for this transform, and also can contain effect affect "filtering" unit id (that must be IS_EFFECT_AFFECT type) from now these are harmonized, and from now you can filter transformations with the classic validTargets setting in an effect-affect json)


comment is inserted
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Game definition jsons - Transformation definitions

Post by Stratego (dev) »

Stratego (dev) wrote: Sun Jan 15, 2023 9:24 pm (2023.01.15 change: remark: as the trnActionUnitID can contain unit ID for this transform, and also can contain effect affect "filtering" unit id (that must be IS_EFFECT_AFFECT type) from now these are harmonized, and from now you can filter transformations with the classic validTargets setting in an effect-affect json)


comment is inserted
anyone understand what does this exactly mean?
how we "filter" and "target unit form" simultaneously this case?
a) if in "trnActionUnitID" is the "filtering" json (if so, then where to set the target "unit-form"?)
b) if in "trnActionUnitID" the target "unit-form" is set then how to "filter"?
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Game definition jsons - Transformation definitions

Post by Stratego (dev) »

updated texting with blue

1. setting in unit definition
The classic way
- you set the "trnTransformTo1" field in the unit defintion
- you give an ability to unit that is SYSTEM_SPECIAL_EFFECT_TRANSFORM1 type
OR
- you set the "trnTransformToGroups" field in the unit defintion
- you give an ability to unit that is SYSTEM_SPECIAL_EFFECT_TRANSFORM_BY_GROUP type AND the dataString value to the group nyme you used in trnTransformToGroups


the logic will find the target transformation definition from the unit.
Post Reply

Return to “Game Definition .JSON”