So in the olden AOM I once created a method, to make techs repeatable (and they scaled their cost with each buy).
Short explanation with Coinage:
- Coinage enables to train a unit, that is called “Coinage X”
- A Tech called “Coinage Unlimited” is Persistent and triggers, whenever a “Coinage X” unit is present.
- The “Coinage X” unit is removed (transformed to a custom “Token” unit, that is killed on the next tick) and the Coinage effect is activated, thus granting Caravans the speed boost.
This worked with the old 2.7 proto and techtree:
proto2.7.xml
<unit id="367" name="Market">
....
<tech row="2" page="1" column="3">Coinage</tech>
<train row="2" page="1" column="3">Coinage X</train>
....
</unit>
<unit id="888026" name="Coinage X">
<dbid></dbid>
<displaynameid>11090</displaynameid>
<icon>improvement coinage icon</icon>
<initialhitpoints>1000.0000</initialhitpoints>
<maxhitpoints>1000.0000</maxhitpoints>
<los>0.0000</los>
<obstructionradiusx>0.0000</obstructionradiusx>
<obstructionradiusz>0.0000</obstructionradiusz>
<trainpoints>20.0000</trainpoints>
<buildlimit>1</buildlimit>
<rollovertextid>11089</rollovertextid>
<cost resourcetype="Gold">200.0000</cost>
<armor damagetype="Hack" percentflag="1">0.99</armor>
<armor damagetype="Pierce" percentflag="1">0.99</armor>
<armor damagetype="Crush" percentflag="1">0.99</armor>
<unittype>Unit</unittype>
<unittype>UnitClass</unittype>
<flag>ApplyHandicapTraining</flag>
<flag>ObscuredByUnits</flag>
<flag>Tracked</flag>
<flag>ForceBuildingData</flag>
<flag>NotSelectable</flag>
<flag>NonCollideable</flag>
</unit>
<unit id="888000" name="Token">
<dbid></dbid>
<los>0.0000</los>
<obstructionradiusx>0.0000</obstructionradiusx>
<obstructionradiusz>0.0000</obstructionradiusz>
<maxvelocity>0.0000</maxvelocity>
<movementtype>air</movementtype>
<lifespan>4.0000</lifespan>
<bountyfactor resourcetype="Favor">1.0000</bountyfactor>
<flag>NotSelectable</flag>
<flag>NotSearchable</flag>
<flag>KillOnAnimLoop</flag>
<flag>DoNotYawDuringMovement</flag>
<flag>NonCollideable</flag>
<flag>NoHPBar</flag>
<flag>NoBloodOnDeath</flag>
</unit>
techtree2.7.xml:
<tech name="Coinage" type="Normal">
...
<effect type="Data" amount="1.00" subtype="Enable" relativity="Absolute">
<target type="ProtoUnit">Coinage X</target>
</effect>
...
</tech>
<tech name="Coinage Unlimited" type="Normal">
<dbid></dbid>
<researchpoints>0.0000</researchpoints>
<status>PERSISTENT</status>
<delay>0.0000</delay>
<flag>HideFromDetailHelp</flag>
<prereqs>
<typecount unit="Coinage X" count="1.00" state="noneState aliveState " operator="gte"></typecount>
</prereqs>
<effects>
<effect type="TechStatus" status="active">Coinage</effect>
<effect type="ConsoleCommand">unitTransform("Coinage X", "Token")</effect>
<effect type="Data" amount="1.2" subtype="Cost" resource="Gold" relativity="Percent">
<target type="ProtoUnit">Coinage X</target>
</effect>
</effects>
</tech>
Now I try to insert the same into the AOM Retold, but it seems, that the persistent effect doesn’t trigger.
techtree.xml:
<tech name="Coinage">
<displaynameid>STR_TECH_COINAGE_NAME</displaynameid>
<rollovertextid>STR_TECH_COINAGE_LR</rollovertextid>
<cost resourcetype="Gold">200.0000</cost>
<researchpoints>40.0000</researchpoints>
<status>UNOBTAINABLE</status>
<icon>resources\shared\static_color\technologies\coinage_icon.png</icon>
<flag>CountsTowardEconomicScore</flag>
<effects>
<effect type="Data" amount="1.20" subtype="MaximumVelocity" relativity="BasePercent">
<target type="ProtoUnit">TradeUnit</target>
</effect>
<effect type="Data" amount="1.00" subtype="Enable" relativity="Absolute">
<target type="ProtoUnit">Coinage X</target>
</effect>
</effects>
</tech>
<tech name="CoinageUnlimited">
<delay>1.0000</delay>
<flag>Volatile</flag>
<flag>Persistent</flag>
<flag>HideFromDialogs</flag>
<prereqs>
<typecount unit="Coinage X" count="1.00" state="aliveState " operator="gte"></typecount>
</prereqs>
<effects>
<effect type="TechStatus" status="active">Coinage</effect>
<effect type="TransformUnit" fromprotoid="Coinage X" toprotoid="CavalrySpeedCharge"></effect>
<effect type="Data" amount="1.2" subtype="cost" resource="Gold" relativity="Percent">
<target type="ProtoUnit">Coinage X</target>
</effect>
<effect type="TextOutput">STR_MSG_PHARAOH</effect>
</effects>
</tech>
proto.xml (the Coinage X creates a Greek Caravan Unit just as a placeholder):
<unit name="Coinage X">
<displaynameid>STR_UNIT_DONKEY_CARAVAN_NAME</displaynameid>
<rollovertextid>STR_UNIT_DONKEY_CARAVAN_LR</rollovertextid>
<shortrollovertextid>STR_UNIT_DONKEY_CARAVAN_SR</shortrollovertextid>
<editornameid>STR_UNIT_DONKEY_CARAVAN_EDT_NAME</editornameid>
<icon>resources\greek\player_color\units\caravan_greek_icon.png</icon>
<animfile>greek\units\economic\caravan_greek\caravan_greek.xml</animfile>
<soundsetfile>greek\vo\caravan_greek\caravan_greek.xml</soundsetfile>
<obstructionradiusx>0.9900</obstructionradiusx>
<obstructionradiusz>0.9900</obstructionradiusz>
<selectionradiusx>0.7500</selectionradiusx>
<selectionradiusz>1.2500</selectionradiusz>
<impacttype>Unarmoured</impacttype>
<unitaitype>Civilian</unitaitype>
<movementtype>land</movementtype>
<turnrate>18.0000</turnrate>
<initialhitpoints>115.0000</initialhitpoints>
<maxhitpoints>115.0000</maxhitpoints>
<trainpoints>15.0000</trainpoints>
<buildlimit>60</buildlimit>
<weightclass>5</weightclass>
<populationcount>1</populationcount>
<maxvelocity>3.8000</maxvelocity>
<los>16.0000</los>
<cost resourcetype="Food">100.0000</cost>
<cost resourcetype="Wood">25.0000</cost>
<carrycapacity resourcetype="Gold">1000.0000</carrycapacity>
<armor type="Hack" value="0.3000">
</armor>
<armor type="Pierce" value="0.3000">
</armor>
<armor type="Crush" value="0.9900">
</armor>
<unittype>LogicalTypeMinimapFilterEconomic</unittype>
<unittype>LogicalTypeEasySelectAvoid</unittype>
<unittype>LogicalTypeHandUnitsAutoAttack</unittype>
<unittype>LogicalTypeRangedUnitsAutoAttack</unittype>
<unittype>LogicalTypeVillagersAttack</unittype>
<unittype>LogicalTypeHandUnitsAttack</unittype>
<unittype>LogicalTypeRangedUnitsAttack</unittype>
<unittype>LogicalTypeAffectedByRestoration</unittype>
<unittype>LogicalTypeHealed</unittype>
<unittype>Unit</unittype>
<unittype>UnitClass</unittype>
<unittype>EconomicUnit</unittype>
<unittype>TradeUnit</unittype>
<unittype>LogicalTypeGarrisonInShips</unittype>
<unittype>CountsTowardEconomicScore</unittype>
<unittype>ValidIdleVillager</unittype>
<unittype>LogicalTypeConvertsHerds</unittype>
<unittype>LogicalTypeEarthquakeAttack</unittype>
<unittype>LogicalTypeValidMeteorTarget</unittype>
<unittype>LogicalTypeValidTornadoAttack</unittype>
<unittype>LogicalTypeValidShiftingSandsTarget</unittype>
<unittype>LogicalTypeValidSpyTarget</unittype>
<unittype>LogicalTypeValidFrostTarget</unittype>
<unittype>LogicalTypeValidTraitorTarget</unittype>
<unittype>LogicalTypeValidShockwaveTarget</unittype>
<flag>CollidesWithProjectiles</flag>
<flag>CorpseDecays</flag>
<flag>DontRotateObstruction</flag>
<flag>ObscuredByUnits</flag>
<flag>ColorTransformNonNature</flag>
<flag>NonAutoFormedUnit</flag>
<flag>CommonCommands</flag>
<flag>AutoTrainable</flag>
<flag>NoIdleActions</flag>
<flag>CreateUnitGroupAutomatically</flag>
<tactics>trade.tactics</tactics>
<protoaction>
<name>Trade</name>
<rate type="AbstractTownCenter">0.700000</rate>
<rate type="Market">0.001000</rate>
<maxrange>1.5</maxrange>
</protoaction>
</unit>
<unit name="Token">
<los>0.0000</los>
<obstructionradiusx>0.0000</obstructionradiusx>
<obstructionradiusz>0.0000</obstructionradiusz>
<maxvelocity>0.0000</maxvelocity>
<movementtype>air</movementtype>
<lifespan>4.0000</lifespan>
<bountyfactor resourcetype="Favor">1.0000</bountyfactor>
<flag>NotSelectable</flag>
<flag>NotSearchable</flag>
<flag>KillOnAnimLoop</flag>
<flag>DoNotYawDuringMovement</flag>
<flag>NonCollideable</flag>
<flag>NoHPBar</flag>
<flag>NoBloodOnDeath</flag>
</unit>
Is there something wrong with the persistent effect?