Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Scholar
Original Poster
#1 Old 2nd Feb 2023 at 11:30 AM
Default Issues with custom trait creation
Hi, I'm trying to learn how to make a custom trait. I'm looking at Arsil's Japanese culture trait mod to learn but I am having issues. I'm also interested in creating a tutorial for custom trait creation.


Code:
namespace EnhancedWitchTraitCreator
{
    

    public static class Instantiator
    {
        [Tunable]
        internal static bool kInstantiator;

        public const ulong kFamiliarAnimalTrait = 0xCE63FA104F2423BC;

        private static XmlDbData mXdb;

        static Instantiator()
        {
            mXdb = XmlDbData.ReadData("PuddingFace_EnhancedWitches_Traits");
            UIManager.NewHotInstallStoreTraitsData += AddTraits;            
        }



        public static void AddTraits(ResourceKey[] resourceKeys)
        {
            
            TraitManager.ParseTraitData(mXdb, true);
            
        }

    }
}



And this is my PuddingFace_EnhancedWitches_Traits xml file

Code:
<?xml version="1.0"?>
<traits>

 <TraitList>
  <Name></Name>
  <Description></Description>
  <Hex></Hex>
  <CodeVersion></CodeVersion>
  <AgeSpeciesVisible></AgeSpeciesVisible>
  <SetNumbers></SetNumbers>
  <Points>0</Points>
  <RandomWeight>0</RandomWeight>
  <Category></Category>
  <CommodityName></CommodityName>
  <FacialIdle></FacialIdle>
  <AutonomousDesiredCommodity></AutonomousDesiredCommodity>
  <AutonomousAvoidedCommodity></AutonomousAvoidedCommodity>
  <IncreasedEffectiveness></IncreasedEffectiveness>
  <ReducedEffectiveness></ReducedEffectiveness>
  <xMin></xMin>
  <DesireMin></DesireMin>
  <xMax></xMax>
  <DesireMax></DesireMax>
  <Decay></Decay>
  <Predicate></Predicate>
  <CanBeLearnedRandomly>TRUE</CanBeLearnedRandomly>
  <IntimacyLevel>10</IntimacyLevel>
  <ActiveTopic></ActiveTopic>
  <PreferredBookGenre></PreferredBookGenre>
  <ThumbFilename></ThumbFilename>
  <ThumbPieMenu></ThumbPieMenu>
  <ThumbDislikePieMenu></ThumbDislikePieMenu>
  <ThumbPose></ThumbPose>
  <AddListenerFunction></AddListenerFunction>
  <TraitTipDescription></TraitTipDescription>
  <TraitTipIndex></TraitTipIndex>
  <TraitToolTipText0></TraitToolTipText0>
  <TraitToolTipText1></TraitToolTipText1>
  <TraitToolTipText2></TraitToolTipText2>
  <TraitToolTipText3></TraitToolTipText3>
  <CanBeLearnedThroughConversation>True</CanBeLearnedThroughConversation>
  <LifetimeRewardCategory>Other</LifetimeRewardCategory>
  <ReinforcableAxis></ReinforcableAxis>
  <ReinforcableThreshold></ReinforcableThreshold>
  <ReinforcableOppositeTrait></ReinforcableOppositeTrait>
  <OccultsTypesValidForTrait>All</OccultsTypesValidForTrait>
  <Version>1.0</Version>
 </TraitList>

<TraitList>
  <Hex>FamiliarAnimalTrait=0xCE63FA104F2423BC</Hex>
  <CodeVersion>BaseGame</CodeVersion>
  
  <Category>None</Category> <!-- Category of the trait; None (hidden), Social, LifeStyle, etc -->
  <CanBeLearnedRandomly>False</CanBeLearnedRandomly>
  

<!-- STBL's Keys, prefix "Gameplay/Excel/traits/TraitList:" -->
  <Name>AnimalLover</Name>
  <Description>AnimalLoverDescription</Description>

<!-- Availability -->
  <AgeSpeciesVisible>AllDogs,Cats,Horses</AgeSpeciesVisible> <!-- self explanatory -->
  <AllowedOnRobots>False</AllowedOnRobots> <!-- self explanatory -->

<!-- Icons: these strings fnv64 hashed must be the instance id of the IMAG resources -->
  <ThumbFilename>trait_lover</ThumbFilename> <!-- big icon -->
  <ThumbPieMenu>trait_lover_s</ThumbPieMenu> <!-- small icon -->
  <ThumbDislikePieMenu>trait_lover_crossedout</ThumbDislikePieMenu> <!-- icon when you can't choose the trait -->


<!-- STBL's Key is still "Gameplay/Excel/traits/TraitList:"  -->
  <TraitTipDescription>AnimalLoverDescription</TraitTipDescription> <!-- trait description -->
  <TraitToolTipText0>AnimalLoverDescription</TraitToolTipText0> <!-- when you hover on the trait, list entry -->
  <TraitToolTipText1>AnimalLoverDescription</TraitToolTipText1> <!-- when you hover on the trait, list entry -->
<!-- MAX 4 tooltips -->
 </TraitList>
</traits>


I am creating a very simple trait right now for testing.
I can't understand what I am doing wrong.

One thought I had while making this thread was that maybe because I am using the descriptive text(STBL) for animal lover trait. And that came with Pets I should change <CodeVersion>BaseGame</CodeVersion> to pets pack. I'm going to try that next. Hopefully that will work. But if anyone else has any insight please do let me know.

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Advertisement
Scholar
Original Poster
#2 Old 2nd Feb 2023 at 11:56 AM
Unfortunately changing to EP5 didn't help. Don't understand the problem

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Field Researcher
#3 Old 4th Feb 2023 at 2:10 AM
Hello Pudding, I worked with traits before for a "adult" script mod that I made for the sims 3 sometime in December. I would recommend looking at this tutotrial if you haven't already as it has helped me a ton when it came to making custom traits. Arsi'ls Custom Trait Tutorial The tutorial is within the description. Also have you downloaded Arsils custom trait manager? I noticed that in your XML file, you did not include <CustomTraitsManager> </CustomTraitsManager>. Which has made me ask the question if you had downloaded it. Additionally, for my adult mod that I created with traits I did not include these lines of code which you had included in your Instantiator class.
Code:

public const ulong kFamiliarAnimalTrait = 0xCE63FA104F2423BC;

static Instantiator()
        {
            mXdb = XmlDbData.ReadData("PuddingFace_EnhancedWitches_Traits");
            UIManager.NewHotInstallStoreTraitsData += AddTraits;            
        }
 
 
 
        public static void AddTraits(ResourceKey[] resourceKeys)
        {
            
            TraitManager.ParseTraitData(mXdb, true);
            
        }

This was my main portion of my Instantiator class for my mod that included custom traits. Which did not include a method to load in the custom traits. I believe Arsils custom trait manager loads them for you as long as you write the XML file correctly.
Code:
 public static class Instantiator
    {
        [Tunable]
        internal static bool kInstantiator = false;

        private static EventListener sSimInstantiatedListener;

        private static EventListener sSimAgedUpListener;
        static Instantiator()
        {
            sSimAgedUpListener = null;
            sSimInstantiatedListener = null;
            World.OnWorldLoadFinishedEventHandler += new EventHandler(OnWorldLoadFinished);
            LoadSaveManager.ObjectGroupsPreLoad += OnPreLoad;
        }

        public static void OnPreLoad()
        {
            new BuffBooter().LoadBuffData();
        }

I will share how my custom traits XML file looks like. I'll shorten it by just including one of the custom traits.
Code:
<?xml version="1.0"?>
<CustomTraitsManager>

<!-- ###############  TRAITS DEFINITIONS ############## -->

<!-- This is not here just for reference, it's needed for a successful parsing -->
<TraitList> <!-- row #0 -->
	<Name></Name>
	<Description></Description>
	<Hex></Hex>
	<CodeVersion></CodeVersion>
	<AgeSpeciesVisible></AgeSpeciesVisible>
	<SetNumbers></SetNumbers>
	<Points>0</Points>
	<RandomWeight>0</RandomWeight>
	<Category></Category>
	<CommodityName></CommodityName>
	<FacialIdle></FacialIdle>
	<AutonomousDesiredCommodity></AutonomousDesiredCommodity>
	<AutonomousAvoidedCommodity></AutonomousAvoidedCommodity>
	<IncreasedEffectiveness></IncreasedEffectiveness>
	<ReducedEffectiveness></ReducedEffectiveness>
	<xMin></xMin>
	<DesireMin></DesireMin>
	<xMax></xMax>
	<DesireMax></DesireMax>
	<Decay></Decay>
	<Predicate></Predicate>
	<CanBeLearnedRandomly>TRUE</CanBeLearnedRandomly>
	<IntimacyLevel>10</IntimacyLevel>
	<ActiveTopic></ActiveTopic>
	<PreferredBookGenre></PreferredBookGenre>
	<ThumbFilename></ThumbFilename>
	<ThumbPieMenu></ThumbPieMenu>
	<ThumbDislikePieMenu></ThumbDislikePieMenu>
	<ThumbPose></ThumbPose>
	<AddListenerFunction></AddListenerFunction>
	<TraitTipDescription></TraitTipDescription>
	<TraitTipIndex></TraitTipIndex>
	<TraitToolTipText0></TraitToolTipText0>
	<TraitToolTipText1></TraitToolTipText1>
	<TraitToolTipText2></TraitToolTipText2>
	<TraitToolTipText3></TraitToolTipText3>
	<CanBeLearnedThroughConversation>True</CanBeLearnedThroughConversation>
	<LifetimeRewardCategory>Other</LifetimeRewardCategory>
	<ReinforcableAxis></ReinforcableAxis>
	<ReinforcableThreshold></ReinforcableThreshold>
	<ReinforcableOppositeTrait></ReinforcableOppositeTrait>
	<OccultsTypesValidForTrait>All</OccultsTypesValidForTrait>
	<Version>1.0</Version>
</TraitList>

<!-- From here on, we can define our custom trait or traits (it's fine to define more than one) -->

<TraitList> <!-- row #1 -->
<Hex>MonocoDoll_BigDickTrait=0x2AFE2A3E0757D9FB</Hex>

<CodeVersion>BaseGame</CodeVersion>
<Category>RewardMisc</Category>

<Name>MonocoDoll_BigDickTrait</Name>
<Description>MonocoDoll_BigDickTrait_desc</Description>
<Predicate>MonocoDoll_BigDickTrait_pre</Predicate>
<TraitToolTipText0>MonocoDoll_BigDickTrait_ttt0</TraitToolTipText0>
<TraitToolTipText1>MonocoDoll_BigDickTrait_ttt1</TraitToolTipText1>
<TraitToolTipText2></TraitToolTipText2>
<TraitToolTipText3></TraitToolTipText3>

<ThumbFilename>MonocoDoll_BigDick</ThumbFilename>
<ThumbPieMenu>MonocoDoll_BigDick_pie</ThumbPieMenu>
<ThumbDislikePieMenu>MonocoDoll_BigDick_dislike</ThumbDislikePieMenu>

</TraitList>

<!-- ############### FILTERS DEFINITIONS ############## -->

<!-- This is not here just for reference, it's needed for a successful parsing -->
<RequiredTrait>	<!-- row #0 -->
	<Name></Name>
	<InteractionName></InteractionName>
	<ObjectName></ObjectName>
</RequiredTrait>

<!-- From here on, we can define RequiredTrait filters -->


<!-- This is not here just for reference, it's needed for a successful parsing -->
<ExcludingTrait> <!-- row #0 -->
	<Name></Name>
	<InteractionName></InteractionName>
	<ObjectName></ObjectName>
</ExcludingTrait>

<!-- From here on, we can define RequiredTrait filters -->



</CustomTraitsManager>

I hope this points you in the right direction. If you have any questions let me know, and I will do my best to help you out. If you wish to look at my mod with custom traits as a reference, you can find it at LoversLab.
Scholar
Original Poster
#4 Old 5th Feb 2023 at 10:33 AM
@MonocoDoll thank you so much for your help. I was trying to create a trait without the trait loader by studying Arsil's Japanese culture trait. That's why no trait loader and custom trait tag.

I was hoping to create more complicated traits in the future with its own commodity kind. And the trait loader seems to be more simple but now it looks like I have to use the trait loader. Or I can just avoid trait and use a persistable dictionary or list instead.

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Senior Moderator
staff: senior moderator
#5 Old 5th Feb 2023 at 3:29 PM
Have you seen SimMX's hypochondriac trait on Simlogical? That might help figuring out how to load it and everything
Inventor
#6 Old 6th Feb 2023 at 10:53 PM
I can't help, but I want to learn this. I'd like to be able to make some custom pets traits. (I really do stuff other than pets too I swear). Pets traits behave differently from human traits, though. Also, if you're looking for topics for tutorials (lol), I would love you if you did something on custom commodities. I've never gotten one to work.

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Back to top