A downloadable mod

Download NowName your own price

[20 jul 2021 - this mod will no longer be tested on patches, but I will provide support for anyone who's still using it until it breaks]

(Scroll down a bit for a step-by-step guide - I can also answer questions in the comments here if you're having trouble, since this is more of a tool than a mod.)

I'm back again and running on (two? three?) a few straight days of coding to get this mod working! It is free but any donations/pledges on patreon are hugely appreciated, things are not going well, but uh anyway

Why are trait IDs changing? Basically, the Snowy Escape patch (..which I still haven't updated to, but nothing here is specific to a patch so that won't affect this) caused issues with any traits with 64bit IDs (the ID number can go up to 2^64 - 1), so creators are replacing these with 32bit IDs (ID can go up to 2^32 - 1). However, this means you have to manually re-apply these traits to all sims, since the game counts a different ID as a different trait. Or... you can use this mod!

What does this mod actually do? This only does the work for identifying 64bit ID traits and replacing these on all sims for you - you have to get the new versions of traits yourself! I can't decide new trait IDs since that's the creator's decision, though if you have a trait that is no longer being updated and all you need for that is a new 32bit trait ID, look at this tutorial from zero: https://www.patreon.com/posts/tutorial-custom-31937410 (and after making a new version of that trait, you can then use this mod to replace all instances of the old trait). I have tested this but I wanted to get it out quickly to help people, so I might have missed something - please let me know if there are any issues. The .txt file included basically just has the info here without all the extra background and rambling.

What else might I need to know? Please BACK UP YOUR SAVE, and make sure you do not remove the old trait files before starting, since the information on which sim has which trait will be lost, and my mod won't be any help. Also, this mod will create one new file in the same folder as the .ts4script, called 64bit_traits.json, which keeps a list of sim IDs and traits that have 64bit IDs, so the mod knows which ones to replace. When you update this file, it will only remove sim-trait pairs from the list that have been replaced in game (by this mod) - if you have multiple saves, you'll want to move this elsewhere when you try to replace traits in another save, since this file is specific to one save only. Once you're happy that you've taken out all 64bit traits and replaced them with 32bit traits, you can delete it.

Step-by-step guide:

- start the game and load into a lot
- open the console with ctrl+shift+C
- run 64bit to get the lists of 64bit and 32bit personality traits, and output these lists to the console (i struggled a bit accessing the localised strings, and the display name of a trait might be repeated anyway, so this is.. not formatted beautifully. despite this, it should be clear enough)
- run 64bit_export to make the file 64bit_traits.json in the same folder as the .ts4script - this will contain a list in the form [[sim_id, trait_name, old_trait_id],...], where the sim with sim_id has the trait trait_name with 64bit ID old_trait_id. it looks like this:


- quit the game (saving is optional, because nothing has changed in the game)
- replace old file(s) in your Mods folder with the new file(s)
- reload the game and run 64bit again
- run 64bit_replace again. this will go through all of the entries in the .json file, and if it encounters one with the same name as a trait with a 32bit ID, then it will apply that 32bit ID to the sim
- run 64bit_export again to update 64bit_traits.json
- play the game! if you find any more updated traits later, just redo this section from the start

How does it decide which traits are the same? What do I do if it doesn't identify the two versions as the same trait? This mod decides if two traits are the same by looking at their name within the game, but there are two workarounds for this: the first is a separate command with which you just enter two trait IDs, for the old trait to remove and the new trait to add. For every sim that had the trait with the first ID (and this info is saved in the .json file), it will add the trait with the second ID to that sim.

- enter 64bit_replace_id 1234 5678, where 1234 is the old ID and 5678 is the new ID.
- all sims with trait with ID 1234 will have it replaced by the trait with ID 5678
- if the old trait is not in the game but you have a .json file that says that sim had the trait with ID 1234, then they'll gain trait with ID 5678 - you'll want to run 64bit_export again in this case to update it afterwards
- save and quit
- remove old versions of replaced traits if you still have them in your Mods folder

The other workaround is just changing the trait name in the .json file to the new trait name! There's an extra command - 32bit_export - which is the exact same as creating a new 64bit_export file except it does the 32bit ones instead. This comes in handy for seeing the trait name (<class 'sims4.tuning.instances.TRAITNAME'>) and the new ID for use in either of these workarounds.

Note for source code/translations: I've included the .py file (source code) for anyone looking to see how this works - this file is NOT needed to use this tool, but it can be used if you're curious about how this works (I know I've been learning from other people's code on my modding journey) - just... don't copy entire functions and pretend you wrote them, please! There is no string table as the mod is purely script, but if you want to translate it, you can change the strings in the .py file and send it back to me with the language and the name you want to be credited with! It can be opened in any text editor (I use PyCharm, but you can literally just edit it in Notepad), and just hit CTRL+F and search for "output('". Replace any text within '' on these lines (nothing outside of these!), making sure that if you have an apostrophe within the string you enter \' instead of just ' (this tells the mod to read this as an apostrophe and not the start/end of a string), and that you keep the same number of {} brackets (these tell the code where to put the first/last/trait name).

(credit to Cupidjuice for the traits template that I used in the pic, it's the only bit that doesn't give off 'graphic design is my passion' vibes)

Download

Download NowName your own price

Click download now to get access to the following files:

riv_trait_helper.ts4script (the mod) 3.4 kB
riv_trait_helper how to use.txt (basically the description above) 3.8 kB
riv_trait_helper.py (source code) 10 kB

Comments

Log in with itch.io to leave a comment.

Error: 'NoneType' object has no attribute 'sim_info': when this came up in my game, it was because one of my sims was culled between making the .json file and replacing the trait. I managed to locate the entry in the list that was an issue by searching for the last trait that was replaced (since sim-trait pairs are grouped by trait), finding the entry that has that trait and a sim ID that isn't in the game, and just deleting that entry.

It's kind of a bodge honestly, so if this issue keeps coming up for others I can try to write a bit more code to find these and remove them?

(1 edit)

For updating ATICAS - Eunola has taken on the task of keeping this updated over at https://theofficialeunola.myportfolio.com/all-traits. Every name has been updated to (for example) Eunola_trait_Expressionistic, whereas before it would've been just trait_Expressionistic, so to reapply traits that are part of ATICAS, I recommend doing the following (this is basically just the workaround I put in the description above, but for sorting out all of the ATICAS traits at once):

  • make the .json file as above
  • replace old ATICAS files with the new files
  • load up the game again and enter 64bit
  • check if there are any 64bit ID traits in that list where the name is of the form "<class 'sims4.tuning.instances.trait_TRAITNAME>"
  • open up the .json file, and find and replace ".trait_" with ".Eunola_trait_" (without the "", and it's worth putting the . at the start so that it doesn't affect other trait names with trait_ in them somewhere) - you can click replace all if there were no traits in the list above, but if there were, then just be careful not to replace those
  • run 64bit_replace followed by 64bit_export
  • ATICAS is now sorted!
(+1)

Thank you so much for this. Your efforts are appreciated more than you know.

(+1)

This comment just made me so so happy, thank you! <3