Mod The Sims
Page 1 of 3

Mod The Sims (https://modthesims.info/index.php)
-   Tutorials (https://modthesims.info/forumdisplay.php?f=754)
-   -   An introduction to Slots (https://modthesims.info/showthread.php?t=146440)

Numenor 6th Apr 2006 8:05 PM

An introduction to Slots
 
1 Attachment(s)


Slots 101: An introduction to the mechanics of Slots and their uses

By Atavera

DISCLAIMER: This thread is intended to help average-experienced object creators performing specific tasks, or to give users a deeper in-sight on specific modding-related subjects. So, don't expect to find step-by-step explanations, to be performed "blindly". Please DO NOT REPOST the following info, or part of them, on other sites.
All the "Modding InfoCenter" threads are created and mantained by Numenor and JWoods. Everyone is welcome to post his own questions or additional information about the specific thread subject.

CREDITS: Special credits go to ATAVERA for having provided these info, and for having organized them in a readable and handy way. Atavera will mantain this thread, adding new information as he gathers them; and will answer to questions about the subject of this article.

-------------------------------------------------------------------------------------

SUMMARY
Slots are invisible points, located on objects, on sims, or somewhere in the sim world; their main purposes are to hold objects, hold effects, or direct sims toward an interaction point.
These InfoCenter articles are provided in PDF format. To view them, we strongly suggest to download the Foxisoft PFD Viewer: it's free and small, less than 1Mb!

-------------------------------------------------------------------------------------

Introduction:
There are three different kinds of slots; Routing Slots, Container Slots, and Target Slots.

Routing Slots define a location for a sim to walk to, for example to make sims walk in front of an object to use it.

Container Slots are invisible containers that can hold objects, FX and sims. Example of a container slot would be one that holds a sim a chair or bed.

Target slots define a target location for animations to use, but also can hold FX. An example of a target slot would be one that tells an animation for a sink where the knobs are. The slots are defined in the slot file, which uses the Resource Node for bone data, and then applied to actions in the Behaviour Functions.

The Slot Resource:
The slot resource is where slots are defined. All types of slots have a position, which can either be entered directly from the Slot file or from the Resource Node.

Target slots have no further parameters other than position.

Container slots can have a few parameters other than position. Max Size(I6 in SimPE) seems to always be zero. Height type(I7) is used, and depends on the type of object(will differ between chairs and counters etc.).

Routing slots can have many parameters including facing direction, and lots of routing flags that can be viewed and edited in DatGen if you wish.

The most important values of any type are S2 and I9. If S2 is 0, it will take the XYZ offsets from F1,F2,F3; but it is generally not done this way. The way it should be done(and is in most cases) is to have S2 have a value of 2 which tells the Slot to get the offset from the Resource Node. When it is using the resource node, it uses the I9 value as an index to Text List 0x90, reads that string and finds the block in the resource node with that name, and uses its offsets.

The Resource Node:
Basically all slots get their positions from the Resource Node. The type of block is always a cTransformNode. The name that is entered in the Text List 0x90 must be the same as the name in the cObjectGraphNode component of the cTransformNode. For more info on the Resource Node, you can see the Modding Info Center's CRES article.

Behaviour Functions:
Slots by themselves don't do very much, but are applied in the Behaviour Functions to do many things. The exception is that container slots can have things placed in them via Buy Mode without behaviours.

Here are the different kinds of slots and the primitives that use them.

Container Slots:
Snap Into(0x71)
Will snap an object/sim into a container slot either from the ground or another container slot.

Effect Start/Stop(0x70)
Will start/stop an effect at the position of the slot. Note, container slots are usually not used exclusively for this; if it is a container slot, it usually is also used to hold objects.

Create New Object Instance(0x2A)
This primitive can be specified to create an object directly into a container slot, alternately it can just be created and later 'snapped' into the slot with 0x71.

Snap(0x2E)
This is used when snapping sims from a container slot(i.e. a bed slot) to a routing slot(so they can walk again)

Routing Slots:
Go To Routing Slot(0x2D)
Directs a sim to walk to a routing slot.

Snap(0x2E)
This is used when snapping sims from a container slot(i.e. a bed slot) to a routing slot(so they can walk again)

Effect Start/Stop(0x70)
I've never seen a BHAV actually do this, but I would guess that it could work since the primitive does have parameters to use routing slots.

Target Slots:
These slots aren't used much in behaviours, but mostly in the ANIM resources. There is however 1 primitive that will use them.
Effect Start/Stop(0x70)
Target Slots are the preferred type of slot for this primitive assuming that it doesn't need to hold any objects.

Determining Slot Number:
The slot numbers as used in BHAVs are numbered by the type of slot, not just the entry number in the slot file.

Example:
In your slot file, you have these four entries

0:Container - (Container slot 0x0)
1:Target - (Target slot 0x0)
2:Container - (Container slot 0x1)
3:Routing - (Routing slot 0x0)

The routing slot would not be Slot 0x3, but Routing Slot 0x0

The values accepted by the I7 are the same used in the Init BHAVs to define the placement of the object:
1 = ground
2 = low table
3 = table
4 = on counter
5 = non-standard (on sims)
6 = hand
7 = sitting
8 = end table
9 = in counter
10 = under counter
11 = decorative

Thats all I can think of to put here for now If anyone has more questions, please ask. And if you have some more info that I can add to this, also please let me know.

shannanisims 11th Apr 2006 7:04 PM

Is it possible to add a second container slot to an object?
Since we now have the OFB shelves... but maybe change
the positioning and target smaller areas of placement?
I've seen shelves (like Numenor's illuminated ones for instance)
that hold objects at heights that are not typical Maxis
placements and are more narrow than Maxis surfaces
so I assume its possible somehow.

What I'm wanting to do is take my 2-tier end table (see pic)
and make it so you can place objects on both levels.
Right now you can only place objects on the top level...
and I'm not happy with how deep I had to make that tier
in order to place objects to look right (not hanging half off the shelf).

I'm just curious if this is possible.... and if so a "Slots" for
dummies explaination would be appreciated.


Numenor 12th Apr 2006 9:10 PM

Yes, what you ask is possible... but it's not a job for dummies
I myself still have problems with slots... Probably I just haven't understood completely how they work, especially all those parameters in the SLOT file...

I should write a tutorial for this...

Karybdis 12th Apr 2006 9:32 PM

Numenor, send me a pm with an email contact if you want, and I'll forward you the parameter details to give to Quaxi.

shannanisims 13th Apr 2006 5:22 PM

1 Attachment(s)
Quote: Originally posted by Numenor
Yes, what you ask is possible... but it's not a job for dummies
I myself still have problems with slots... Probably I just haven't understood completely how they work, especially all those parameters in the SLOT file...

I should write a tutorial for this...



Crap... guess I'm out a plan then. LOL!

Seriously I would love it if you wrote a tutorial on slots....
because I have other ideas I'd love to make... like this
table/seat combo (that were popular in the 50's... telephone stands)
But I would have to be able to take a loveseat and replace the
seat slot on one side with an object placement one... etc.
(Unless there is an easier way to make something like this)

So many ideas... so little knowledge to actually do anything about it. :dunce:

Claireh82 4th Aug 2006 10:22 AM

Ok I have worked a little bit with slot files before in that I made a useable 8x1 table with all slots open for eating and object placement - what I would like to do now is make a table and chair at a new height for eating, I have some ideas that this may be possible from my table, pehaps changing the container and routing slots translation from z= 0.8 on a maxis table to say z=1.0, and the same idea with the chair.

Can you let me know if I'm on the right track and if this is possible?

Numenor 4th Aug 2006 1:08 PM

The main problem I foresee is with the animations: the "sit on chair" and "stand up" are tailored on standard chairs; changing the chair height might bring to an odd placement of the sitting sims.
Putting and object on a table having a different height, and taking it back, on the contrary might work; but I'm not sure about this: I noticed that there is a specific put/get animation for each standard height (counter, end tables, etc), so there must be a reason for that.
Probably, if you lower down a dining table to the same height as a coffee table, for instance, you can somehow make the sims use the "coffee table" animations for the get/put actions; but - as said - make them sit at a coffee table height is not simple (or impossible) in my opinion.

As for the routing slots, so far I have seen only a value of zero for the Z coordinate (all the routings that I have examined are placed on the ground, while the container slots, of course, have the same Z value as the height of the table.
But I might have overlooked some routing slot with Z different than zero, so don't rely 100% on my word :P

Claireh82 4th Aug 2006 1:21 PM

1 Attachment(s)
Thanks Numenor - i have got a few shots of what I wanted - the anims match up when sat but the sim does get down from the in an odd way - sort of sink thourgh and stand up. - haven't put in any mesh yet lol.

Edit: On routing slots for the table the z figure seems to minus whatever the actual slot is - for eating the height is 0.8 and -0.8 goes into all the routing slots. I haven't figured out why yet. I filled them in this way for my chair too - I have the result I want so even if it isn't needed there it isn't doing any harm either.

trezero 4th Aug 2006 6:01 PM

I've seen two routing slots with Z coordinates that weren't zero: the top two slots in straight staircases, which both have a Z of 3. (no idea with modular)

Which is interesting, when you think about it, because it means a sim on the top level going down goes to a routing slot with a Z of 3. And a sim that just came up comes out on a routing slot z=3.

Numenor 4th Aug 2006 7:20 PM

No surprise for the Z=3 in the staircases: you have probably noticed that when you set the camera to follow a sims that is climbing upstairs, the camera moves to the upper floor only when the sims reaches the top landing.

Claireh, in that case, the Z value of the routing slot is not actually -0.82, but zero. That's because the CRES is like a tree: starting from the ground, there is a vertical translation of +0.82 to reach the point where the surface is placed; and then a translation of -0.82 to get back to the ground, where the routing slot lies.
For more information about the CRES structure, you can read: "Modding Infocenter - The Resource Node (CRES)"

Claireh82 4th Aug 2006 10:04 PM

Thanks Numenor - always learn things backwards lol - seeing as I'm working with the cres at the moment that is very helpful.

suceress 12th Oct 2006 7:29 AM

What are the possible settings for I6 btw? I know 0 is the default, but what are the other settings?
Also, I made a 3 tile dresser (to look like one that I actually have in my room) and made it function as a surface. Objects hung over the edges so I moved the 2 edge slots in a bit but this caused the middle slot to prevent objects from being placed (all except a very thin vase with flower). Another problem was that objects that weren't very tall are difficult to impossible to pick up once placed on the slots. It doesn't seem to be able to grab them, just gets the entire dresser instead.
I saw that made a shelf that has 2 slots on one tile and I looked at the code, but can't figure what I did wrong that is preventing things from fitting the way I want.
Any thoughts on this? (I hope this is the right place to ask).

Numenor 12th Oct 2006 5:16 PM

As for the I6 value, I've looked at many SLOT files, in order to understand how they worked; and I've always seen the I6 set to zero: never seen other values.
I have no clues about the meaning of that value.

Regarding your dresser, I have realized that there are different types of slots, that are defined by the field I7. The values accepted by the I7 are the same used in the Init BHAVs to define the placement of the object:
1 = ground
2 = low table
3 = table
4 = on counter
5 = non-standard (on sims)
6 = hand
7 = sitting
8 = end table
9 = in counter
10 = under counter
11 = decorative

Look at the field I7 for the central slot: perhaps it is set to 11 (decorative), and therefore the slot can accept only small vases and other little objects.

The last problem that you mention, that you can't pick up low objects when snapped into the slot it's not due to the slot itself: is seems more a problem in the clickable area (aka "bounding mesh") of the dresser; if the bounding mesh it's too big, everything placed near it can't be picked up any more.

Fixing the clickable area in objects that use joints it's not simple, because the bounding mesh is calculated automatically by the game, using as a reference the mesh associated to the main joint.
The only advice I can give you is to check if, by chance, you have associated to the main joint the shadows, too.

suceress 13th Oct 2006 6:32 AM

Quote: Originally posted by Numenor
As for the I6 value, I've looked at many SLOT files, in order to understand how they worked; and I've always seen the I6 set to zero: never seen other values.
I have no clues about the meaning of that value.

Regarding your dresser, I have realized that there are different types of slots, that are defined by the field I7. The values accepted by the I7 are the same used in the Init BHAVs to define the placement of the object:
1 = ground
2 = low table
3 = table
4 = on counter
5 = non-standard (on sims)
6 = hand
7 = sitting
8 = end table
9 = in counter
10 = under counter
11 = decorative

Look at the field I7 for the central slot: perhaps it is set to 11 (decorative), and therefore the slot can accept only small vases and other little objects.

The last problem that you mention, that you can't pick up low objects when snapped into the slot it's not due to the slot itself: is seems more a problem in the clickable area (aka "bounding mesh") of the dresser; if the bounding mesh it's too big, everything placed near it can't be picked up any more.

Fixing the clickable area in objects that use joints it's not simple, because the bounding mesh is calculated automatically by the game, using as a reference the mesh associated to the main joint.
The only advice I can give you is to check if, by chance, you have associated to the main joint the shadows, too.


Thank you. I made sure to look up the various things on CRES and BHAVs and made sure to put the right I7 value. All 3 of my slots on the dresser have the same value (8, I also tried it with 4). All 3 of the slots worked fine before I moved the 2 edge slots inward so that objects placed on them did not hang over the sides. After moving them in, it seems it crushed the allowable size for the middle slot.

I love your lighted shelves that allow multiple placement. Did you do anything special to get more than one object per slot? I looked at the file but it is beyond my knowledge so I don't really know what to look for.

As for the bounding mesh, I believe the object I cloned was taller than the object is now and it did not seem to actually import the shape of the new mesh even though I told it to. The bounding mesh area in the GMDC is (adnd originally was) completely empty. When I tried manually adding things it messed it up so badly that when I tried to load the object in the game, it caused the game to crash. I'm guessing that it is because it has a high number of vertices. I didn't add any shadows or anything to it. I just kept the same shadows as before and imported nothing. It seems to have adjusted the shadows appropriately on its own. Should I export the shadows and shrink them?
(I submitted an earlier version of my file to the repair thread, once I clean it up some I might delete that version and upload the current one).

Numenor 13th Oct 2006 11:34 PM

I didn't do anything special with my shelves: I just duplicated the slots, and moved them off-center, one to the left and one to the right; I've never experienced your problem.
BTW, I'm quite sure that the side slots can't "shrink" the central one: if the slots are too near on another, the objects will just overlap each other: not beautiful to see, but nothing more.

As for the bounding mesh, I only know that if the mesh has joints (like yours), the "bounding mesh" area in the GMDC must be clear, becasue the clickable area is computed on the fly by the game reading the jonts. I don't know how to fix that; I've posted this question in this thread, hoping that some modder more experienced than me gives me an answer.

suceress 14th Oct 2006 9:41 AM

Quote: Originally posted by Numenor
I didn't do anything special with my shelves: I just duplicated the slots, and moved them off-center, one to the left and one to the right; I've never experienced your problem.
BTW, I'm quite sure that the side slots can't "shrink" the central one: if the slots are too near on another, the objects will just overlap each other: not beautiful to see, but nothing more.

As for the bounding mesh, I only know that if the mesh has joints (like yours), the "bounding mesh" area in the GMDC must be clear, becasue the clickable area is computed on the fly by the game reading the jonts. I don't know how to fix that; I've posted this question in this thread, hoping that some modder more experienced than me gives me an answer.


Thank you again.
For some odd reason it doesn't seem to want to let the slots overlap. It seems to be constraining the size of the middle slot. I don't know why. I'm pondering stretching my mesh but I don't really want to do that since it will require me to alter my textures. I might have to resort to that though.
When I make the changes and test it, if I still have a problem, should I post the object here for review? Or should I put it in the object repair center?

Numenor 14th Oct 2006 4:05 PM

Post it here, it's better (I might overlook it in the other thread). I think that perhaps you have discovered the meaning of one of the unknown values, in the SLOT: perhaps one of them sets the slot as "shrinkable"?

Karybdis 14th Oct 2006 6:36 PM

Sorry sorry sorry...

I meant to give this to you guys months ago, but nobody mentioned it to me and I forgot *sweatdrop*

Rest of the details are now up on the wiki

Again, sorry
http://www.sims2wiki.info/534C4F54

Numenor 14th Oct 2006 11:35 PM

Sorry? Why should you be sorry!
Thank you for the valuable info.

pjplumley 17th Oct 2006 3:36 AM

Wow, I just read this thread, I think I kinda understand what you all are talking about, but my head is spinning, or is the room?

I am now learning how much more I have to learn!

Thank you all!

Karybdis 20th Oct 2006 3:49 AM

Yea I know.

I just didn't mean to be holding up the hobby by forgetting the stuff. I got a PM a couple of days ago from a person asking if I still had the info that I had mentioned earlier in the thread, and it hit me that I still hadn't done anything with it since around April.

Hope you guys can make some use of it now at least

suceress 23rd Oct 2006 12:05 PM

Thanks Numenor! I noticed that the new Pets dressers came with container slots so as soon as SimPE is updated for Pets I will take a look at them. Especially since they seem to be the right height.
In the meantime I will upload my file here. Right now the middle slot only takes the very thin table decoration plant. Anything placed on the original main tile of the dresser cannot be picked up again (unless it is very tall). I might try that delete groups thing mentioned in the bounding mesh thread you linked.

Karybdis, thank you for putting that info up. It makes things much clearer.

UPDATE: Fixed most of the problems with the dresser. Just need to figure out how to make them only try to open the drawer from one spot rather than from all angles. I'm pretty sure I can get it now.

Reyn 30th Oct 2006 5:21 AM

Okay - I'm using one of the shelves from OFB to make a knicknack shelf, and while it will hold multiple objects, it only shows two container slots, both set on the I7 as 1. I need to adjust the height for the shelves, because it is using the height for the ofb shelves, instead of my new ones. Also, I'm not sure how to add the third shelf in. Would I just add a third container slot?

I really want to learn to do something with this aspect, because it seems that if we could master this, we could start making all sorts of objects have slots, rather than having to custom make content at the right height for one thing, and use the moveobjects cheat to place it.

Ben♣ 2nd Dec 2006 5:45 PM

Hi everyone,

I'm making a living-room - well, trying to - and I realised that my coffee table looks quite big compared to the sofa and loveseat. What I'd like to do it to change the coffee table height.

I guess I should change a value in the Container line. I've just tried setting the I7 to 1 (instead of 2) but it doesn't change the height. i've realised it just prevents the table from holding lamps (and maybe some other objects).

Any help'd be appreciated - but keep in mind I have no knowledge about slots, behaviours...

Numenor 2nd Dec 2006 9:07 PM

If you change the mesh of a coffee table to make it look taller, you need to move the slots, as well; but this is NOT done by editing the values in the SLOT file; you'd rather change the "Translation" values for the slots that are stored in the CRES.
Ppen the CRES and select the Hierarchy tab: you will see one or more "slot..." entries; select them (ignore the ones labeled with "route" or "target") and look at the "Translation" box on the left.
A higher value of Z moves the slot upwards: so, if you have raised the table surface by 0.5 in your 3D editor, you have to add 0.5 to the Z value.

Just to clear up, the parameter I7 that you have changed doesn't "move" the slot: it just qualifies a cntainer slot as "placed on an end table" or "placed on a dining table", etc. So that, whan a sim needs to put something on an end table, he will know how to choose the right slot where to put the object into.


All times are GMT +1. The time now is 2:11 PM.
Page 1 of 3

Powered by: vBulletin Version 3.0.14 · Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.