Forum Discussion
11 years ago
The missing line calls the injector, and tells it what function to replace in the system.
Part of my problem here is I have it decompiled, have read it, and want to share it and encourage it's use. But I haven't been in contact with the author, or found a decompiled 'free to use' version - so it'd be a bit bad form to post it up. The best I can say is to decompile that mod (use the unpy3 script - not a generic Python decompiler) and see how they did it/try to learn from it. Alternatively you could contact the creator.
I'd love to be able to post up a working example, but just haven't had enough time to focus on this to write my own, but thought it'd be worthwhile posting my thoughts/what I did know at least :)
Nevermind, I found the .py version. Check out the author's ('scripthoge') mods at http://modthesims.info/download.php?t=534028
Included are uncompiled .py files which include his injector and an example mod showing usage as well, I'll paste a little here to show you how it works:
import sims.sim_info
import injector
@injector.inject_to(sims.sim_info.SimInfo, "_set_fit_fat")
def my_set_fit_fat(original, self):
# backup fat
// mod does stuff here
# call original
original(self) <--- NB, it's calling the original function we are replacing here, no need to overwrite Maxis code
# rollback fat
// mod makes final changes here
His approach is what I'd recommend. If he had overwritten sim_info.py (or in your case buff.py) then any other mod wanting to do the same, or any additions/adjustments from Maxis would conflict. This method just edits the little bit you need to - and you could have multiple mods working on the same object.
About The Sims 4 Mods & Custom Content
Find expert tips, troubleshooting help, tutorials for mods and custom content, and The Sims 4 patch files in our forum.15,625 PostsLatest Activity: 9 hours ago
Community Highlights
Recent Discussions
- 5 hours ago
- 9 hours ago
- 9 hours ago
- 9 hours ago