Home | Download | Discussion | Help | Site Map | New Posts | Sign in

Latest Site News

2018 MTS Calendar Contest - posted on 12th Nov 2017 at 7:48 PM
Replies: 13 (Who?), Viewed: 3619 times.
Scholar
Original Poster
#1 Old 28th Sep 2017 at 5:16 PM
Default How are NPCs linked to their uniforms?
I'm creating a set of default NPCs and townies, but certain NPC types are linked to specific hairstyles and outfits that I don't want them to wear; I also don't want to create a simple default replacement package, as some of the items (in this instance, butler hair) are used by non-NPCs too. I would like to unlink the NPC from the CAS item, but I can't find any resource that could link the two. Any pointers?

Quote:
Originally Posted by jje1000
If this succeeds, then we will have driven a stake through the metaphorical heart of pudding.

♥ Receptacle Refugee ♥
Now also on Tumblr !
Advertisement
Née whiterider
staff: administrator
#2 Old 28th Sep 2017 at 5:26 PM
Some NPCs are linked via the NPC spawning routine - the "Make New NPC" BHAV accepts arguments which include references to a specific outfit or hairstyle the NPC should wear. I don't think this is how it works for all NPCs, though, since those arguments don't appear to have been used in the basegame.

What I lack in decorum, I make up for with an absence of tact.
Scholar
Original Poster
#3 Old 28th Sep 2017 at 9:18 PM
My current method is to spawn the NPCs using the NPC and townie maker in the game and replace them with Bodyshop sims via Alt Sim Surgery; when teleported to a lot, they spawn in and wear the everyday Bodyshop outfits fine, but when spawned by the game in the course of their duties as service NPCs, they have their uniforms (and uniform hair) on. It might be possible to override by editing their hidden work outfit category, but I get the feeling they'd just spawn in default items when next they are called to a lot.

Quote:
Originally Posted by jje1000
If this succeeds, then we will have driven a stake through the metaphorical heart of pudding.

♥ Receptacle Refugee ♥
Now also on Tumblr !
just a girl
#4 Old 16th Oct 2017 at 5:08 PM
I've seen objects such as "NPC - Template - RepoMan". They seem to control some things about NPCs. There are Init and main functions and stuff.
This globals are used there:
[global 0x01B8] NPC - Put NPC Outfit On Me
[global 0x0137] NPC - Get Outfit GUID for Type in T[0,1] - this one calls Lua script, which is a bummer, unless you know how to read it, but maybe there's a way around it. For example, you could replace certain NPCs functions with custom ones and stick there GUIDs for your desired outfits.
I didn't know outfits could be objects and had GUIDs, but apparently you can find objects like "Outfit_NPC_Clerk Outfit - Template". This one mostly has a bunch of 3D ID referencing files. Presumably they point to real outfits' property sets. Might be your pointers.

Assorted mods: Moving out and job options
Apartment rent agreement mod - fresh update
Testers wellcome on Electrical box & Fertile land
Functional sofa bed is ready to be tested as well
Scholar
Original Poster
#5 Old 17th Oct 2017 at 12:03 AM Last edited by Qahne : 17th Oct 2017 at 7:06 AM.
Quote:
Originally Posted by Lamare
I've seen objects such as "NPC - Template - RepoMan". They seem to control some things about NPCs. There are Init and main functions and stuff.
This globals are used there:
[global 0x01B8] NPC - Put NPC Outfit On Me
[global 0x0137] NPC - Get Outfit GUID for Type in T[0,1] - this one calls Lua script, which is a bummer, unless you know how to read it, but maybe there's a way around it. For example, you could replace certain NPCs functions with custom ones and stick there GUIDs for your desired outfits.
I didn't know outfits could be objects and had GUIDs, but apparently you can find objects like "Outfit_NPC_Clerk Outfit - Template". This one mostly has a bunch of 3D ID referencing files. Presumably they point to real outfits' property sets. Might be your pointers.


I have seen those template objects, but figured they were holdovers like the Big Boss NPC in the same collection. I'll clone one and see what I can tinker with, thanks a ton!

EDIT: Yep, those outfit templates are where they're stored! It's a simple 3IDR, and I traced them to the default hair and outfits, just like you said. There is also an AGED there that controls age/gender/species/skin color for spawning - could be very useful. Just have to test it out when I have time. Interesting side note: there are files for an NPC paramedic that I've never seen before, would have been a nice feature to have.

Quote:
Originally Posted by jje1000
If this succeeds, then we will have driven a stake through the metaphorical heart of pudding.

♥ Receptacle Refugee ♥
Now also on Tumblr !
just a girl
#6 Old 17th Oct 2017 at 9:55 AM
Yeah, I've heard something about there being ambulances with features that didn't make it to the light.

Assorted mods: Moving out and job options
Apartment rent agreement mod - fresh update
Testers wellcome on Electrical box & Fertile land
Functional sofa bed is ready to be tested as well
Lab Assistant
#7 Old 17th Oct 2017 at 4:42 PM
When the game creates an NPC it tests for an outfit GUID being available for that NPC, if so then that GUID is used when the sim is created and that outfit is that sim's everyday outfit. For most NPCs their NPC outfit is also applied every time they are 'called' so they can be made to 'hang out' in regular clothes but still dress for work when 'on the job'.
The Age Data in the NPC outfit templates determines which 3IDR instance to use for the age and gender of the sim. The age/gender for creating NPCs is determined by the global 'NPC - Get Template Age/Gender/Skin in T[0,1,2]'.
Scholar
Original Poster
#8 Old 18th Oct 2017 at 8:11 AM Last edited by Qahne : 21st Oct 2017 at 8:26 AM.
Interesting stuff, thanks for the input! Had a hunch it wouldn't be that easy to alter spawning rules. Editing those 3IDRs to point to different instances works fine, but I assumed deleting them would just allow the game to select any old item instead - not so. Must be a global that tells the game what it needs from the 3IDR (hair / outfit, some have only one, others have several variants). I have a feeling I can point it to invalid parts and it'll skip over them, like when you force the game to create an NPC that is not the expected age or gender.

Edit: No dice, all that does is make them spawn with the null parts.

Edit 2: Did it! Just have to replace instance number with 0x00000000 and the game will pull parts from the NPC's everyday outfit.

Edit 3: Doesn't work for elder females, gives them a Seasons outfit instead.

Edit 4: Ok, turns out that zeroing the reference only works for hair, not bodies. Zeroing for bodies results in them changing to the outfits sims default to when a mesh is missing. Deleting the references in the GZPS entirely gives the same result. I poked in the BHAVs you mentioned Lamare, they appear to be global for all NPCs, no references to individual classes I could see, so I don't think the answer lies there. Sidenote, in the BHAVs it checks if the game is in Thai when dressing a streaker - if it is, it dresses them in underwear rather than nude. Made me laugh quite a bit

Quote:
Originally Posted by jje1000
If this succeeds, then we will have driven a stake through the metaphorical heart of pudding.

♥ Receptacle Refugee ♥
Now also on Tumblr !
just a girl
#9 Old 6th Nov 2017 at 8:26 AM
If your goal is to make NPCs wear something different without replacing items so that other sims can wear them, you can do two things (in theory):
1. Make outfit objects point to different property sets by editing 3IDRs (you said it worked fine?).
2. Edit "NPC - Get Outfit GUID for Type in T[0,1]" BHAV to point to different GUIDs. Use any of the existing ones or create new outfit templates with their own GUIDs and tell the game to use those in any case you want. Param 0 is NPC type - this is your reference to individual class. Bhav can go like this:
Param 0 is Repairman? If true, pass some outfit GUID in Temp 0 and Temp 1. If false, see if Param 0 is Maid. And so on. If you don't want to do all NPCs like this, go through the ones you want and leave Lua script to decide for the rest.

I'd say #1 is less work.

Assorted mods: Moving out and job options
Apartment rent agreement mod - fresh update
Testers wellcome on Electrical box & Fertile land
Functional sofa bed is ready to be tested as well
Scholar
Original Poster
#10 Old 6th Nov 2017 at 6:10 PM
Custom templates would be an ideal solution for the problem (my problem being no NPC uniform diversity), but another issue with that method is that NPCs are assigned uniforms from the BHAV / 3DIR randomly when there are several options (such as man-maids and nannies). I'm creating a set of pre-built NPCs to pre-populate neighbourhoods, trying to add a bit of personality to them, and my goal is for them to dress in everyday outfits rather than switching to uniforms, which allows me to tailor-make each one. For instance, I want the default sexy French maid, but also a couple of more realistic, homely housekeepers in more homely uniforms. Assigning both outfits to the 3DIR would most likely spawn the maids in the wrong uniforms, with a couple of plump maids in a risque frock and a bombshell wearing a pair of overalls! I could roll through and spawn NPCs until I get one in the desired uniform, but that creates a lot of junk data which I'd rather avoid in a template hood given the game's penchant for corruption.

I'm just confused as to how these BHAVs work, as they'll dress an NPC of the incorrect age / gender in their everyday outfit when the 3DIR points to nothing, but when I delete that reference for correct ages / genders, they spawn in null bodies. It seemed straightforward on the face of it, but I'm not too sure how it works under the hood for it to be so inconsistent. I'll take a look at the BHAVs and try pointing them to different 3DIRs, as you suggested (cloned from the ones for teenage NPCs in this case I think), which should give me the result I want, because I really don't want to have to fiddle with the LUA scripts.

Quote:
Originally Posted by jje1000
If this succeeds, then we will have driven a stake through the metaphorical heart of pudding.

♥ Receptacle Refugee ♥
Now also on Tumblr !
just a girl
#11 Old 6th Nov 2017 at 7:44 PM
Hm... Know what? Have you thought about changing outfit after it was assigned? By opening 'hood in SimPE, finding the sim in the sim browser and editing the character file itself. It might be enough for setting up a 'hood. This way you could assign any outfit at all and you only need to do it once (again, in theory - I haven't tested). Although, I'm not sure I understand what you intend to do with those NPCs.

Assorted mods: Moving out and job options
Apartment rent agreement mod - fresh update
Testers wellcome on Electrical box & Fertile land
Functional sofa bed is ready to be tested as well
Scholar
Original Poster
#12 Old 6th Nov 2017 at 7:50 PM Last edited by Qahne : 6th Nov 2017 at 8:00 PM.
Yep, that was the first thing I tried, but each time an NPC is spawned by a job, they automagically switch to whatever the template tells them to. Quite annoying really.

But your suggestion of altering the BHAV worked! As long as it points to a 3IDR that calls for parts not available for that age / gender (for instance, adult maids' BHAV pointing to teen newspaper 3IDR), they'll spawn in everyday clothes. No idea why editing the 3IDR directly doesn't do this, since it is technically the same call, but oh well. Cheers!

Quote:
Originally Posted by jje1000
If this succeeds, then we will have driven a stake through the metaphorical heart of pudding.

♥ Receptacle Refugee ♥
Now also on Tumblr !
just a girl
#13 Old 6th Nov 2017 at 9:36 PM
Cool. Thanks for reporting.
I was also thinking, if sims retain the same outfit option every time they spawn (which I'm not sure of), adding an option to template AND correcting the sim file (if needed) might work as well. I might try this myself, since I got curious. Never knew adding options was this simple.

Assorted mods: Moving out and job options
Apartment rent agreement mod - fresh update
Testers wellcome on Electrical box & Fertile land
Functional sofa bed is ready to be tested as well
Scholar
Original Poster
#14 Old 7th Nov 2017 at 8:23 AM
I believe they retain their outfits, but I'm not sure where in their character file it would be - presumably in a hidden outfit category.

Quote:
Originally Posted by jje1000
If this succeeds, then we will have driven a stake through the metaphorical heart of pudding.

♥ Receptacle Refugee ♥
Now also on Tumblr !
Back to top