How to use TerraformTilesOnPlanet action

I'm working on custom race like zerglings from StarCraft, and I want to add the custom race ability which will allow zerglings upgrade planet class on colonization trigger, but the game crashes on colonization. I've tried to use:

<Triggers>
      <OnEvent>OnColonizePlanet</OnEvent>
      <Target>
        <TargetType>Planet</TargetType>
      </Target>
      <PerformAction>
        <Action>TerraformTilesOnPlanet</Action>
      </PerformAction>
    </Triggers>

and

<Triggers>
      <OnEvent>OnColonizePlanet</OnEvent>
      <Target>
        <TargetType>Colony</TargetType>
      </Target>
      <PerformAction>
        <Action>TerraformTilesOnPlanet</Action>
      </PerformAction>
    </Triggers>

24,908 views 4 replies
Reply #1 Top

I've found why it crashed, there are 2 parameters needed

<Triggers>
      <OnEvent>OnColonizePlanet</OnEvent>
      <Target>
        <TargetType>Planet</TargetType>
      </Target>
      <Lifetime>Instant</Lifetime>
      <PerformAction>
        <Action>TerraformTilesOnPlanet</Action>
        <ValueParam>1</ValueParam>
        <ValueParam>0</ValueParam>
      </PerformAction>
    </Triggers>

Reply #2 Top

There are 3 parameters available. I am not familiar with what each does. I noticed them in one of Deathwynd's mods. You can see that there are 3 in CultureTraitDefs.xml for Outreach4, Greed2, and Greed5.

Reply #3 Top

<Triggers>
<OnEvent>OnColonizePlanet</OnEvent>
<Target>
<TargetType>Colony</TargetType>
</Target>
<PerformAction>
<Action>TerraformTilesOnPlanet</Action>
<ValueParam>-1</ValueParam>
<ValueParam>1</ValueParam>
<ValueParam>1.0</ValueParam>
</PerformAction>
</Triggers>

Reply #4 Top

First parameter is I believe the number of planets to apply this feature to (there may be an off by one bug here, as there used to be, unless they fixed it).

Second parameter is I believe the number of tiles to terraform.

Third parameter is the minimum quality to terraform 0..1 with 0 being the worst quality tile and 1 being the best.

+1 Loading…