Replies: 16 (Who?), Viewed: 927 times.
Lab Assistant
Original Poster
#1 Old 27th Jul 2020 at 8:43 PM
Default Idea - creating alternative adoption system
This is more a speculation about possibilities than a question, but I was wondering - has anyone tried making an alternative child protective services system, more like the TS2 one where kids taken by the social worker still exist in the neighborhood? I had the idea of using certain categories of sims' households as group homes or foster homes (sims in a certain career/profession, maybe) and writing scripts to add sims to those households when needed and transfer them out if they age up to independence or someone takes custody of them. Children and below getting taken by the social worker when their needs get too low could be circumvented by using a tuning mod or NRaas Retuner to set the threshold that triggers the social worker so low it's impossible to get there, and it might be possible to prevent children from being taken when the last adult in the household dies if I can find a way to make an event listener that transfers the children to a group/foster home fire before the social worker is summoned to take them. I'd have to test it. If it works those changes should effectively disable the child-disappearing standard child protective services system, and replace it with one that keeps kids in the world and can be adjusted to include teens and allow things like temporary foster care, or voluntarily surrendering a child to the system, or regaining custody of a child once the parent's situation improves.

I think I'm going to try this as a break from other mods I'm working on, just to see if it works.
Advertisement
Lab Assistant
Original Poster
#2 Old 28th Oct 2020 at 6:32 AM Last edited by lizcandor : 29th Oct 2020 at 3:20 PM.
This works in a very basic form! Automatically adding all children in a household to a different household from a register of households participating in the system - and removing them from the original one, you have to do both - when their last adult guardian dies does prevent them from being taken by the social worker. Seems like the reason is that the social worker is called to a specific household, and if that household has been destroyed because all its members were removed from it and placed elsewhere, then there's nothing for the social worker to do anymore. And setting impossible hunger/social/heat/cold thresholds keeps the social worker from being summoned for neglect.

So that first proof of concept is a success! Also, having looked deeper into the social worker code while trying to figure out how to escape them, I think it's possible to cancel EA's response to neglect on a case-by-case basis without changing any tuning (by running Houshold.ResetSocialWorkerTrigger() - that method removes the alarm on a household that will call the social worker if the children's needs remain dangerously low), which could be useful for flexibility.
Lab Assistant
Original Poster
#3 Old 6th Dec 2020 at 8:49 PM
New information! The household-switching trick is also able to create households without any teen or older humans in them without ending the game, since the no-adult-humans-left game over seems to only ever be triggered through the SocialWorkerChildAbuseSituation that's assigned to a household when its last adult dies - I haven't tested long enough to be sure doing this doesn't cause corruption or anything, but it seems to be working so far for creating both child-only and animal-only households. So this is an option for anyone wanting to totally eliminate the social worker.
Forum Resident
#4 Old 6th Dec 2020 at 10:28 PM
I don't really know how the social worker stuff works internally, but quite often these scenarios work with an alarm that triggers the social worker to show up and route to your house and such things.

If it works that way, you could write a script that checks the alarm manager every few hours if an alarm for a social worker has been scheduled, delete it from the alarm manager and/or create your own alarm instead. Maybe even mimic the entire scenario from your own (mostly copy pasted) code.

It would require some research to find out if this is possible. A starting point would be to provoke the scenario you want to highjack and use Nraas Debug Enabler to generate a log of the alarm manager (by clicking on a sim/nraas/debugenabler/options sim/dump alarms), then poking around in the log if you find something social worker related.

Another vector could be the event of type kChildTakenBySocialWorker. Did you play with it and find out when exactly it triggers?

Find my Mods: Here at MTS, over at Simlogical
Lab Assistant
Original Poster
#5 Old 6th Dec 2020 at 11:41 PM
Yeah, alarms are how it works! I learned about that while I was making my imitation-social-worker service. Service situations are really a pain to read

I've been using kSimDied as my trigger instead of kChildTakenBySocialWorker - I don't think I ever tried kChildTakenBySocialWorker, since it sounded like it would happen too late to save the sims, but the kSimDied event gets sent before the GrimReaperSituation it comes from even checks to see if it should create a SocialWorkerSituation to pick up the children and pets left behind. Which, now that I think about it, might mean that no SocialWorkerSituation is ever created, instead of one being created and then destroyed along with the household? Huh.
Forum Resident
#6 Old 7th Dec 2020 at 12:08 AM
It is possible to hijack those alarms or at least spy on them - once you have a handle or string or something to identify them in the alarm manager.

Events usually transmit the event.Actor and event.TargetObject. Find out what those are. It could be the perfect vector to find out which child is taken away and preserve the Sim.

Also... are the children destroyed completely or are they in some sort of dead state? One of the Nraas mods has some code to revive dead sims. You see how little experience I have with the entire scenario.

Find my Mods: Here at MTS, over at Simlogical
Lab Assistant
Original Poster
#7 Old 7th Dec 2020 at 12:33 AM
Babies and toddlers get destroyed (and whoever wrote that code was having too much fun naming things ), but children seem to just get added to the homeless household. So they're recoverable, but from what I've read on the NRaas forums it sounds like they're at risk of being deleted at any random time.

I've actually succeeded at saving them though! I check for sims who need to be saved on kSimDied, and then move them into some other household in my system (if there's one with room) and send my new service to pick them up and drive them to the new lot like a very official-looking taxi. Or (as of today's edits) make them into a new adult-less household living on the same lot as before, if there isn't anywhere to put them. Either way, those sims continue existing as playable sims living on a lot in the world, although that opens up other questions like "what to do about bills" and "can a child raise a baby/toddler".

...and also "have I corrupted these households by messing with them like this "
Instructor
#8 Old 7th Dec 2020 at 12:57 AM
Do I understand properly that the social worker is called on the kSimDied event? And you can put a listener on that event and do something instead of letting the social worker be called? It's that simple?

That would be awesome

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Lab Assistant
Original Poster
#9 Old 7th Dec 2020 at 1:17 AM
Not quite - the social worker is called by service requests through GrimReaperSituation.DeathCheckForAbandonedChildren and Urnstone.CheckForAbandonedChildren. GrimReaperSituation.ReapSoul.FinalizeDeath, one of the last steps of the reaper's ReapSoul interaction, calls Urnstone.FinalizeSimDeath, which calls Urnstone.CheckForAbandonedChildren and also sends a kSimDied event (so maybe I was wrong before about kSimDied firing before the social worker service request is initiated). Then ReapSoul.FinalizeDeath calls GrimReaperSituation.DeathCheckForAbandonedChildren a little later, which seems kind of redundant since they do basically the same thing in the same conditions, but what do I know.

...that explanation probably makes less sense than the actual code

But the result of this is (or seems to be, things could be going sideways in a way I've just failed to detect so far) that if I have a listener for kSimDied that does something to the household the actor of kSimDied belonged to that invalidates the game's attempt to call a social worker to that household, like removing all the children and pets and destroying the household, the social worker just never shows up.

Or, if you only want some sims to be taken and not others, you can just leave the ones you're not trying to save as members of the original household and they'll be taken while the ones who were removed are left alone - I did that accidentally back at the beginning of this.
Instructor
#10 Old 7th Dec 2020 at 1:55 AM
This thread has me wondering if something like manually putting children up for adoption is feasible. We have an option to do that for pets, but not Sims. That would be interesting for multiple scenarios.

You have been chosen. They will come soon.
Lab Assistant
Original Poster
#11 Old 7th Dec 2020 at 2:04 AM
It doesn't go through the same UI as the game normally uses for adoption, but I've got that working in the project I've been researching all this for - if you wanted it to go through the normal adoption UI though, maybe there's a household of sims eligible for adoption or something that you could add sims from an ongoing game to?
Instructor
#12 Old 7th Dec 2020 at 2:29 AM
I'd say it's whatever works with the least amount of headaches and is functional, lol.

Could something like having a Social Services (or whatever you want to call it) option on the phone among the other options work? So it'd be like a standard phone option instead of actually being tied to the services menu where the regular adoption option is.

Then, you could have a "Put Child Up for Adoption" option, followed by a Sim Picker menu of active household members Child and younger. Then a confirmation menu (Are you sure you want to place X up for adoption?). After that, the social worker comes and picks them up, and they're added back into the available pool of adoptions, however that's handled.

This is all from a layman's perspective, none of that may be feasible lol. But it seems like a good way to handle it without trying to hook it directly to the adoption system as a whole.

You have been chosen. They will come soon.
Instructor
#13 Old 7th Dec 2020 at 3:35 AM
I think I follow.

So it sounds like you're only trying to preempt the social worker with families where the last adult died? Or is this just the situation you're currently working on.

My situation is going to through motive distress, so that's what I need to figure out.

Ah, well!

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Lab Assistant
Original Poster
#14 Old 7th Dec 2020 at 4:09 AM
I'm circumventing the social worker both when sims are orphaned and when they're neglected - I just haven't written many notes on the neglect situation since it's been less of a struggle.

Are you trying to keep pets from getting taken when their hunger is low right now? I've got some code snippets that might be useful if you are, but I don't want to dump a bunch of information you already know or don't actually need on you.

@Jathom95 I'm glad that's what you want to see, because that's all I could figure out how to do I'm using Battery's script utility, way easier than trying to get into the real adoption UI.
Instructor
#15 Old 7th Dec 2020 at 4:55 AM
I'm working on some mods around playing stray cats. I'd like cats to die of starvation rather than being picked up by a social worker. I also don't want the social worker to turn up for social needs, but I think I know how to do that.

My plan has been to intercept the pets before the social worker is summoned and call Grim. The question is how best to detect when they're in motive distress. I can test the sim to determine whether its below the social worker threshold, but I think it's possible to set an alarm. I haven't learned how to do that yet.

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Lab Assistant
Original Poster
#16 Old 7th Dec 2020 at 5:11 AM Last edited by lizcandor : 7th Dec 2020 at 2:17 PM.
When I was looking at starvation deaths, it seemed like the easiest way to do that was to replace the Starving (or StarvingPet, for animals) buff with a custom version, since that way you don't have to constantly monitor sims to check if they're below the threshold - the buff will get added as normal. You can replace a buff by running this on world load (credit goes to PuddingFace for showing me how):
Code:
BuffManager.BuffDictionary.TryGetValue(13271263770231523504uL, out BuffInstance value); // ulong is original buff
ulong key = Convert.ToUInt64("0xE1DE7D4E570EF9FF", 16); // hex is new buff
BuffManager.BuffDictionary.TryGetValue(key, out BuffInstance value2);
if (value != null && value2 != null)
{
	BuffManager.BuffDictionary[13271263770231523504uL] = value2.mBuff.CreateBuffInstance();
}
You can make a Starving buff that's the same as the regular one except that when it's added it creates an alarm that will make the sim starve when it fires; in my tests so far, that works fine except for some minor weirdness (sometimes sims reset mid-death, or freeze when the buff is added to them - haven't figured out why yet).

The alarm handle can go in the BuffInstance for the buff, like how SpreadFireAlarmHandle is in the BuffInstance for the OnFire buff; and the starvation alarm callback can probably go anywhere, and just needs to imitate the parts of the Motive.MotiveDistress method's hunger/thirst case that pets can't normally reach.
Instructor
#17 Old 7th Dec 2020 at 9:18 PM
This is great. I didn't realize it was possible to replace buffs like that, but it makes perfect sense looking a the code.

Thanks for the tip. This is a huge help.

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Back to top