|
Post by andrew on Apr 12, 2018 22:48:59 GMT -5
This tutorial has been deprecated by the 11/13/2018 patch. Please see the new tutorial HERE.
|
|
|
Post by orangemittens on Apr 13, 2018 6:37:10 GMT -5
Thank you for sharing this helpful tutorial!
|
|
|
Post by AdonisPluto on Apr 14, 2018 2:08:57 GMT -5
Way to go. I have to soon start leaving how to mod my game too. Hoping I have the head to do this. Thanks for the tutorial
|
|
|
Post by Basemental on Jun 18, 2018 3:18:36 GMT -5
Thanks a bunch for this andrew. Previously I have done my scripts in Notepad++, after this tutorial (and an online tutorial course in Python 3) I have managed to clean up the code quite a bit.
One part I especially like about this is the compiler, and that it compiles the entire folder. I do however have an issue with it that I am struggling to figure out that I would love some help on. I was uncertain if I should post it here or the Creators Help section, but seeing that this is strictly in relation to PyCharm and how that is set up, I reckon this is the smarter place to post it.
My issue is that whenever the game throws an LE due to some broken mod, a lot of times injectors from mods that actually are working perfectly are included in the LE. This is not really a problem per se, as this can be used to my advantage in a way, as I renamed the Mods folder with my scripts "My Mod Name v1.3.2" for instance, so when the LE is thrown and my mod is mentioned it will also show the version, this helps me out when someone shows me or the guys over at MCCC suport on Discord an LE as we can instantly see the version number of my mod.
However; due to how the compiler is set up it also lists the entire filepath with os.path so it shows in the LE like (example) C:/Folder/Folder/Folder/Folder/Folder/Folder/Folder/My Mod Name v1.3.2/filename.py I have been trying for hours to make it only show the last folder and filepath so the LE's would only show ./My Mod Name v1.3.2/filename.py
I have tried changing os.path.dirname with os.path.basename(os.path.normpath without really getting this to work, all it does for me is throw errors when trying to compile. I would really love to figure this one out, so if anyone has a good explanation on how to fix it I would be eternally grateful.
|
|
|
Post by andrew on Jun 18, 2018 20:49:54 GMT -5
Hey Basemental, I haven't tried in game, but it looks like what you would want to change is this line: zf.writepy(folder)
to something like zf.writepy(folder,mod_name)
The optional basename parameter in the compile script is not specified, and the default behavior is to use the full path. Setting it to the mod_name would be just the root folder of your mod, which may be what you want.
|
|
|
Post by Basemental on Jun 19, 2018 1:41:33 GMT -5
Thanks, andrew! I'll try it out. Last night I tried several different approaches that were pretty close to that in zf.writepy, but this sounds logical. I'll give it a go and let you know if it works or not.
|
|
|
Post by Basemental on Jun 19, 2018 2:18:34 GMT -5
That didn't really work. But then again, my compile module doesn't look exactly like this. Instead of the self:PyZipFile,pathname,basename: str"" it is simply: When I tried rewriting it over to how it looks at your end it gives me multiple errors. I also tried just adding mod_name as the second parameter in zf.writepy without adjusting the zf code, but that didn't yield any results either. In any event I found a quick workaround to the issue, albeit not ideal, but it works. I just drag the entire folder to C: root, delete the pycache and compile from there. At least then I only get a couple folders in the LE's, not 10 of them.
|
|
|
Post by lynnem on Jul 5, 2018 20:44:35 GMT -5
Thanks so much for this easy-to-follow tutorial!
I was doing fine till I got to the end and went to compile the script. I run compile.py and I get this. Anyone have any thoughts on what I'm doing wrong? TIA!
I should add that I can see the Utilities folder, and the compiler.py file with compile_module.
C:\Python33\python.exe "C:/Users/lmalc/OneDrive/Documents/Modding/Sims 4 Python Script Workspace/My Script Mods/Example Mod/compile.py" Traceback (most recent call last): File "C:/Users/lmalc/OneDrive/Documents/Modding/Sims 4 Python Script Workspace/My Script Mods/Example Mod/compile.py", line 1, in <module> from Utilities import compile_module ImportError: No module named 'Utilities'
Process finished with exit code 1
|
|
|
Post by Flerb on Jul 6, 2018 23:08:37 GMT -5
fantastic thank you!
|
|
|
Post by andrew on Jul 8, 2018 13:53:53 GMT -5
Hi lynnem, this may be due to the way that you opened the PyCharm project. Make sure to open the folder directly. If you open the folder above it, it will still open, but it won't use the configuration that was included in the project file and will require additional steps to get the scripts to run. In this picture, the left side shows what it should look like, and the right shows what it could look like if you opened the folder above the main folder.
|
|
|
Post by lynnem on Jul 8, 2018 17:48:21 GMT -5
Thank you, Andrew! I'll give it a try.
ETA: That was the problem, I'd opened the folder that contained the Workspace folder, one level up. When I opened the Workspace folder itself, I was able to compile the script. Thanks again for the help!
|
|
|
Post by Greenbunnie on Jul 17, 2018 19:22:27 GMT -5
So I'm generally a person who screws up everything that can be screwed up. I cannot tell you how many hundreds of hours I have accidentally deleted from multiple games. Will extracting the files for the demo project, permanently change the game files and thus put me at risk of making the game essentially implode? My hope is to essentially make changes and tinker and explore without risk of damaging the game files themselves.
|
|
|
Post by andrew on Jul 17, 2018 22:34:15 GMT -5
Greenbunnie none of the steps in this tutorial will modify your game installation files. Extracting will read files in your game and create new files in the place you have the project. Compiling will read the files from your project and create a new file in your mods folder. At no point will any files in your game's installation folder be modified.
|
|
|
Post by Greenbunnie on Jul 18, 2018 19:40:27 GMT -5
Greenbunnie none of the steps in this tutorial will modify your game installation files. Extracting will read files in your game and create new files in the place you have the project. Compiling will read the files from your project and create a new file in your mods folder. At no point will any files in your game's installation folder be modified. Thank you I didn't think it would, but I just wanted to be 100% sure. You do awesome stuff
|
|
|
Post by ilikesunshine on Jul 29, 2018 21:12:15 GMT -5
Heya,
First of all I wanted to say thanks! This made it really easy for me to do my first ever mod and even more importantly to understand the python structure of Sims4 commands. I just wanted to help any Mac users out by posting the changed paths. It took me forever to find the game folder. (Not least bc there is an Origin thread with a wrong answer :/) In the settings.py file replace game_folder = with game_folder = os.path.expanduser(os.path.join('~','Applications','The Sims 4.app')) In the decompile_all.py replace the gameplay_folder_data variable with gameplay_folder_data = os.path.join(game_folder, 'Contents','Data', 'Simulation', 'Gameplay') I also commented out these two lines: #gameplay_folder_game = os.path.join(game_folder,'Game', 'Bin', 'Python') #extract_folder(ea_folder,gameplay_folder_game)
This is because I could not find the folder (gameplay_folder_game = os.path.join(game_folder,'Game', 'Bin', 'Python')). Which files are in this folder? I found the three zip files (base, core,simulation), however my generated folder is empty (I assume bc I am missing the second path). Nonetheless after making the above changes, the tutorial worked for me.
Best, Lisa
PS: I hope this is the right place to post this.
|
|