Creating a resource type near start location (faction trait)

Hi all,

I'm trying to create a faction trait with a bonus that always gives a particular resource type near the start location.  Here's the code i'm using:

<GameModifier>
  <ModType>Map</ModType>
  <Attribute>CreateResourceHoard</Attribute>
  <Value>1</Value>
  <StrVal>Resource_TwlightBees</StrVal>
  <Radius>3</Radius>
  <Provides>Free bees!</Provides>
</GameModifier>

This is included in the AbilityBonusOption for a custom faction trait.  Unfortunately it doesn't seem to have any effect.  Anyone know if this is possible or what i've done wrong?

Thanks.

5,731 views 14 replies
Reply #1 Top

These types of modifiers have to go into the sovereign's traits for some reason. A word of caution though, those buildings will boost the tile yields of the terrain around them - potentially creating very, very good starts.

Another option you could pursue is to create a new once-per-faction building that does what you want, and is unlocked from the faction trait. The player then builds it as soon as the game starts. A bonus of using this method is that the building, if captured, will be razed so you can't rush the AI for it.

Reply #2 Top

Thanks HF.  I'll try that second suggestion and post results.

Reply #3 Top

You champion, that works a treat (using the building method).  Not exactly how I would have liked it but it's a pretty darn good alternative, thanks.    

Reply #4 Top

Hi, Heaven, when you say 'These types of modifiers have to go into the sovereign's traits for some reason,' what do you mean? I was curious to see how it worked, and so I tried the GameModifier directly on the sovereign as well as attached to the AbilityBonusOption of an AbilityBonus, and neither worked. Do you have an example of working code you could show? I think this would be a nice way to always make certain that all the sovereigns are within a certain distance of a specific WorldResource, and want to experiment with it.

Reply #5 Top

    <GameModifier>
        <ModType>Player</ModType>
        <Attribute>StartPositionHasResource</Attribute>
        <StrVal>Wild_Dragons_Liz</StrVal>
        <Radius>3.0</Radius>
        <Provides>When the Lizardmen hid in caves beneath the earth, one of their kind brought back dragon eggs after meeting a dragon. The eggs have been stored since then...

Faction starts with a Dragon Cave within 3 tiles of starting position. Faction still requires the normal technology to use the resource.</Provides>
      </GameModifier>

Reply #6 Top

Hi, Heaven.

This appears not to be working. I even tried creating some Lizard Men, to see if the unmodified Storm World stuff worked, and it doesn't, using Brad's recent enhanced AI .exe.

Can you confirm?

 Edit: reverted out of brad's AI .exe and tried vanilla. Doesn't work there, either, for my sovereign or for the Lizardmen.

 

Reply #7 Top

Check out the Dragonkind sovereign trait for lizardmen, it works in vanilla 1.12.

Reply #8 Top


> Check out the Dragonkind sovereign trait for lizardmen, it works in vanilla 1.12.

Yeah. The first thing I did was do a findstr from the command line and found the entry in the lizardmen base traits.

Second thing I did was start a game as Lizardmen.

This didn't work, so I revved back to the 1.12 .exe.

That didn't work either.

My environment is heavily modded, including CoreMaps and TerrainTypes; this is from the ECOMental mod, IIRC.

Interesting mystery.

I can't fathom what would block this particular thing from working.

The resource is supposed to be visible within the given radius of the start point, right at the start of the game, correct?

Reply #9 Top

No, it may be outside visual range.

Reply #11 Top


No, the radius tag is not ignored. I tried this out myself, and it is working properly. But a radius of 3 allows the resource to be placed outside of initial sight range of your sovereign.

Reply #12 Top


>No, the radius tag is not ignored. I tried this out myself, and it is working properly. But a radius of 3 allows the resource to be placed outside of initial sight range of your sovereign.

Yeah. But, sadly, not there for either my mod, or Heaven's. Very strange. Has anyone seen any interactions in the past that make it not work?

Reply #13 Top

Well you got me curious.  I tested this, I found that I got the free resource on 6 out of 10 times.  Weird.

I created this ability based on HF's Lizardman code:

<AbilityBonus InternalName="BeeTestAbility">
   <AbilityBonusOption InternalName="BeeTest">
   <DisplayName>Free Bees</DisplayName>
   <Description>Free bees!</Description>
   <Icon>Ability_Adepts_Icon.png</Icon>
   <GameModifier>
      <ModType>Player</ModType>
      <Attribute>StartPositionHasResource</Attribute>
      <StrVal>Resource_TwlightBees</StrVal>
      <Radius>3.0</Radius>
      <Provides>Free bees!</Provides>
   </GameModifier>
   <Cost>1</Cost>
   <HideWhenUpgraded>0</HideWhenUpgraded>
   <AIData AIPersonality="AI_General">
      <AIPriority>5</AIPriority>
   </AIData>
   </AbilityBonusOption>
</AbilityBonus>

Then added it directly to one of my custom sov's as he specified using this:

<SelectedAbilityBonusOption>BeeTest</SelectedAbilityBonusOption>

Then I regenerated the map 10 times, and found that it usually works (6 out of 10 times).  It definitely doesn't always work.... I can't spot why.  Possibly depends on the stamps or surrounding terrain maybe.

Out of interested, HF's workaround he provided me above (to unlock the free resource from an improvement) has never failed for me so far... so it seems to work reliably.  If you want to play with free resources it might be better (i.e. more reliable) to unlock them using an improvement... it could be a really cheap one that can be built on 1 turn.

Reply #14 Top

Ah. I'm beginning to see it. It has something to do with the density settings for NPCs, quests, resources, and the like.

I suspect that if you set the density settings very high and reach MaxObjects per sector counts or some sort (this limit might also be governed by DistanceBetweenObjects), StartPositionHasResource silently fails.

I think if you open up ElementalDefs and play with the various game settings, or pick very low density ones when you play, it will make the resources more consistently.

I really wish there was some way to turn on an extended trace mode and read a log file.