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:
viewtopic.php?f=215&t=3565#p34393"trnTransformTo" ----------------------------------------------------------------------transformation ID, used for case of SYSTEM_SPECIAL_EFFECT_TRANSFORM1, if null than the Unit.transformTo1 value will be used
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"]}
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"]}
]