Sims 4: Guides: Difference between revisions
Line 97: | Line 97: | ||
* Unarchive the .ts4script file | * Unarchive the .ts4script file | ||
* Make 2 copies of the new unarchive folder (append them with something like .unpy3 and .unpy6) | * Make 2 copies of the new unarchive folder (append them with something like .unpy3 and .unpy6) | ||
* In your .unpy3 folder place a copy of uncompyle3.bat and run it | * In your .unpy3 folder place a copy of uncompyle3.bat and run it | ||
* In your .unpy6 folder place a copy of uncompyle6.bat and run it | * In your .unpy6 folder place a copy of uncompyle6.bat and run it | ||
* Make a copy of the .unpy3 folder (change the suffix to something liked .merged) | * Make a copy of the .unpy3 folder (change the suffix to something liked .merged) | ||
* Go though the files in your .merged folder and delete all the files you do not intend to change. | * Go though the files in your .merged folder and delete all the files you do not intend to change. |
Revision as of 19:41, 3 September 2017
Modding Guides(Sims 4)
Here you find the guides for making your own mods to The Sims 4, basically animations and specially WickedWhims.
Decompile .ts4script files
These are simply a .zip format file containing a python script mod, renamed to .ts4script. So, to open it, just rename the file to ".zip" and extract.
You will find compiled ".pyo" files, in order to be modified you may need to decompile those. Finally you'd be able to edit them, than compile and archive again.
Requirements
- Python v3.3.3
- A text editor (Like Notepad++)
- This python script (unpyc3.py).
Steps
@echo off for /r %%i in (*) do unpyc3.py "%%i" > %%i.py pause
for /r . %%i in (*.pyo) do del "%%i" for /r . %%i in (*.pyo.py) do ren "%%i" "%%~ni" for /r . %%i in (*.pyo) do ren "%%i" "%%~ni.py" pause
|
Now you got all your .py files into your folder, the second .bat deletes the .pyo files.
Mod modding guide
By Alec15
This is a short description of the method I use to decompile (and recompile) (script) mods.
It is not meant to be a complete step-by-step guide, where you are guaranteed to end up with a working result.
Every mod is different, and this is an outline of the process to get you on the right track and highlight the possible obstacles.
I wont be going into details about individual steps, since I assume, that if you are capable of modding a script, you are also capable of completing these steps on your own.
Requirements
- Python 3.3.5
- A text editor (Notepad++)
- unpyc3.py
- uncompyle6
- Easy Python Decompiler
- Comparison tool (WinMerge)
- The mod you want to mod
Initial process
This is done once to set everything up.
- Install python
- Install text editor
- Install comparison tool
- Install Easy Python Decompiler
- Put unpyc3.py and uncompyle6.py in your C:\Python33 folder.
- Associate the .ts4script file type with you unarchive utility (7-zip in my case)
- Create an uncompyle3.bat file to use for decompilation. Save it somewhere where you can find it again. It should contain the following:
@echo off rem Batch file to decompile TS4 Python code with unpyc3 rem rem Place in folder, you want to decompile rem echo Decompiling base folder PYO files. Press any key to start. pause for /r %%f in (*.pyo) do ( echo Decompiling %%f python C:\Python33\unpyc3.py "%%f" > "%%~dpnf.py" del "%%f" ) echo Done
- Create an uncompyle6.bat file to use for decompilation. Save it somewhere where you can fin it again. It should contain the following:
@echo off rem Batch file to decompile TS4 Python code with uncompyle6 rem rem Place in folder, you want to decompile rem echo Decompiling base folder PYO files. Press any key to start. pause for /r %%f in (*.pyo) do ( echo Decompiling %%f uncompyle6 "%%f" > "%%~dpnf.py" del "%%f" ) echo Done
Decompilation process
- Download the mod you want to mod
- Make a copy of the folder (append the name with something like .org). Steps below this will be in this folder unless otherwise indicated.
- Unarchive the .ts4script file
- Make 2 copies of the new unarchive folder (append them with something like .unpy3 and .unpy6)
- In your .unpy3 folder place a copy of uncompyle3.bat and run it
- In your .unpy6 folder place a copy of uncompyle6.bat and run it
- Make a copy of the .unpy3 folder (change the suffix to something liked .merged)
- Go though the files in your .merged folder and delete all the files you do not intend to change.
- Use your comparison tool to compare (first) the .merged and (second) the .unpy6 folders.
- Use the comparison process below to merge changes into the .merged folder
- Do a recompilation test described below.
- Copy the whole .org folder (change the suffix to something like .working). Steps below this will be in this folder unless otherwise indicated.
- Delete the unarchived folder, the .unpy3 and the .unpy6 folders.
- Now you can start working on the files in the .merged folder. You will always have working copies of the original to fall back to.
Comparison process
This is not a step-by-step process. You have to go through all the files, which have differences and look through each difference and decide which is the better option.
In my experience:
- unpyc3 will always decompile a script
- uncompyle6 will decompile between 50-80% and does a better job
- Easy Python Decompiler will decompile between 10-50% and does a decent job
When having all 3 decompilations of a file, it will give you more confidence in which version is correct, since 2 of them will most likely agree.
Since unpyc3 always decompiles I use this as the base and add in any changes from the other decompilations. The problems I have encountered most often in uncpy3:
- Will swap some if statements for while statements
- Will insert while true loops
- Will swap some continue for pass
- Will sometimes not decrease indentation for some if statements
- Will sometimes state globals twice
These aren't the only issues, but if none of the other versions decompiled properly, you need to search through the file by hand and find these kind of problems and correct them.
Recompilation test
This is done to make sure that your decompilation process has worked and you can safely start changing the mod. If you skip this step and you get an exception later after adding your own changes, you wont know where it came from. You wont know if it is your changes, or bad decompilation. In my experience it's often bad decompilation.
- Follow the steps in the Recompilation process below, using the .org version and not the .working version.
- Place the resulting mod in you mods folder and start The Sims 4.
- Test the mod and confirm that all features (your are going to work with) are still working.
- Confirm that the mod doesn't crash and leaves no exception files.
- If your are experiencing problems, use the exceptions to go through the Comparison process again.
- Repeat this test until it works
I don't use Easy Python Decompiler unless I have to, since it's very cumbersome to use and often fails. It does however sometimes help to find problems with certain files.
- In your .org folder, make a new copy of the unarchived folder (append it with something like .easy)
- In the .easy folder, use Easy Python Decompiler on the files you are working on.
- Delete all other files in the .easy folder except the ones you have decompiled.
- Use your comparison tool to compared (first) the .merged and (second) the .easy folders.
- Use the comparison process to merge changes into the .merged folder
Recompilation process
Once you are done with your changes in the scripts, follow this process to recompile your newly modded mod.
- Open a Powershell in the .merged folder.
- Compile your scripts:
python -O -m compileall .\
- Rename the files in the newly created "__pycache__" folder:
dir | rename-item -NewName ($_.name -replace ".cpython-33", "")
- Open the .ts4script with you unarchiver and replace the files you have just compiled.
Converting existing adult WW animations
By Alec15 [3]
This is a tutorial for converting existing WW animations into child animations.
If you want to create animations from scratch, follow TURBODRIVERs tutorial on the original WW page. You can use the rigs provided here.
Below are two methods for converting animations. The first uses normal rigs, and the second uses IK rigs. The IK rig method is faster and gives good results, but can be a bit tricky. If you don't know what IK rigs are, I suggest using the first method.
This tutorial is meant as a starting point for conversions. It wont give you a finished conversion, you will have to fiddle with the adjustments until you like them
Requirements
- Basic knowledge of Blender
- Basic knowledge of the Dope Sheet, F-Curve Editor and Keyframes. See TURBODRIVER's Tutorial
- Blender
- Sims 4 Studio
- Edited Male Rig
- Edited Female Rig
- Edited Child Male Rig
- Edited Child Female
Method 1
Exporting Animations
|
You should now have a .blend file for each actor in each animation. Make working copies of each, so that you can always revert to the original, if you make a mistake later on. |
Importing rigs into Blender
Each complete WW animation has a .blend file for each actor. If the original mod creator has been orderly with the naming you should easily, be able to recognise which files make up a complete animation. |
You should now have a Scene in Blender for each actor. Example I'm using TURBODRIVERs builtin animations from WW here The complete cowgirl animation consists of:
You need to import the rigs for all the actors you want in your final animation.
|
Exchanging Rigs and Animations in Blender
|
You should now have all the actors you need for your final animation in the top Scene.
|
You should now have your actors in one scene with the original animations applied. |
Manipulating Animations
|
Turning you animation into a WW animation
|
Method 2
Exporting Animations
Same as Method 1
Importing rigs into Blender
|
Exchanging Rigs and Animations in Blender
Same as Method 1
Manipulating Animations
Once you have done all the rough changes using the procedure above, you can adjust the details of the rig using IK.
Example (you have keyed two extremes and the first frame):
Example (you have keyed several similar extremes and the first frame):
|
Turning you animation into a WW animation
Same as Method 1
References
- ↑ TheSims: How to make and edit pyo files
- ↑ ModTheSims: How to change the simulation clock speed by changing maxis scripts
- ↑ ATF: Alec15