#4

6th Jan 2026 at 7:15 PM
Last edited by zoisims : 7th Jan 2026 at
1:43 AM.
success in applying a coat to offspring
Freakinggggg awesome sauce, I managed to hook the foal coat change into the birth event. Mom having triplets was completely unplanned, but excellent for debugging.

From here, it's just tweaking my horse_rollcoat function.
Things of note:
I used TURBODRIVER's injector, which can be found
here . My implementation code frame was this:
Code:
# INJECTOR FRAMEWORK
from TURBODRIVER_Injector import inject (injector code is in TURBODRIVER_Injector.py)
import sims4.log
import sims4.commands
import services
from sims.pregnancy.pregnancy_tracker import PregnancyTracker
@inject(PregnancyTracker, 'create_sim_info')
def _myfunction(original, _, *args, **kwargs):
sim_info = original(_, *args, **kwargs)
try:
# if birth succeeded...
except Exception as e:
sims4.log.exception("Injection", "pregnancy_tracker.create_sim_info injection for EGO failed to run.", exc=e)
return sim_info (or result of original function)
I'm not sure if I can use xml injector for this, rather than TD's injector. TD's injector works, but its because i included it as a script in the compiled file, and I'd like to not have to do that.
I don't fully understand the whole of how this works yet. My understanding is that the injector tells the code that, when create_sim_info in PregnancyTracker is called, that hey, check this out instead. And then sends over myfunction, which has the same structure as the function its replacing. First, it executes the original function. Then, it tries my own code, logging an error if something goes awry.
However, what I suspect is that this code doesn't take into account twins or triplets, thus making identical twins impossible. Regardless, I'd like to handle identical offspring differently anyway. Realistically, white markings are genetic but their actual expression is random. So I'd like to make twins with the same base coat but different white markings, along with the chance of an identical twin.
What I think I know is that the game handles offspring genetics by a randomized seed in offspring_data. Same seed, same baby, every time. I think.
For now, I am going to go for the vanilla mechanic of monozygotic siblings having the same coat, and tweak their expression later.
** NOTE FOR SELF: I'll want to implement a personal layer max, as well as a reasonable pattern removal protocol, so I don't accidentally bloat generations of pelt layer lists with dozens of patterns from the add/replace mechanic.
What's also been useful for me is using the cheat console to debug where stuff failed.
Code:
# SEND MESSAGE TO CHEAT CONSOLE
def cheat_notif():
client = services.client_manager().get_first_client()
if client:
# client.id is the connection ID!
sims4.commands.CheatOutput(client.id)("Message")
Second note: in the future, along with this mod I'd like to make a horse game function overhaul, as well. For one, I'd like to handle horses so that they do not take up slots in the active household. The idea being, you could run a 10+ horse farm(if your PC could handle it) but only have your favorite horse(s) in your household.
LittleMsSam does this
here. But, its not quite applicable to me, because pets dont give birth on your lot. For a breeding farm, that sux, but I'm very sure there's a good reason LMS did it that way.
I've brainstormed some alternate options, such as tracking horses in a different household and telling them to come to your lot. Then, when horses are competing or pregnant, they are added to your household, and when these actions are completed, they are removed. With MCCC's max household limit coming in handy. Alternatively, and I have no idea if this would work yet and wont for a while because I dont have For Rent, I believe For Rent allows multiple households to live on the same lot. Making a household of just horses could be the move. But, I'd like to minimize pack requirements. If I did, I'd have a base-r game version available first, with additional functionality for For Rent and BH (for making the household sim in the horse household an employee of your stable business...)
But of course, that's a future endeavor.
NOW:
- verify gathered info from parent horses
- design simple horse_rollcoat logic to swap colors
- implement monozygotic offspring chance
LATER:
- mix patterns
- prevent layer bloat somehow