Issue removing -but not adding- mental states to a thinktree subtree

Started by GarbageDay, March 31, 2020, 02:57:26 PM

Previous topic - Next topic

GarbageDay

I'm editing a custom thinktree for my alien race and i'm running into an issue removing mental break types and im starting to think there's some sort of issue with how the game's applying code.

Now so far I've successfully replaced the thinktreedef subtree "MainColonistBehaviorCore" with a custom "ZR_MainColonistBehaviorCore" that removes the Jobgiver for seeking out joy activities when recreation is low. The bar will now empty and my aliens won't try to use pool tables or horseshoes, etc even when i schedule 24 hours of recreation- all good.

Now the issue is when i try replacing the MentalStateCritical & MentalStateNonCritical subtrees. I can get the game to read and naturally trigger new custom mental states i create and add to my custom subtrees but despite editing the base types of mental break out of the subtrees they're still showing up in game.

So deleting corpseobession from the subtree and replacing it with ZR_corpseobession yields me two different types of mental break in game, one default obsession and one with my custom flavour text. Removing berserk, psychotic wander, any/all other nodes from the custom MentalStateCritical & MentalStateNonCritical subtrees also doesn't have an effect.

I have no idea how the game is attaching non-custom mental states to my alien race if i've cleaned out the references to the defs in the mentalstate subtrees, the same subtree which is applying my custom mentalbreaks properly.

I need a dev to come tell me it's not something i can do or some other alien race modder who's removed specific mental states before to come call me dumb and show me whats what.

The only ways left i can figure to remove mental breaks now is to edit the MentalStates defs themselves to be commonality 0 (Obviously not what i want), or maybe i could crank up the commonality of the custom mental states im adding to 999 or something so the base game ones almost never get rolled.

GarbageDay

#1
So making a new set of custom mentalstatesdefs for "minor","major","extreme" and cranking the <baseCommonality> to 99 overpowers the base game mentalstates and seems to get the intended results when you plug them into the thinktree mentalstate subtrees, if you find this thread looking for a work around.

Homez

One way you might be able to accomplish this is by creating a new Trait that all of your aliens share, e.g. "Alien Psychology".

For instance, see the DrugDesire TraitDef below:
<TraitDef>
    <defName>DrugDesire</defName>
    <commonality>3</commonality>
    <degreeDatas>
      <li>
        <label>chemical fascination</label>
        <description>[PAWN_nameDef] is utterly fascinated with chemical sources of enjoyment. Consuming recreational drugs will create a good mood, while abstaining will lead to increasing frustration over time and possibly drug binges. [PAWN_pronoun] will ignore directives to not use recreational drugs, and will consume more than a normal person.</description>
        <degree>2</degree>
        <marketValueFactorOffset>-0.15</marketValueFactorOffset>
      </li>
      <li>
        <label>chemical interest</label>
        <description>[PAWN_nameDef] has an unusual interest in chemical sources of enjoyment. Consuming recreational drugs will create a good mood, while abstaining will lead to increasing frustration over time and possible drug binges. [PAWN_pronoun] will ignore directives to not use recreational drugs, and will consume more than a normal person.</description>
        <degree>1</degree>
        <marketValueFactorOffset>-0.10</marketValueFactorOffset>
      </li>
      <li>
        <label>teetotaler</label>
        <description>[PAWN_nameDef] abhors the idea of gaining pleasure from chemicals. [PAWN_pronoun] strictly avoids alcohol and recreational drugs.</description>
        <degree>-1</degree>
        <disallowedMentalStates>
          <li>Binging_DrugExtreme</li>
          <li>Binging_DrugMajor</li>
        </disallowedMentalStates>
      </li>
    </degreeDatas>
  </TraitDef>


You'll notice one of the degreeDatas is teetotaler
<li>
        <label>teetotaler</label>
        <description>[PAWN_nameDef] abhors the idea of gaining pleasure from chemicals. [PAWN_pronoun] strictly avoids alcohol and recreational drugs.</description>
        <degree>-1</degree>
        <disallowedMentalStates>
          <li>Binging_DrugExtreme</li>
          <li>Binging_DrugMajor</li>
        </disallowedMentalStates>
      </li>

where teetotaler prevents anyone with that trait from suffering the Binging_DrugExtreme or Binging_DrugMajor breaks.

I've never done this before, but if you created your own Trait called Alien Psychology and assigned it to your aliens, then inside the <disallowedMentalStates>...</disallowedMentalStates> block listed out all the mental breaks that don't apply to your aliens... maybe that would do it? Then all you'd have to do is figure out how to assign your new trait to every member of your alien race, and no member of any other race.

GarbageDay

#3
That's a way if you're willing to sacrifice a trait slot, i know android tiers forces you to roll a custom alien trait "Simple minded android" or somesuch name that adds a large moodlet boost but attaching <disallowedMentalStates> to a forced  trait is something i passed over in favour of trying to find a hidden option.

Sadly alien tiers doesn't seem to have any way to attach hidden trait effects like that, and trying to attach <disallowedMentalStates> to things like always active thoughts or other places in the alienrace .xml just throws exceptions.

BUT after working with duplicate mental states at 99 for a bit i'm not sure i want to do it in that manner anymore, just feels like it'll break things in a way i'm not going to notice until players start reporting game ruining things. I've disallowed enough base game traits at this point that forcing an alien trait might not feel as clunky as it initially did either, so maybe that's the way i'll end up going after all.

Edit: I should mention that instead of commonality 99 you should actually use bases of 1:100 to help ratio things out so 0.85 = 85 or 170, 255, etc

GarbageDay

#4
So i finally tested with a couple tribes of regular humans to make sure the mental breaks i added weren't interfering with them somehow and it turns out that 100% of the mental states i made are applying to them despite not touching the original races_humanlike .xml or the human thinktree / it's subtrees.

This is my think tree name for my race and the names for the subtrees that SHOULD be responsible for adding mental breaks, just to prove that i am actually changing things.

<ThinkTreeDef>
    <defName>ZR_ZETA_RETICULAN_THINK_TREE_DEF</defName>


<li Class="ThinkNode_Subtree">
          <treeDef>ZR_MENTAL_STATE_CRITICAL_DEF</treeDef>
        </li>

        <li Class="ThinkNode_Subtree">
          <treeDef>ZR_MENTAL_STATE_NON_CRITICAL_DEF</treeDef>
        </li>


So the games applying any MentalBreakDef i make and add under a <ThinkTreeDef> subtree.

The fact the subtrees i attached the mental states to have been renamed from MentalStateCritical>ZR_MENTAL_STATE_CRITICAL_DEF and MentalStateNonCritical>ZR_MENTAL_STATE_NON_CRITICAL_DEF and those are attached to a non-human think tree doesn't seem to mean anything when the game is deciding if it should apply them to human pawns

This weird as hell to me and i think it's coregame side rather then alienrace side