Tech which forces player to loose access to minor settlement which reflects at embasy

Hello I am sorry to bother you but I am developing a Minor civ selector mod and I have a problem If I join my minor aliance i get access to the units and techs which i have defined for building and i use: <effect civ="Caribs" type="Data" amount="1.00" subtype="UpgradeSubCivAlliance" relativity="Assign">
<target type="Player">
</target>
</effect>

to assign the status of aliance to get build limit and access to units but when I do <effect civ="Caribs" type="Data" amount="-1.00" subtype="UpgradeSubCivAlliance" relativity="Assign">
<target type="Player">
</target>
</effect> in my leave aliance tech to simulate leaving the aliance the unit is still trainable at Default AOE 3 embasy I suspect that the command only works as intended when there are actuall native settlements of caribs on the map because it checks the native settlements present and subtracts the number therefore disabling the ability to train units but when there is nothing to compare them to they are still trainable because the game cant handle it. Is there some workaround for that that would force the same behaviour as when trading post gets destroyed here is my code

<tech name="DEAmericanAlliesIncaCaribsTemple" type="Normal">
<dbid>95000</dbid>
<displaynameid>200069</displaynameid>
<researchpoints>5.0000</researchpoints>
<status>UNOBTAINABLE</status>
<icon>resources\images\icons\techs\inca\american_allies_caribs.png</icon>
<rollovertextid>200066</rollovertextid>
<flag>YPInfiniteTech</flag>
<effects>
<effect type="Data" amount="1.00" subtype="Enable" relativity="Absolute">
<target type="ProtoUnit">NatBlowgunWarrior</target>
</effect>
<effect type="Data" amount="1.00" subtype="Enable" relativity="Absolute">
<target type="ProtoUnit">Canoe</target>
</effect>
<effect type="TechStatus" status="obtainable">LeaveCaribs</effect>
<effect type="TechStatus" status="obtainable">WarriorSocietyCaribs</effect>
<effect type="TechStatus" status="obtainable">ChampionCaribs</effect>
<effect type="TechStatus" status="obtainable">NatGarifunaDrums</effect>
<effect type="TechStatus" status="obtainable">NatCeremonialFeast</effect>
<effect type="TechStatus" status="obtainable">NatKasiriBeer</effect>
<effect type="TechStatus" status="obtainable">NatBlowgunnerAmbush</effect>

  <effect type="CommandAdd" tech="ChampionCaribs" page="1" column="14">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  <effect type="CommandAdd" tech="WarriorSocietyCaribs" page="1" column="14">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
   <effect type="CommandAdd" tech="NatGarifunaDrums" page="1" column="16">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  <effect type="CommandAdd" tech="NatCeremonialFeast" page="1" column="14">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  <effect type="CommandAdd" tech="NatKasiriBeer" page="1" column="18">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  <effect type="CommandAdd" tech="NatBlowgunnerAmbush" page="1" column="15">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  <effect type="CommandAdd" tech="LeaveCaribs" page="1" column="17">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  <effect type="Data" subtype="AddTrain" unittype="NatBlowgunWarrior" amount="1.00" relativity="Assign">
	<target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  
  <effect civ="Caribs" type="Data" amount="1.00" subtype="UpgradeSubCivAlliance" relativity="Assign">
    <target type="Player">
    </target>
  </effect>
  
 
</effects> </tech> 

<tech name="LeaveCaribs" type="Normal">
    <dbid>95001</dbid>
    <displaynameid>64633</displaynameid>
    <researchpoints>10.0000</researchpoints>
    <status>UNOBTAINABLE</status>
    <icon>resources\images\icons\techs\americans\team_lewis_clark_expedition.png</icon>
    <rollovertextid>64632</rollovertextid>
	<flag>YPInfiniteTech</flag>
    <effects> 
<effect type="Data" amount="-1.00" subtype="Enable" relativity="Absolute">
    <target type="ProtoUnit">Canoe</target>
  </effect>
   <effect type="CommandRemove" tech="LeaveCaribs">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  <effect type="CommandRemove" tech="WarriorSocietyCaribs">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  
  <effect type="CommandRemove" tech="ChampionCaribs">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  <effect type="CommandRemove" tech="NatGarifunaDrums">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  <effect type="CommandRemove" tech="NatCeremonialFeast">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  <effect type="CommandRemove" tech="NatKasiriBeer">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  <effect type="CommandRemove" tech="NatBlowgunnerAmbush">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  <effect type="CommandRemove" proto="NatBlowgunWarrior">
    <target type="ProtoUnit">CHCCMinorEmbasy</target>
  </effect>
  
  <effect civ="Caribs" type="Data" amount="-1.00" subtype="UpgradeSubCivAlliance" relativity="Absolute">
    <target type="Player">
    </target>
  </effect>
  
  <effect type="TechStatus" status="obtainable">DEAmericanAlliesIncaCaribsTemple</effect>
</effects></tech> 

Have a great day
Edotenseilove

-1 ?
Usually data doesnt work with - … If you want to disable something , set it to 0

In this case 1 = yes / 0 = no

Thank you for your answer I have discovered that the units revert their build limit number back when i leave an aliance(in case a player is already allied with a settlement through trading post) so the command is somewhat working the problem is simple when units get enabled it automatically shows up in embasy with irreversible basic build limit so basically unit gets enabled buildlimit gets assigned unit gets automatically added to embassy and there is no safe “revert the enabling process action” because the game cant distinquished from enabled from my system and enabled from trading post so even if i would use YPForceUnapply flag in my joining tech and in leave tech i would change the status of the joining tech to unobtainable my systems leave tech would revert the units active to disabled (but because it reverts the initial action the unit would vanish from embasy which is what i was hoping to achieve) but unfortunatelly the active state in trading post where the unit should always be active would get overriden too.

So i gave up and switched to making aoe embasy unobtainable and began replacing the building with my own in which the player can safelly choose which settlement does he want to join with the option of leaving and choosing another one I wanted to avoid disabling the original aoe embassy but i dont have a choice if left as it is the embasy would populate to full with all the natives possible and making them trainable forrever even if the player is not aligned with that particular aliance.

That beeing said if anyone would know a way to implement the workround around the original embassy so that it would not interfere with the main purpose of my mod I kindly ask for your advice.

Have a great day
Edotenseilove

1 Like