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!
Lab Assistant
Original Poster
#1 Old 27th Nov 2017 at 4:38 PM
Default How to inject a new "npc" on the lot?
I plan to create a new "npc", which will be a kind of nanny who took care of the babies in the park, and I wanted to know how do I create a ts4script to inject these new npcs (caregiver and babies) in the park. Thank you!
Advertisement
Deceased
#2 Old 27th Nov 2017 at 11:38 PM
Unless I'm quite possibly missing something in your intent here, it seems like it'd be easier to just create a situation (if memory serves me right) in XML. Wouldn't think there'd be any need for a script as it's all new custom stuff and it wouldn't conflict with any other mods?
Lab Assistant
Original Poster
#3 Old 28th Nov 2017 at 3:09 AM Last edited by arkeus17 : 28th Nov 2017 at 5:48 AM.
I want to know how to do, something like the mod "Janitors on Community Lots", cause i want too make a "fix" and add dogs and cats walking in another neighborhood without edit the "walkby" xml to avoid any conflict with other mods, in the "Janitors on Community lots" Wearbesu add a janitors in the existing lots, without edit the original files.

EDIT: And the conflict may can happens, because i want add the "nannies" already at the existing park

EDIT²: I've been tried first in the more easy one, I create a new "walk by" (for dogs and cats), and now i want to import those "schedules" to the existing "walkby", I know that the instance of those existing walkby is these following: (34110, 113843, 104017, 40722,40725, 74038, 40805, 40729, 40727, 108880, 35906, 38941, 36780, 40335, 40442, 74043, 40436, 40803, 40431, 36089, 120137, 120135, 120136, 119915, 114748, 113451, 39038, 152177, 134174, 134172, 134171, 134173, 115834, 123317, 123319, 122801, 123318, 129740, )

So, how can i creat a inject to add the new "schedules" to those instances?

Sorry if you didn't get this, my english isn't good yet :/
Deceased
#4 Old 28th Nov 2017 at 7:49 PM
Quote: Originally posted by arkeus17
Sorry if you didn't get this, my english isn't good yet :/

Good enough I think I can see what you're driving at. You want to patch up the existing walkby tuning to add situations to the hourly schedule in a way that doesn't conflict with other mods, and you're right that's a good idea to do that in that manner.

My time is limited right now, I probably couldn't take a look at this myself for a week or two. The plan of attack would be to generate an XML override for one or more of those that works the way you want it to. Then, knowing what has to be changed and added, going into the game and looking at the tuning instance variables with, for example, The Inspector. Once you've identified the items that need to be changed in the tuning instance you can then inject into the InstanceManager load_data_into_class_instances method to patch up the values that need changing - create the tuning you want to add from the ground up, then modify the existing tuned values in the walkby tuning to add in your newly tuned values.

Sounds complex, and in a way it is, but it's not rocket science either - mostly just a matter with famliiarizing yourself with the existing structures in the class tuning instances in the live game and determining how to rebuild them on the fly with your added tuning. Examining some existing mod sources can help a lot with that, and there's a bit of a tutorial example in that thread for the inspector.

Until I could possibly look at it, I would say look at the Python sources for the mod you mentioned that already does something very similar. If the sources aren't distributed with that mod (PYO only) then you can either try decompiling them or contact the author to see if they're willing to work with you.

I wouldn't recommend diving into that at all though until you have a working mod using XML overrides. It is not worth going to all the work of figuring out how to patch the load_data_into_class_instances until you know for sure you have something that will work once it's patched in via the Python.
Lab Assistant
Original Poster
#5 Old 28th Nov 2017 at 11:44 PM Last edited by arkeus17 : 29th Nov 2017 at 4:15 AM.
Quote: Originally posted by scumbumbo
Good enough I think I can see what you're driving at. You want to patch up the existing walkby tuning to add situations to the hourly schedule in a way that doesn't conflict with other mods, and you're right that's a good idea to do that in that manner.

My time is limited right now, I probably couldn't take a look at this myself for a week or two. The plan of attack would be to generate an XML override for one or more of those that works the way you want it to. Then, knowing what has to be changed and added, going into the game and looking at the tuning instance variables with, for example, The Inspector. Once you've identified the items that need to be changed in the tuning instance you can then inject into the InstanceManager load_data_into_class_instances method to patch up the values that need changing - create the tuning you want to add from the ground up, then modify the existing tuned values in the walkby tuning to add in your newly tuned values.

Sounds complex, and in a way it is, but it's not rocket science either - mostly just a matter with famliiarizing yourself with the existing structures in the class tuning instances in the live game and determining how to rebuild them on the fly with your added tuning. Examining some existing mod sources can help a lot with that, and there's a bit of a tutorial example in that thread for the inspector.

Until I could possibly look at it, I would say look at the Python sources for the mod you mentioned that already does something very similar. If the sources aren't distributed with that mod (PYO only) then you can either try decompiling them or contact the author to see if they're willing to work with you.

I wouldn't recommend diving into that at all though until you have a working mod using XML overrides. It is not worth going to all the work of figuring out how to patch the load_data_into_class_instances until you know for sure you have something that will work once it's patched in via the Python.


Thank you for your helping! Yeah, I thought that I did created a XML with the schedules for cats and dogs, I've been upload this now

Edit: I changed the schedules of market spice to the new with cats and dog, and its seems to work

EDIT²:I've updated the package
Attached files:
File Type: zip  arkeus17dogandcat.zip (909 Bytes, 6 downloads) - View custom content
Description: V1
File Type: zip  dogandcat.zip (885 Bytes, 9 downloads) - View custom content
Description: V2
Lab Assistant
Original Poster
#6 Old 30th Nov 2017 at 2:39 AM
I have edited the Weerbersu's script, and i got a "lastexpetion" everytime i try to enter in a venue, I'll not post here, cause i haven't Weerbersu's permission yet.
But the error is:
Code:
"T:\InGame\Gameplay\Scripts\Core\sims4\tuning\instance_manager.py", line 144, in _execute_gen   File ".\injector.py", line 8, in _inject   File "dogandcat.py", line 15, in add_dogandcat_situation     walk_by.walkby_desire_by_day_of_week = walk_by.walkby_desire_by_day_of_week + dogandcat_by.walkby_desire_by_day_of_week TypeError: unsupported operand type(s) for +: 'SituationCurve' and 'SituationCurve'
Back to top