Home | Download | Discussion | Help | Site Map | New Posts | Sign in

Latest Site News

2018 MTS Calendar Contest - posted on 12th Nov 2017 at 8:48 PM
Replies: 8 (Who?), Viewed: 2097 times.
Lab Assistant
Original Poster
#1 Old 9th Feb 2017 at 1:14 AM
Default Excluding certain life stages from using a trait?
I'm pretty sleepy right now, so maybe there's something obvious I'm missing. I've been using Zerbu's Mod Constructor tool to see what I can design, while I try to learn the code itself.

I have a trait I put together with the tool that I'd like to make exclusive to Teens. He doesn't have such an option in the tool, but he does have an option for "Teen and Above," so I figured if I generate the files and then edit this part:

Code:
<L n="ages"> <E>TEEN</E> <E>ADULT</E> <E>ELDER</E> <E>YOUNGADULT</E> </L>


To this:
Code:
<L n="ages"> <E>TEEN</E> </L>


Maybe that'll do it. No such luck. In testing it, the trait was still available to YA/Adult/Elder.

So I'm assuming there's some other bit of code going on that makes this happen. Intuitively, it makes no sense to me that in changing that line as I did, it overtly did nothing. I would think it would break something at the very least (granted, I didn't test the trait in gameplay after making that change... only checked if it was available in CAS). And I noted that in the Mod Constructor option that generates for "YA and Above," Teen was missing from that line in the code. So clearly it's a factor, but maybe not the factor.
Advertisement
Site Helper
#2 Old 9th Feb 2017 at 4:47 PM
I don't play Sims 4, but I was wondering if sims lose traits when they age? If not, then having a trait that would be unavailable to a sim past a certain life stage would seem problematic unless that sim never ages.

I am Ghost. My husband is sidneydoj. I post, he downloads, and I wanted to keep my post count.
Group for Avatar Makers* Funny Stories *2016 Yearbook
Lab Assistant
Original Poster
#3 Old 9th Feb 2017 at 7:01 PM
Quote:
Originally Posted by Ghost sdoj
I don't play Sims 4, but I was wondering if sims lose traits when they age? If not, then having a trait that would be unavailable to a sim past a certain life stage would seem problematic unless that sim never ages.

It's a thought. It did occur to me that maybe the tech isn't in there to handle losing a trait when you age up (with the exception of special cases like toddlers, who have their own set of traits).

I hope that's not the case, as that would throw a bit of a wrench in what I was aiming for.
Instructor
#4 Old 10th Feb 2017 at 9:07 PM
What type of trait is it? Personality or other type like reward or hidden ??
Not enough info !!!
Can you post the package so it can be looked up, the code you pasted is incomplete.
Any trait can survive age progress, if we want.
Any trait can be conflicting with any other, if we want.
Lab Assistant
#5 Old 10th Feb 2017 at 9:16 PM
I'm still a beginner myself so maybe it doesn't work... But what if you blacklist all ages other than teen ? (I'd be interested to know for myself too)
Lab Assistant
Original Poster
#6 Old 11th Feb 2017 at 5:02 PM
Quote:
Originally Posted by Candyd
I'm still a beginner myself so maybe it doesn't work... But what if you blacklist all ages other than teen ? (I'd be interested to know for myself too)

I'm not even sure how to go about blacklisting, tbh.

Quote:
Originally Posted by azoresman
What type of trait is it? Personality or other type like reward or hidden ??
Not enough info !!!
Can you post the package so it can be looked up, the code you pasted is incomplete.
Any trait can survive age progress, if we want.
Any trait can be conflicting with any other, if we want.

It's Personality, Lifestyle, a trait that shows up in CAS.

Here's a quick package file I put together. This was generated by MC in the same way as the other one, with the "Personality - Teen and Above" setting. It should be identical in terms of the age availability code (and less cluttered to look through since it has no actual trait features added to it). Should be that the only difference for the age code between it and what I posted in my OP, is I didn't manually edit it with a package editor and edit that line about ages.

http://www.mediafire.com/file/2tu47...ndAbove.package
Lab Assistant
Original Poster
#7 Old 12th Feb 2017 at 12:01 AM Last edited by CardTaken : 12th Feb 2017 at 12:20 AM.
After doing some comparing of files, I'm thinking what I'm missing is I need to edit the associated data file for the part of the trait that pertains to its base structure, like age, trait type, etc.

It would make sense, given this from the XML how-to (http://modthesims.info/t/537976):
Quote:
In some cases changes to the corresponding DATA file have to be made in addition to tuning the XML (specifically if there are fields in the tdesc marked as client_binary and/or server_binary). This is often the case when things have an UI component. You can use velocitygrass' DATA file tool for that; look for the DATA with the same instance as the XML.

The appearance of the trait in CAS would probably be considered a UI component.

So now, assuming I'm on the right track, I just have to figure out how to actually edit the data file properly. Hopefully this will be sufficient to point me in the right direction: http://www.modthesims.info/showthread.php?t=531876

EDIT: I figured it out. Woot! Discovery, learning. :D

For those who might be following along and are curious as to what I did. It went roughly like this once I figured out what to do:

I opened the package generated by MC in S4PE. I then extracted what was, in this case, the first XML and first DATA file. The XML file is the one that has the line in it like what I put in the OP. I then removed all but the ages I wanted in the XML file (again, like in the OP... that first part I had right). The part I was missing was then using velocitygrass's Data file tool, as linked in this post, to open the necessary data file. It had a list of elements under the name "age:"

Using a different generated file as a reference point and some guesswork, I deleted every element in there, save for 0x0000000000000008, which I can only assume corresponds to the teen life stage.

Then I used the replace function in S4PE to replace my XML and Data file with the edited versions. Saved the package, put it in mods folder, etc.

And boom, trait is now exclusive to teen.
Instructor
#8 Old 12th Feb 2017 at 2:26 AM
Quote:
Originally Posted by CardTaken
I'm not even sure how to go about blacklisting, tbh.


It's Personality, Lifestyle, a trait that shows up in CAS.

Here's a quick package file I put together. This was generated by MC in the same way as the other one, with the "Personality - Teen and Above" setting. It should be identical in terms of the age availability code (and less cluttered to look through since it has no actual trait features added to it). Should be that the only difference for the age code between it and what I posted in my OP, is I didn't manually edit it with a package editor and edit that line about ages.

http://www.mediafire.com/file/2tu47...ndAbove.package

Got it all figured out.
I have done a new (not actually new) but with it's unique Icon and exclusively for teens, when ageing up it will be removed, or even in CAS if you change age it will be removed as well.
I don't know the programs you have used, I just use a text editor and a package tool to package all the resources.
I will take a closer look at your package which is incomplete and could not work.
I've spent some time sorting out things because I had never done a trait before so I had to investigate one that comes with the game and study it's operators.
Teens can't be Ambitious, so what better than making a new trait just for teens
In the end, everything works just as I've coded it to work.
Go ahead and study what I have done, and don't forget who gave you the knowledge to make your future traits.
Attaching the trait in a rar file.
Let me know how you development goes.
If you have any problems let me know.
Download - please read all instructions before downloading any files!
File Type: rar ambicious_trait.rar (3.1 KB, 14 downloads) - View custom content
Description: don't change it's name or it wont work
Lab Assistant
Original Poster
#9 Old 15th Feb 2017 at 7:08 PM
Quote:
Originally Posted by azoresman
Got it all figured out.
I have done a new (not actually new) but with it's unique Icon and exclusively for teens, when ageing up it will be removed, or even in CAS if you change age it will be removed as well.
I don't know the programs you have used, I just use a text editor and a package tool to package all the resources.
I will take a closer look at your package which is incomplete and could not work.
I've spent some time sorting out things because I had never done a trait before so I had to investigate one that comes with the game and study it's operators.
Teens can't be Ambitious, so what better than making a new trait just for teens
In the end, everything works just as I've coded it to work.
Go ahead and study what I have done, and don't forget who gave you the knowledge to make your future traits.
Attaching the trait in a rar file.
Let me know how you development goes.
If you have any problems let me know.

Thanks! As you can see above, I got it figured out (at least for now). But thank you for the solution. I will take a look at it, as I'm curious what approach you used.
Back to top