News

Randomize Anomaly Encounters

Posted on Friday, January 13, 2017

Hi Developers,

in AnomalyDefs.xml encounters are described like that:

      <EncounterChance>0.75</EncounterChance>
      <EncounterTriggers>
        <OnEvent>OnCollideAtAnomaly</OnEvent>
        <Target>
          <TargetType>Fleet</TargetType>
        </Target>
        <Lifetime>Instant</Lifetime>
        <PerformAction>
          <Action>BattleEncounter</Action>
          <StringParam>PirateEncounter</StringParam>
        </PerformAction>
      </EncounterTriggers>

Now I would like to randomize those encounters so that with a certain chance a certain encounter is generated. For that the definition could be something like that:

      <EncounterTriggers>
        <EncounterChance>0.35</EncounterChance>
        <OnEvent>OnCollideAtAnomaly</OnEvent>
        <Target>
          <TargetType>Fleet</TargetType>
        </Target>
        <Lifetime>Instant</Lifetime>
        <PerformAction>
          <Action>BattleEncounter</Action>
          <StringParam>PirateEncounter</StringParam>
        </PerformAction>
      </EncounterTriggers>
      <EncounterTriggers>
        <EncounterChance>0.25</EncounterChance>
        <OnEvent>OnCollideAtAnomaly</OnEvent>
        <Target>
          <TargetType>Fleet</TargetType>
        </Target>
        <Lifetime>Instant</Lifetime>
        <PerformAction>
          <Action>BattleEncounter</Action>
          <StringParam>PirateEncounter2</StringParam>
        </PerformAction>
      </EncounterTriggers>
      <EncounterTriggers>
        <EncounterChance>0.15</EncounterChance>
        <OnEvent>OnCollideAtAnomaly</OnEvent>
        <Target>
          <TargetType>Fleet</TargetType>
        </Target>
        <Lifetime>Instant</Lifetime>
        <PerformAction>
          <Action>BattleEncounter</Action>
          <StringParam>PirateEncounter3</StringParam>
        </PerformAction>
      </EncounterTriggers>

Is that something that is possible for one of the next versions?

Right now to achieve something like that I would have to replicate the complete anomaly definition for every possible encounter and control the probability by adjusting the anomaly weight (not tested yet, but I will do so). That is a lot of redundant definitions to type and difficult to maintain ...