Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Test Subject
Original Poster
#1 Old 18th Apr 2015 at 3:02 AM Last edited by qazxc : 19th Apr 2015 at 4:21 PM. Reason: It's done now :D
Default Maximum and minimum fat range obtainable halved mod ( Solved and download Available)
So I got the Mod working now, thanks a bunch to scumbumbo and Scripthoge.
The mod I uploaded halves the maximum and minimum fatness gainable.
Check out the file at the first page last post.
I increase it beyond the original max and min fat, and I can try and do it for fitness.
Do tell if anyone wants it specifically set.


-------Original----------
Hi. I'm kinda a noob at programming, and I have very little knowledge of the python language...
I could understand a few parts, but not entirely. (And I hope it is allowed to ask about someone else's mod work X/)

I'd like to know what Scripthoge's injector specifically does. Does it allow you to create a new function to be executed in place of the targeted one, or does it simply inject a new function before it executes the targeted one?

I'd like to be sure with it, since I couldn't get my mod working. ><

Thank you for the time )
Advertisement
Deceased
#2 Old 18th Apr 2015 at 7:06 AM
It is intended more for the latter as it saves a "pointer" to the old function (original) that you can then use to call the original function, either before or after you do other things.

And yes, it's perfectly valid to ask questions about other's mods. The majority of us are more than happy to discuss why we do things the way we do. Usually it's just because we're lazy, but sometimes we have reasons
Test Subject
Original Poster
#3 Old 18th Apr 2015 at 7:43 AM
Oh, I get it now... It seems pretty nifty. And since, I don't know much, I'll just go with the injector.

But what about other pieces of codes that call for the original function?
I'm planning to use the injector without calling forth the original. And if I have to avoid the original being called, should I inject another piece of script for those parts?
Or does it directly go to my code?

Thank you very much for explaining to me about the injector.
Test Subject
Original Poster
#4 Old 18th Apr 2015 at 5:48 PM
Sorry for the double post.... and being way too offtopic ><
After days on an attempt on it, switching from xml tuning to python scripting, I made an attempt on using the injector again, and now it seems as if i'm just toying with the previous mod.

I tried doing your suggested latter part, the one with not using the injector.
The attempt doesn't seem to work at all....
(well, It would have been more accurate to detect if the game crashes with wrong python script mod coding)

and then I got back to using the injector. (Utter failure)

What you'll find here is an attempt to decrease the maximum fat physique possible to gain in the game (or at least, the body blend value... And I didn't use subtract, could lead to a negative value X/ )


I had let the original function be called so it processes the script, then I had set physique values to change.

I kept going around in circles. I've bumped on to some things from time-to-time, and yet no luck at all.
Is there another file ingame that wouldn't allow the script to do so? or is it just how badly-written my edit is?

I would definitely be grateful for your help in this.

Oh and
While going through xml files and all, I found lots of nifty stuff.
Like a cheat to change your sims to the maximum/minimum fit or fat physique.
they can be triggered by typing one of these in the console.

the maxfat minfat/ maxfit minfit buffs i found in the xml don't seem to contain much info other than being a buff, being invisible, having an audio file and icon.

There's another set of files I found such as the effects of using the workout machine, or the threadmill, or the zero gravity workout from the rocket.
I have made an attempt to change the fat or fit gain/loss rate when using such normally, or doing it in a different mode like dont break a sweat interaction, and it works, unlike the mod i'm currently trying to work on for days.(driving me insane with all the time spent)
I'll upload it when someone requests for a faster gain or a slower gain on either fat or fit.
Deceased
#5 Old 19th Apr 2015 at 6:13 AM
Well, I'm working on trying to figure out a bug with door locks that never shows up when I'm actually logging what's happening (aint' that always the way), but one problem with the Python injection jumped out at me. You can't access the locals from the original function like you're trying to do in the two lines...
Code:
    physique[sims.sim_info.SimInfo.BodyBlendTypes.BODYBLENDTYPE_HEAVY] = (str(math.trunc(fit*physique_range)/physique_range))/2
    physique[sims.sim_info.SimInfo.BodyBlendTypes.BODYBLENDTYPE_LEAN] = str(math.trunc(lean*physique_range)/physique_range)/2
fit and lean are locals to the original function, so once it returns they are gone.

I haven't really analyzed what you're trying to do, so there may be other problems but that should at least help get back on track. Putting in some lines to log variable contents and progress can really be helpful in this kind of situation, I find myself constantly putting in log lines, "Got here!" and "x = {}".format(x) and such when I'm stuck like that. I do most of my script work in a folder called "Script Testing\Scripts\" in the mods folder, and keep a copy of injector, reload and my logger script in there. If you don't want to write your own logger function, you can use my ScumLog (silly name, I know!) that I posted in an earlier thread: http://modthesims.info/showthread.p...461#post4679461
Test Subject
Original Poster
#6 Old 19th Apr 2015 at 11:32 AM
I really appreciate how you're still sticking with me through this >< You're really awesome and generous to find the time

Quote:
You can't access the locals from the original function like you're trying to do in the two lines. fit and lean are locals to the original function, so once it returns they are gone.

Oh, that explains stuff XD.... Thanks for clearing that part up

Quote:
I haven't really analyzed what you're trying to do,

Oh, my bad, I messed up on some parts of the script which didn't seem logical at all. If it helps, I'm trying to set a smaller range of fat achievable in the game. I couldn't get it right due to my lack of knowledge in programming...
Quote:
Putting in some lines to log variable contents and progress can really be helpful in this kind of situation, I find myself constantly putting in log lines, "Got here!" and "x = {}".format(x) and such when I'm stuck like that. I do most of my script work in a folder called "Script Testing\Scripts\" in the mods folder, and keep a copy of injector, reload and my logger script in there. If you don't want to write your own logger function, you can use my ScumLog (silly name, I know!) that I posted in an earlier thread: http://modthesims.info/showthread.p...461#post4679461

Sorry, I know I'm a real noob at these, but I'm guessing what ScumLog does is get a certain value of the variable being sought for and write it on a log file, right? so i could determine what the value of the variable is?
But where does it place the log file??? (>< I didn't understand the os.path part, but I'll do try to make sense of it so I would know where.)
Oh and I'm kinda cool with the name. I don't find it silly ><
Meanwhile, I found out that the game actually inputs what went wrong with the mod in a file, when the mod is supposed to be triggered in the game. You guys might've known this before, but it's giving me a whole lot more understanding on my stupidity towards typing crappy edits on the mod. The log where the game stores it is somewhere in the sims 4 folder found in my documents (inside electronic arts folder of course). The file's called, "lastException.txt"....

I managed to make some tinkering hither and tither while being guided by the lastException file and got far with this code:

I may consider editing the physique range value (the game's default is really 1000), though that isn't what seems to be the big problem just yet...
The error i'm getting with the code seems to be about str with respect to ____trunc____... I don't really get what "str doesn't define ___trunc___" means >< but it seems
that the script won't make an effect unless this matter is fixed... Any Ideas about it???

Oh yeah, this might help, so, here's the content of the Lastexception file, as I set my sim to max fat:


Again, I'm really thankful for helping me out. Your help means a lot.
Test Subject
Original Poster
#7 Old 19th Apr 2015 at 4:15 PM
Default Whoa If I can't thank you and ScriptHoge enuf!
LOL sorry again for doubleposting
You know, disregard what I said above, cause I got it to work! ><
Took me weeks to study a bit, but, I'm really thanking you for sticking through with me.

What seemed to cause the problem was the math.trunc operation. I know it's for simplifying a value, but as soon as I eliminated it, the mod worked with no error.
My programming skills are weak, and yet all this time X/, it was as simple as that.
I added the local variables from the sim_info which lead to calling the consumable component. (variables called maxfat, maxfit, minfat, minfit called for the commodities in consumable component)
I also made new variables so that I could perform division without making many parentheses which seemed to confuse the system....
And, yeah it seems so that it needs some tweaking for simplification and smoothness' sake, but, well, it works anyway.

Thank you very much. If it weren't for you I wouldn't really have done it.
And, is it necessary to convert it to .pyo? I think I'm doing it wrong.
I did what was written in the pdf file on how to do it,
run python.exe -O, import the file, and get it from ___pycache___
right??
I'll have to look in to it.


So anyways, here's the mod in case you want to have a look in to it. Suggestions on how to simplify it?
They're just .py files, since I dunno how to do them to pyo, though the injector has a pyo.
So what it does is to halve the maximum and minimum gainable fat ingame. And as expected when editing the physique in cas mode, traveling to other places snaps the sim's physique to the maximum fat halved.

I can do the increased fat range as well, and same goes for fit range. This should be very compatible with the cas physique range by (evol_evolved?)
So yeah.
Screenshots
Attached files:
File Type: rar  fatrangedecreaseringame.rar (1.2 KB, 746 downloads) - View custom content
Description: it halves the standard maximum fat and lean limit... thought it is possible to multiply the values for increase. I'll work on that. And it's not zipped so extract it so it would work
Deceased
#8 Old 19th Apr 2015 at 7:14 PM
OK, glad you've had some success, let me explain what is going on...

What the _set_fit_fat function is doing is converting the fat (and fit, but we don't care about that for this) commodity from the range defined in the XML (-100 to 100) to two percentages, heavy and lean, which are the percentage above or below the midpoint. So if the fatness commodity is -48.9248528324, the code will set heavy to 0.0 (since it's below the fat base), and lean to 48.9248528324. If someone changed the commodity to make fatness range from -50 to 50, it wouldn't change the actual displayed fatness/leanness, it would just double the rate at which visible changes occur, as if eating some food added 1 to the fatness commodity it would actually add 2 percent to the visible physique.

The physique_range value (1000) doesn't really control the total range, but how many decimal points are stored into the physique. It takes the 48.9248528324 and multiples by the range to get 48924.8528324, truncates it to 48924, and then divides by the range again to give 48.924. The reason trunc() wasn't working for you is that you set it at the beginning to the value from the physique, which is a string type and you can't trunc() a string.

So you're affecting what the sim looks like, but not changing the tuning for min and max physique, so the buffs for reaching the max and so forth don't require any modification. The true range is still -100 to 100, but you make the physical appearance go from -50 to 50. Seems like a good approach, you just should probably make sure that trunc() works properly to truncate to three decimal places. It probably doesn't make a difference, but the C code may be expecting that to only have three decimals and something may go screwy if it has more than three.

And yes, as you noted in the comment, you probably don't even need to call the original as long as you duplicate everything else it does. Otherwise you're just having to redo the fatness physique after it's already done it once.
Lab Assistant
#9 Old 25th Apr 2015 at 10:58 PM
Quote: Originally posted by qazxc
I can do the increased fat range as well, and same goes for fit range. This should be very compatible with the cas physique range by (evol_evolved?)
So yeah.


That would be really awesome and useful!

Cheers! =D

lkandak
Test Subject
#10 Old 21st Jul 2015 at 5:28 AM
I'm interested in making this mod apply to increased ranges to go with Evol_Evolved's extended slider mod, but I have zero coding experience. How difficult is this to adjust? Would it be worth my time to try to learn all the stuff necessary to attempt this, or would it be like a "You need months of training, stay away n00b" kind of situation?
Lab Assistant
#11 Old 28th Jul 2015 at 9:21 PM
Quote: Originally posted by fudgex02
I'm interested in making this mod apply to increased ranges to go with Evol_Evolved's extended slider mod, but I have zero coding experience. How difficult is this to adjust? Would it be worth my time to try to learn all the stuff necessary to attempt this, or would it be like a "You need months of training, stay away n00b" kind of situation?


Yeah that's what I was thinking would be awesome but I too don't have much experience at modding.

Cheers! =D

lkandak
Test Subject
#12 Old 5th Sep 2015 at 1:43 AM
Quote: Originally posted by qazxc
I can do the increased fat range as well, and same goes for fit range. This should be very compatible with the cas physique range by (evol_evolved?)
So yeah.


Is there any progress on this? I'm very curious to see this happen. Somewhat like that mod made by Consort in the sims 3.
Lab Assistant
#13 Old 22nd Sep 2015 at 3:40 PM
Quote: Originally posted by mrccl98
Is there any progress on this? I'm very curious to see this happen. Somewhat like that mod made by Consort in the sims 3.


Yeah, me too! That would be awesome. Been waiting to find something like this but no luck so far, hopefully someday!

Cheers! =D

lkandak
Test Subject
#14 Old 18th Jan 2016 at 4:30 AM
Quote: Originally posted by fudgex02
I'm interested in making this mod apply to increased ranges to go with Evol_Evolved's extended slider mod, but I have zero coding experience. How difficult is this to adjust? Would it be worth my time to try to learn all the stuff necessary to attempt this, or would it be like a "You need months of training, stay away n00b" kind of situation?


Yeah that would be awesome!!! :D
Test Subject
#15 Old 19th Jan 2016 at 8:44 AM
Default Physique Range Increaser - Just a test, many oddities!
First, let me say I am by no means an expert at this, and beyond modifying a few lines, my troubleshooting abilities are limited.

Still, I can see use in developing such a script as what qazxc has painstakingly wrought into something to complement EVOL_EVOLVED's "Expanded Physique Range (Heavy, Lean, Fit, Bony)" mod.

I have below a zip package that you simply drop in your mods folder that will visibly increase the how big (Fit/Fat) or small (Lean/Bony) Sims can be without "snapping" back to default maximums and minimums. I set it to x1.5 or 50% over default on all categories.

Please be aware there are issues with this:

What I have noticed are when you save or otherwise travel with your Sim, NPC/townie physiques are baselined (reset?, English is not my first language) at their increased ranges and then increased again, meaning that even slightly fit/fat sims will grow to their maximums after a few travels/saves, and thin/bony sims will do the opposite and shrink. This applies to your played household as well: you can test this upon boot of the game by immediately saving. Neutrally balanced Sims will remain the same, while the big get bigger and small get smaller. Probably a deal breaker until fixed, just be aware there are known issues with this as it sits.

I have also noticed that NPCs will "snap back" to the range set in this mod if you save when entering a public lot. Most of them either become tiny or huge eventually. Even outside the range this script defines oddly.

I am guessing that this behavior can be combated by digging into how and where the new physique specified here:

Code:
physique[sims.sim_info.SimInfo.BodyBlendTypes.BODYBLENDTYPE_HEAVY] = str((newheavy*1.5)/physique_range)
physique[sims.sim_info.SimInfo.BodyBlendTypes.BODYBLENDTYPE_LEAN] = str((newlean*1.5)/physique_range)
physique[sims.sim_info.SimInfo.BodyBlendTypes.BODYBLENDTYPE_FIT] = str((newfit*1.5)/physique_range)
physique[sims.sim_info.SimInfo.BodyBlendTypes.BODYBLENDTYPE_BONY] = str((newbony*1.5)/physique_range)


is equated to the actual fit/bony fat/lean set point the Sim is sitting at. In theory this script would just be a flat visible modification only. I'm looking into it currently, but as I've said, my skills are lacking.

The screenshots are to demonstrate the issues you will face using this script.
Step 1: Set Bob Pancakes to two notches above normal fitness and fatness. Set Eliza Pancakes to two notches below normal fitness and fatness.
Step 2: Immediately Save when out of CAS, notice changes?
Step 3: Restart game/travel etc. and immediately save. Notice changes?
Step 4: Restart game/travel etc. and immediately save. Notice changes?
Step 5: ""
Step 6: ""
Step 7: ""
Step 8: "" They are at their minimums and maximums now.
Screenshots
Attached files:
File Type: zip  PhysiqueRangeIncrease50Percent.zip (3.1 KB, 676 downloads) - View custom content
Description: Please be Aware: Many Issues, please read post above!
Lab Assistant
#16 Old 22nd Jan 2016 at 1:46 AM
Quote: Originally posted by df1112
First, let me say I am by no means an expert at this, and beyond modifying a few lines, my troubleshooting abilities are limited....


Whoa, this is awesome! I would definitely try this but I'm guessing from the issues listed it'd probably really mess with all my sims' weight/fitness levels. Are you looking for testers, or are you gonna be updating this mod to not have the saving/traveling issues? I wish I could advise something but I'm a noob at modding :3 Thanks so much for making it though, awesome work!

Cheers! =D

lkandak
Test Subject
#17 Old 22nd Jan 2016 at 8:22 PM
Oooh cool! Fantastic to see someone's working on something like this, really need it in my game!
Lab Assistant
#18 Old 21st Feb 2016 at 10:36 PM
Wondering if anyone's had any luck with something like this...

Cheers! =D

lkandak
Test Subject
#19 Old 8th Mar 2016 at 12:25 PM
Quote: Originally posted by lkandak
Wondering if anyone's had any luck with something like this...


I haven't worked on the fat slider at all but I did increase pretty much everything around it. Bigger Hips and Butt along with more natural breasts. Never could get the legs quite right, but I've given up on that small tweak.

I haven't messed with the fat slider yet, but know to change it using Bone Deltas it's Region 0x0000001C in the CNTX's, but I found with the increases I did to the hips and butt there's not much need for it for my game because they get pretty big anyways.
Attached files:
File Type: zip  More Female Ranges.zip (1.3 KB, 916 downloads) - View custom content
Test Subject
#20 Old 22nd Mar 2016 at 3:54 AM
Default New Updates
Quote: Originally posted by lkandak
Wondering if anyone's had any luck with something like this...


Well I came back to this and I found another function in the extracted sim_info.pyo just above the _set_fit_fat(self) function named: "_get_fit_fat(self):"

It seems just multiplying back through the inversion of the multiple applied in _set_fit_fat(self) fixes the issues I saw before. So the game must call a _get_fit_fat(self), and receives a high (or low) number from the modified physique set in _set_fit_fat(self), then resets the physique at that higher (or lower) number. So including both functions and returning the correct values in _get_fit_fat(self) with the inversion multiple makes sense.

I've tested this a bit on with the latest expansion (Get Together), and it does seem to work without issue.

I would create a new game and test it out yourself or back up your existing game save(s) before you try it out.

I have included 25%, 50%, 75%, 100%, and 200% increase versions of "PhysiqueRangeIncrease," "FitnessRangeIncrease, and "FatnessRangeIncrease." "Physique" includes both Fitness and Fatness range increases, where "Fitness" and "Fatness" are increased alone.

200% is a bit ridiculous and not recommended. Somewhere between 50% and 75% seems to be about maximum for EA's mesh in both fitness and fatness before Sims look especially odd.

If this works for others, I might release it as a mod, and make separate versions for reducing the ranges too. It is pretty simple to change to any value you want. Next step is to at least use variables for the multiples in the code. Meh, it is all in beta for now.

Thank you to qzaxc for doing the bulk of the research, scumbumbo for his support, and Scripthoge for the injector!
Attached files:
File Type: zip  PhysiqueRangeIncrease25Percent.zip (3.4 KB, 209 downloads) - View custom content
File Type: zip  PhysiqueRangeIncrease50Percent.zip (3.4 KB, 364 downloads) - View custom content
File Type: zip  PhysiqueRangeIncrease75Percent.zip (3.4 KB, 573 downloads) - View custom content
File Type: zip  PhysiqueRangeIncrease100Percent.zip (3.4 KB, 559 downloads) - View custom content
File Type: zip  PhysiqueRangeIncrease200Percent.zip (3.4 KB, 908 downloads) - View custom content
File Type: zip  FitnessRangeIncrease25Percent.zip (3.4 KB, 130 downloads) - View custom content
File Type: zip  FitnessRangeIncrease50Percent.zip (3.4 KB, 217 downloads) - View custom content
File Type: zip  FitnessRangeIncrease75Percent.zip (3.4 KB, 327 downloads) - View custom content
File Type: zip  FitnessRangeIncrease100Percent.zip (3.4 KB, 327 downloads) - View custom content
File Type: zip  FitnessRangeIncrease200Percent.zip (3.4 KB, 486 downloads) - View custom content
File Type: zip  FatnessRangeIncrease25Percent.zip (3.4 KB, 159 downloads) - View custom content
File Type: zip  FatnessRangeIncrease50Percent.zip (3.4 KB, 302 downloads) - View custom content
File Type: zip  FatnessRangeIncrease75Percent.zip (3.4 KB, 521 downloads) - View custom content
File Type: zip  FatnessRangeIncrease100Percent.zip (3.4 KB, 504 downloads) - View custom content
File Type: zip  FatnessRangeIncrease200Percent.zip (3.4 KB, 1110 downloads) - View custom content
Lab Assistant
#21 Old 23rd Mar 2016 at 2:42 AM
Quote: Originally posted by df1112
Well I came back to this and I found another function in the extracted sim_info.pyo just above the _set_fit_fat(self) function named: "_get_fit_fat(self):"...


Thank you both! Will test this and see how it goes!

Cheers! =D

lkandak
Test Subject
#22 Old 1st Oct 2016 at 9:35 PM
Has anyone had any luck testing the mod above? And would it be compatible with the current patch/EP too?
Test Subject
#23 Old 11th Dec 2016 at 7:41 AM
The mod doesn't show up in the mods/script box that pops up when you start the game.
Test Subject
#24 Old 8th Jan 2017 at 10:28 AM
Quote: Originally posted by lekiscool
The mod doesn't show up in the mods/script box that pops up when you start the game.


For me it did, you have to put the zipped folder in your mod folder and then it should work, given that you have script mods enabled.
Test Subject
#25 Old 8th Jan 2017 at 10:30 AM
Quote: Originally posted by TheGreenMachine
Has anyone had any luck testing the mod above? And would it be compatible with the current patch/EP too?


I found some issues with the monster under the bed. When I had the mod enabled, the monster appeared and didn't go away even if I had the special light that should prevent the monster from appearing in the first place. You couldn't see it, but it was there since the child sim couldn't go to bed anymore.
Page 1 of 3
Back to top