One or two years ago I was thinking about unit Yuri's mammy class tank (today I am remaking it to railgun, shrapnel railgun, plasma cannon) which could change turret when deploys.
Well I tried the first way I had seen in one TS mod via transformation box (it will be 2nd way in this topic), but in the end I wasn't succesfull (missed few tags). So I came up with another solution (it will be 1st way in this topic). On 90% it works with YR 1.001, but I have used 2nd way on Rockpatched (NPatched) YR.
What you need:
1. good temper
2. notepad
3. rules(md).ini of your mod
4. RA2 YR (not sure about normal RA2 or TS)
#1 aka Freeunit way
This way uses freeunit tag which is used in Refinery for free miner.
Advantages:
1. You can have transformating mine layer (mine layer tutorial here).
2. Easier to implement.
Disadvantages:
1. Unit appears beside deployed building (I'm not sure what will happen if there's no free space around).
"Double sword":
1. If the building is destroyed when the unit deploys, your unit is lost!
But laying a mine can be dangerous, no?
To MINIMALIZE THIS DANGER, you can use short buildup anim (Art(md).ini) for a building.
2. All the experience (veteran, elite) goes to the building and unit has no experience then.
On the other hand when you get new weapon, would you know, how to use it most effective?
ART(MD).ini
create all codes for units and buildings you will use
RULES(MD).ini
1. Add to the list all the units you want to transform to [VehicleTypes] list like:
[VehicleTypes] 103=TNKA 104=TNKB 105=TNKC##=NAME, where ## is number and NAME is name of the unit
where number can be changed like your GAMEMD.EXE version allows, so in NPatch it's lower than 500 I think (or is it higher?),
name is formed from big letters, don't use small letters
note:I am using Npatched YR, so if you use 1.001 version, you need to use numbers less then 100 (100 limit bug).
2. Add to the list all the building you will use for transformation to [BuildingTypes] list like
[BuildingTypes] 450=BLDNG 451=BLDNG2 452=BLDNG3##=NAME, where ## is number and NAME is name of the building
3. Add buildup anims you used in ART(MD).INI to the anim list unless list contains them already
like:
1100=BLDNGMK 1101=BLDNG2MK 1102=BLDNG3MK
4. Create codes of your units and add these tags
[TNKA] DeploysInto=BLDNG;your transformation building [TNKB] DeploysInto=BLDNG2;your transformation building TechLevel=-1; you won't be able to build this unit from the factory* [TNKC] DeploysInto=BLDNG3;your transformation building TechLevel=-1; you won't be able to build this unit from the factory**either AI, I haven't passed this yet, but you will set AI to deploy 1st unit into this and then add 2nd unit in same way like AI selects battle fortresses
5. Create codes of your buildings and add these tags:
[BLDNG] FreeUnit=TNKB; transformed unit TechLevel=-1; if you don't want allow player to build this building AIBuildThis=no; otherwise AI will build this building with freeunit even it has Techlevel=-1 [BLDNG2] FreeUnit=TNKC; transformed unit TechLevel=-1; if you don't want allow player to build this building AIBuildThis=no; otherwise AI will build this building with freeunit even it has Techlevel=-1 [BLDNG3] FreeUnit=TNKA; transformed unit ... completing circle TechLevel=-1; if you don't want allow player to build this building AIBuildThis=no; otherwise AI will build this building with freeunit even it has Techlevel=-1
That's all.
#2 aka Transformation box way
Advantages:
1. Unit doesn't lose experience when deployed
2. You need just space of the building that is deployed unit
Disadvantages:
1. There are more tags a bit.
----------------------------------
Same ART(MD).INI and lists in RULES(MD).INI
units
[TNKA] DeploysInto=BLDNG DeployFacing=0; these tags are ripped from Slave Miner code, but without them it haven't worked DeploySound=SlaveMinerUndeploy VoiceDeploy=; deploying maybe? DeaccelerationFactor=.2; This is TS's mizspelingg knot min Accelerates=false [TNKB] DeploysInto=BLDNG2 TechLevel=-1; unless you want have it buildable from the factory DeployFacing=0; these tags are ripped from Slave Miner code, but without them it haven't worked DeploySound=SlaveMinerUndeploy VoiceDeploy=; deploying maybe? DeaccelerationFactor=.2; This is TS's mizspelingg knot min Accelerates=false [TNKC] DeploysInto=BLDNG3 TechLevel=-1; unless you want have it buildable from the factory DeployFacing=0; these tags are ripped from Slave Miner code, but without them it haven't worked DeploySound=SlaveMinerUndeploy VoiceDeploy=; deploying maybe? DeaccelerationFactor=.2; This is TS's mizspelingg knot min Accelerates=false
Buildings (transformation box, deployed units):
[BLDNG] TechLevel=-1; if you don't want allow player to build this building AIBuildThis=no; otherwise AI will build this building with freeunit even it has Techlevel=-1 UndeploysInto=TNKB; your transformed unit ... FIRST OF THE MOST IMPORTANT TAGS which follow, also rip tags from the Slave Miner DeployFacing=0 DeploySound=SlaveMinerUndeploy VoiceDeploy=;unit undeployed maybe? [BLDNG2] TechLevel=-1; if you don't want allow player to build this building AIBuildThis=no; otherwise AI will build this building with freeunit even it has Techlevel=-1 UndeploysInto=TNKC; your transformed unit ... FIRST OF THE MOST IMPORTANT TAGS which follow, also rip tags from the Slave Miner DeployFacing=0 DeploySound=SlaveMinerUndeploy VoiceDeploy=;unit undeployed maybe? [BLDNG3] TechLevel=-1; if you don't want allow player to build this building AIBuildThis=no; otherwise AI will build this building with freeunit even it has Techlevel=-1 UndeploysInto=TNKA; completing circle ... FIRST OF THE MOST IMPORTANT TAGS which follow, also rip tags from the Slave Miner DeployFacing=0 DeploySound=SlaveMinerUndeploy VoiceDeploy=;unit undeployed maybe?
That's all!
sidenote: When I wrote last few lines, I have realized what will happen when you add Freeunit tag to building code. You can produce 2 units from 1!
These transformation logics have limitations (you need to deploy unit to building first, no infantry deploy to building till VK or PD will find the way), I haven't tested if chopper can be deployed in this way (Siege Chopper uses other deploy logic), but it works for all ground units (and amphibious possibly too). Also I dunno about ships, teoretically ship transformation should be codable, but I haven't tested this.