Sims 4: Guides: Difference between revisions
No edit summary |
m Added a warning regarding outdated information |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
< | |||
=Modding Guides(Sims 4)= | {| class="warningbox" | ||
|''Last updated: {{REVISIONMONTH}}-{{REVISIONDAY2}}-{{REVISIONYEAR}}'' | |||
|} | |||
<div class="mw-message-box-warning mw-message-box"> | |||
'''<font color="red">Note</font>: This page contains severely outdated information, especially in regard to script modding and Python script decompilation.''' These guides may or not be updated in the future. | |||
</div> | |||
=Modding Guides(Sims 4)= <!--T:1--> | |||
Here you find the guides for making your own mods to The Sims 4, basically animations and specially WickedWhims. | Here you find the guides for making your own mods to The Sims 4, basically animations and specially WickedWhims. | ||
==Decompile ''.ts4script'' files== | ==Decompile ''.ts4script'' files== | ||
Line 6: | Line 14: | ||
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. | 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=== | ===Requirements=== <!--T:2--> | ||
#[https://www.python.org/download/releases/3.3.3/ Python v3.3.3] | #[https://www.python.org/download/releases/3.3.3/ Python v3.3.3] | ||
#A text editor (Like [http://notepad-plus-plus.org/ Notepad++]) | #A text editor (Like [http://notepad-plus-plus.org/ Notepad++]) | ||
Line 35: | Line 43: | ||
Now you got all your ''.py'' files into your folder, the second ''.bat'' deletes the ''.pyo'' files. | Now you got all your ''.py'' files into your folder, the second ''.bat'' deletes the ''.pyo'' files. | ||
==Converting existing adult WW animations== | ==Mod modding guide== | ||
''By Alec15''<br> | |||
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=== | |||
* [https://www.python.org/download/releases/3.3.5/ Python 3.3.5] | |||
* A text editor ([http://notepad-plus-plus.org/ Notepad++]) | |||
* [https://github.com/figment/unpyc3/raw/master/unpyc3.py unpyc3.py] | |||
* [https://github.com/rocky/python-uncompyle6 uncompyle6] | |||
* [https://github.com/aliansi/Easy-Python-Decompiler-v1.3.2 Easy Python Decompiler] | |||
* Comparison tool ([http://winmerge.org/ 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) | |||
* Make sure your windows shell (cmd og ps) uses UTF-8 (unpyc3 won't work on the some files if the stdout is not UTF-8) | |||
* Create an uncompyle3.bat file to use for decompilation. Save it somewhere where you can find it again. It should contain the following: | |||
<pre> | |||
@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 | |||
</pre> | |||
* Create an uncompyle6.bat file to use for decompilation. Save it somewhere where you can fin it again. It should contain the following: | |||
<pre> | |||
@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 | |||
</pre> | |||
===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: <pre>python -O -m compileall .\</pre> | |||
* Rename the files in the newly created "__pycache__" folder: <pre>dir | rename-item -NewName ($_.name -replace ".cpython-33", "")</pre> | |||
* Open the .ts4script with you unarchiver and replace the files you have just compiled. | |||
==Converting existing adult WW animations== <!--T:3--> | |||
''By Alec15'' <ref>ATF: [https://allthefallen.moe/index.php?/topic/5724-sims-4%C2%A0whickedwhims/#entry185533 Alec15]</ref> | ''By Alec15'' <ref>ATF: [https://allthefallen.moe/index.php?/topic/5724-sims-4%C2%A0whickedwhims/#entry185533 Alec15]</ref> | ||
<!--T:4--> | |||
This is a tutorial for converting existing WW animations into child animations. | This is a tutorial for converting existing WW animations into child animations. | ||
<!--T:5--> | |||
If you want to create animations from scratch, follow TURBODRIVERs tutorial on the original WW page. | If you want to create animations from scratch, follow TURBODRIVERs tutorial on the original WW page. | ||
You can use the rigs provided here. | You can use the rigs provided here. | ||
<!--T:6--> | |||
Below are two methods for converting animations. The first uses normal rigs, and the second uses IK rigs. | 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. | The IK rig method is faster and gives good results, but can be a bit tricky. | ||
Line 49: | Line 182: | ||
This tutorial is meant as a starting point for conversions. | 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 | It wont give you a finished conversion, you will have to fiddle with the adjustments until you like them | ||
===Requirements=== | ===Requirements=== <!--T:7--> | ||
* Basic knowledge of Blender | * Basic knowledge of Blender | ||
* Basic knowledge of the Dope Sheet, F-Curve Editor and Keyframes. See [http://wickedwhims.tumblr.com/post/145448014836/tutorials TURBODRIVER's Tutorial] | * Basic knowledge of the Dope Sheet, F-Curve Editor and Keyframes. See [http://wickedwhims.tumblr.com/post/145448014836/tutorials TURBODRIVER's Tutorial] | ||
* [https://www.blender.org/download/ Blender] | * [https://www.blender.org/download/ Blender] | ||
* [http://sims4studio.com/thread/1523/downloading-sims-4-studio Sims 4 Studio] | * [http://sims4studio.com/thread/1523/downloading-sims-4-studio Sims 4 Studio] | ||
* | * Edited animator's rigs (You can inquire them in the ATF WW Mods or Sims 4 General Discussion topics on the Forums.) | ||
<div class="mw-collapsible mw-collapsed"> | <div class="mw-collapsible mw-collapsed"> | ||
===Method 1=== | ===Method 1=== | ||
<div class="mw-collapsible-content"> | <div class="mw-collapsible-content"> | ||
Line 94: | Line 225: | ||
#Repeat for every additional actor in the complete animation. | #Repeat for every additional actor in the complete animation. | ||
<!--T:8--> | |||
''You should now have a Scene in Blender for each actor.'' | ''You should now have a Scene in Blender for each actor.'' | ||
<div class="toccolours mw-collapsible mw-collapsed"> | <div class="toccolours mw-collapsible mw-collapsed"> | ||
Line 100: | Line 232: | ||
''I'm using TURBODRIVERs builtin animations from WW here'' | ''I'm using TURBODRIVERs builtin animations from WW here'' | ||
<!--T:9--> | |||
The complete cowgirl animation consists of: | The complete cowgirl animation consists of: | ||
<!--T:10--> | |||
*TURBODRIVER_cowgirl_1_male.blend | *TURBODRIVER_cowgirl_1_male.blend | ||
*TURBODRIVER_cowgirl_1_female.blend | *TURBODRIVER_cowgirl_1_female.blend | ||
<!--T:11--> | |||
#Open TURBODRIVER_cowgirl_1_male.blend | #Open TURBODRIVER_cowgirl_1_male.blend | ||
#Append TURBODRIVER_cowgirl_1_female.blend\Scene\Scene | #Append TURBODRIVER_cowgirl_1_female.blend\Scene\Scene | ||
Line 118: | Line 253: | ||
**If you are going to use an child female, append the Edited Child Female Rig. | **If you are going to use an child female, append the Edited Child Female Rig. | ||
|} | |} | ||
====Exchanging Rigs and Animations in Blender==== | ====Exchanging Rigs and Animations in Blender==== <!--T:12--> | ||
{| style="background-color:#f8f9fa; border: 1px solid #eaecf0;" | {| style="background-color:#f8f9fa; border: 1px solid #eaecf0;" | ||
| | | | ||
Line 193: | Line 328: | ||
</div> | </div> | ||
<div class="mw-collapsible mw-collapsed"> | <div class="mw-collapsible mw-collapsed"> | ||
===Method 2=== | ===Method 2=== <!--T:13--> | ||
<div class="mw-collapsible-content"> | <div class="mw-collapsible-content"> | ||
====Exporting Animations==== | ====Exporting Animations==== | ||
Line 214: | Line 349: | ||
*You might want to turn off the eye controllers, if the eyes look all weird.<br/>''You can do this by digging down in the rig in the outliner to the b__L/R_Eye__, b__L/R_LoLid__ and b__L/R_UpLid__ and disable (eye button in the Bone Constraints) the Copy Rotation''. | *You might want to turn off the eye controllers, if the eyes look all weird.<br/>''You can do this by digging down in the rig in the outliner to the b__L/R_Eye__, b__L/R_LoLid__ and b__L/R_UpLid__ and disable (eye button in the Bone Constraints) the Copy Rotation''. | ||
<!--T:14--> | |||
*The IK rigs have IK chains in the spine, neck, head, jaw, arms and legs. From the clavicle to the hand and thigh to foot. | *The IK rigs have IK chains in the spine, neck, head, jaw, arms and legs. From the clavicle to the hand and thigh to foot. | ||
{| style="background-color:#f8f9fa; border: 1px solid #aaa;" | {| style="background-color:#f8f9fa; border: 1px solid #aaa;" | ||
Line 287: | Line 423: | ||
*Save! | *Save! | ||
|} | |} | ||
====Turning you animation into a WW animation==== | ====Turning you animation into a WW animation==== <!--T:15--> | ||
Same as [[#Turning you animation into a WW animation | Method 1]] | Same as [[#Turning you animation into a WW animation | Method 1]] | ||
</div> | </div> | ||
</div> | </div> | ||
==References== | ==References== | ||
Latest revision as of 18:06, 2 September 2023
Last updated: 09-02-2023 |
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)
- Make sure your windows shell (cmd og ps) uses UTF-8 (unpyc3 won't work on the some files if the stdout is not UTF-8)
- 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 animator's rigs (You can inquire them in the ATF WW Mods or Sims 4 General Discussion topics on the Forums.)
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