Jump to content

XML Tuning help: How to make traits gender exclusive, and disabled for NPCs


Recommended Posts

I've been working on a mod and I've hit a bit of a problem.  I noticed that the town generated sims are spawning with some of my custom traits, is there anyway to prevent this from happening?  I know that clothing mods have a disable for random option but I see no such option in the TDESC files for traits.  I have a few idea on how to achieve this through python coding but I'd rather use xml tuning if there is a way.  

 

Next, I wanted to make some of my traits exclusive to one or the other gender.  I saw a way to do this in the previously mentioned trait TDESC file: 

 

<TunableList name="genders" class="TunableSet" display="Genders" muid="F1EE549B88249A63" description="The allowed genders for this trait. If no genders are specified,&#xA;then all genders are considered valid." Deprecated="False" filter="0" group="Availability" unique_entries="true">
    <TunableEnum type="Gender" class="TunableEnumEntry" default="None" muid="D558FE18B6873B0" static_entries="sims-sim_info_types.Gender" Deprecated="False" export_modes="client_binary,server_binary,server_xml" filter="0" group="General" />
</TunableList>

 

so I added: 

 

  <L n="genders">
      <E>FEMALE</E>
  </L>

 

To my Trait Tuning file and:

 

<L name="genders">
    <T type="Int64">8192</T>

</L>

 

to my Sim Data file for the corresponding trait and... well I go into CAS and I can still apply the trait to males.  I got value for what FEMALE is from the decompiled sim_info_types.py file.  I really feel like this is correct and should be working but it's not.  Any ideas on what I'm doing wrong?  Are traits not capable of being gender restricted anymore?  Like maybe they removed this feature when they made all the clothes gender neutral in an update forever ago.  

 

Can anyone help me out? 

 

Edit: A bit of an update. Shortly after typing out this post, I tried to start a new game with a male sim who had the male banned trait, I was pretty surprised to see that the trait was removed from the sim on starting the game without so much as a warning and leaving the male sim with 2 CAS traits instead of the three they normally require.  It's not ideal... but it's almost barely functional.  I worry if whatever system that's generating male npc's in the game will still get assigned this trait only to have it removed leaving them with 1 less trait than the public.  As for the user, this would be a hard stop from them getting the trait on gender-inappropriate sims... I'm still not sure if I want hard lock-out user created sims like this... I'd rather no npc's get my custom traits.  So, while almost functional, and certainly serviceable, I think the right way to go about removing my traits from npcs would be through python coding after all.  I have a few other things I want to work on before I'll have a chance to work on this (first finish debugging and tuning whim objectives to not take more than a sims lifetime to complete, next release a initial version to the public, and then I want to add some more interactions to some objects, use python to fix one of my broken whims, and a few other short milestones for post release) so I'll just use this crude workaround for the time being.

 

I also had the bright idea of adding the male gender trait to the list of blacklisted traits for my custom trait... and, well that didn't work either.  Just a side note incase a future modder that's struggling with this comes along my note. 

Link to comment
  • 11 months later...

Hey @NisaK did you ever work out a way to make this happen?

 

Quote

I'd rather no npc's get my custom traits. 

Found your post through a google search and figured I'd ask. :) Was thinking about the problem of CAS traits and them being applied randomly to npcs and was wondering if anyone figured out a way to restrict it.

Link to comment

Omgosh this is an old post!

On 11/30/2018 at 5:29 PM, Triplis said:

Hey @NisaK did you ever work out a way to make this happen?

 

Found your post through a google search and figured I'd ask. :) Was thinking about the problem of CAS traits and them being applied randomly to npcs and was wondering if anyone figured out a way to restrict it.

Yes I did, it was very very annoying and I did it through python coding instead of tuning.

Link to comment
On 12/3/2018 at 1:46 PM, NisaK said:

Omgosh this is an old post!

Yes I did, it was very very annoying and I did it through python coding instead of tuning.

Haha, yeah. Glad to hear you figured it out! Would you be willing to share the source code? I would like to see if I can do it for some traits of my own. Right now, I'm leaning toward either that or doing the traits as reward store.

Link to comment
  • 10 months later...
  • 2 years later...

Did you ever figure a good workaround? I tried the XML in the original post and having the same results. A trait restricted to male only, can still be selected by females, and after being picked and they load into lot/game, then the traits are removed leaving the sim with missing traits.

 

Also, I see there's a way to have a "NPC only" trait, but there's no "PC Only" trait. Does anyone know if there's a way to stop generated Sims from getting a specific trait?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use