Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 11th Sep 2022 at 2:44 AM
Default Overriding NPC template BHAVs?
I posted something similar 5 months ago to no response, but I have gotten better at explaining myself so I will try again. I also have a much more particular example.

I have edited the Genie Lamp to pull from the NPC pool, and changed all its sanity tests to test for NPC Type to be Genie instead of whether it has Genie Midlock's GUID or not. As a result, it now spawns a Genie Townie when you rub the lamp instead of Genie Midlock, specifically.

However, I am not able to perform any wishes because the Genie template checks its own GUID in Sub - Begin Wish, Sub - Perform Wish Anim and Sub - End Wish.
Unlike with the lamp, or any objects I've modified for that matter, changes I make to the BHAVS of NPC templates have no effect; whether I attempt to make them return an error or a dialog popup, nothing happens. I can't find anything different in other NPC mods on modthesims that would suggest I am doing something wrong, and according to this ancient post, my approach SHOULD work. So why doesn't it work for me?



I am using The Sims 2 Ultimate Collection off of Origin.
Advertisement
just a girl
#2 Old 11th Sep 2022 at 6:25 AM
Quote: Originally posted by MyScorpion42
whether I attempt to make them return an error or a dialog popup, nothing happens.

This strongly suggests that the BHAVs you edit are not the BHAVs that are being called.

I'm not too familiar with how NPCs work, but I suspect they use resources from their own character files, and those resources are (presumably) set in stone the moment the sim is created. You may have to generate new NPC to see if it'll pick up the changes you made to the template.

Also, try forcing an error during an interaction. The error log may point you to what procedure is actually being executed and where it comes from.
Test Subject
Original Poster
#3 Old 11th Sep 2022 at 12:04 PM
Quote: Originally posted by Lamare
This strongly suggests that the BHAVs you edit are not the BHAVs that are being called.

I'm not too familiar with how NPCs work, but I suspect they use resources from their own character files, and those resources are (presumably) set in stone the moment the sim is created. You may have to generate new NPC to see if it'll pick up the changes you made to the template.


Regardless of whether they use the template's BHAVs, as they've supposedly done since Apartment Life, or their own, they're always newly generated when I test them and therefore the changes should go through.

Quote: Originally posted by Lamare
Also, try forcing an error during an interaction. The error log may point you to what procedure is actually being executed and where it comes from.

The Force Error interaction is its own interaction, so it doesn't help with finding out if I am editing the wrong BHAVs (no chance I am not, though.) When I did check the error log after using it, it seems to show the call sequence with the forced Error, down to the Genie's function - main BHAV. So I tried to edit that to put out an error, but nothing happens. Additionally, I tried changing its name, but in the error log it remains the same.

So everything points to the game somehow bypassing my mod and using the original BHAVS from objects.package, which is very frustrating Is there some secret extra thing you have to do when making NPC behavior mods that I am missing I wonder?
just a girl
#4 Old 11th Sep 2022 at 12:46 PM
Could you attach the file? Maybe there is something you’re missing. I don’t promise to solve it, but in any case, it’s easier when you can see the file.

It may have something to do with it being a universal NPC and you trying to make it a usual one. Has anyone ever done it? People have created custom NPCs, and maybe this is what you have to do instead of trying to replace in-game genie.
Test Subject
Original Poster
#5 Old 11th Sep 2022 at 1:16 PM Last edited by MyScorpion42 : 11th Sep 2022 at 1:49 PM.
Quote: Originally posted by Lamare
Could you attach the file? Maybe there is something you’re missing. I don’t promise to solve it, but in any case, it’s easier when you can see the file.

It may have something to do with it being a universal NPC and you trying to make it a usual one. Has anyone ever done it? People have created custom NPCs, and maybe this is what you have to do instead of trying to replace in-game genie.

Attached version where I attempt to cause an error in the function - main. Thanks for your help with this.

It seems very odd that for some NPCs template behavior would not be overridable but for others it would. Like, surely that would mean that they had intentionally hardcoded it, and given how Sims 2 is held together with duct tape and prayers I somewhat doubt it.

I will try and see if the wish for youth mod works on the original genie and not the derivative.

EDIT: darn, the broken function - main works on the original Genie. How frustrating.

EDIT: double darn, a broken function - main works on maids. So they really do seem to have hardcoded it. Either that or they specifically REVERSED the hardcoding for ordinary service sims when they improved moddability in Apartment Life.
Attached files:
File Type: zip  npc pool genie.zip (1.6 KB, 10 downloads)
just a girl
#6 Old 11th Sep 2022 at 10:54 PM
I guess it works for original genie because you edit the bhavs in "NPC - Unique - Genie" object, and its him. Unique Genie is a person, not a template. If you look at, say, "Townie - Template - EP2 - Date Slob" -- it is a template. See object type in OBJD. You may have to create a template (is it worth it though?).

When you create your new NPC, you use the NPC controller and "CT - Generate NPC From Pool". A lot of stuff happens there. Have you gone over the process? Judging by your screenshot, the functions seem to do a pretty good job of copying the outfit and whatnot, so we can't really say that the game can't use a person's file as a template to create an NPC. But does it use it properly? For one thing, it creates a split character file. I tested it briefly, and the game created two files:
F001_User00060 - this one contained only your custom functions and nothing else.
F001_User00060.1 - this one looked more like a normal char file, and it contained unedited genie functions. The ones that check for GUID.
Back to top