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!
Quick Reply
Search this Thread
Field Researcher
Original Poster
#1 Old 29th Nov 2005 at 6:16 AM Last edited by syberspunk : 29th Nov 2005 at 11:58 AM.
Default How do you distinguish between dormies you "live" with versus YA visitors?
Hi everyone, :wave:


I'm still very new to modding and I have a question regarding dormies. I am trying to make a simple hack and I need to be able to distinguish between dormies that you live with (the ones that are in the dorm lot that your sim lives in) versus the random dormies that either walkby and are greeted or dormies/YAs that you might invite over to visit.

The problem is, it seems that the Person Type, as designated by Person Data 20 (in hex, 32 dec if you look at an error log) is set to Visitor (1) for all dormies. It seems that the dormies you live with are flagged as greeted visitors (Person Type = 1, Greet Status = 1). Which makes them essentially indistinguishable from other YAs that you greet from walkbys or invites.

There must be some other way that the game can distinguish between them, because how else do the dormies you live with "know" to come back? Is it some kind of token, or some other field value that I am overlooking?

I've searched on MTS2 and SimPE, and I've looked at dizzy's bhavs table on VS. I've even went in game, forced errors on as many different types of sims, to generate errors logs, so that I can compare their Person Data and I could not see anything that distinguishes between actual greeted visitor YAs versus the YAs that you live with, which are flagged as greeted visitors.

I thought that Person Misc Flags might have helped, but I still saw a case where, a dormie that was walking by at random, which I greeted, still had the same value as the dormies that I lived with.

So, is it possibly some kind of invisible token maybe? I don't know anything about tokens. If it is a token, can someone possibly let me know:

1) what token it is? and

2) maybe explain or provide an example (or at least point me in the right direction to a tutorial or a BHAV I can look up)?

I'd greatly appreciate any help with this. Thanks. :D

Ste
Advertisement
One horse disagreer of the Apocalypse
#2 Old 29th Nov 2005 at 11:25 AM
I wasn't able to work out a way, either, when I was making my hacked door to only allow residents through (to stop visitors to your playable sim disappearing into the dormie's rooms for the evening).

In the end I had to settle for allowing any YA through the door. It was good enough to cope with visitors from the home town.

The only other way would be to go round all the Myne doors working out who owns each one, and seeing if your Sim under consideration matches one of them.

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Field Researcher
#3 Old 29th Nov 2005 at 10:43 PM
Checking to see if the dormie 'owns' one of the Myne doors on the lot is the only way that I know of as well to test if the dormie lives on that lot. There is a global Bhav College - Has Key? that will tell you if the dormie has a key token in inventory, but I've never looked at that token to see what information it really contains. It's possible that the token may contain info about which lot they live on.

My mods for The Sims 2 can now be downloaded from this site.
Field Researcher
Original Poster
#4 Old 30th Nov 2005 at 8:23 AM
Thanks Inge and TJ for the responses I really appreciate your expert help.

I was poking around Pescado's hack for novanishindorm and I noticed that there is a line that he added:

my person data family number (0x3D) == Const 0x13C:0x1

I'm not sure why this would work. I've stuck it in my hack and I'm trying to test if it does the trick. I think the only global BCON values that this if found in is for PersonGlobals (or something like that, I can't remember of the top of my head right now).

I did notice one thing when looking at Error logs. There is a list of Attributes, and the first value seems to be:

0, Visitor Type

I compared a few logs, and for the most part, it seems like all the dormie sims that live on the same lot as my sim have the same Visitor Type = 3. When I looked at the error logs for other sims that I invited and greeted, the NPC cafeteria worker, the NPC cow mascot, and the cheerleader, their Visitor Type was different.

Maybe this might be the key to determining the difference. Can someone explain or provide an example of how to access these Attributes? Maybe point me to a BHAV that has an example of this?

Thanks.

Ste

PS. I've tested a little bit with the change I stole from Pescado, and superficially, it seems to work as I expected so far. I have to do more testing in different situations to be sure yet.
One horse disagreer of the Apocalypse
#5 Old 30th Nov 2005 at 8:36 AM
Hmm I didn't know about visitor type. If I saw it I probably assumed it meant persontype. I'll have to look into this.

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Field Researcher
Original Poster
#6 Old 30th Nov 2005 at 9:59 AM
I'm not sure if Attributes are the same thing as the Person Data, but my guess is that they are not. This Visitor Type shows up first int he list of Attributes when you look at error logs.

persontype seems to be Person Data 20 (hex - 32 dec). When I looked at the list of values under Person Data in the error logs, the 32nd value seemed to correspond to this field as designated in dizzy's bhavs table list.

It would be great if I knew how to access this Attribute. There has got to be away, I just haven't come across an example yet. I'm still a bit confused about Object Stack's and such. And even greater if it does help distinguish between dormie "residents" and dormie "visitors" on the lot.

Ste
One horse disagreer of the Apocalypse
#7 Old 30th Nov 2005 at 10:56 AM
Yes, this is very interesting. I have found the attributes list now on the template character, but it's not at all obvious what they all do! The visitor type is described as "Sims 1.x" as if it's not something used by Sims 2, but it obviously is!

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Field Researcher
#8 Old 30th Nov 2005 at 12:16 PM
I often use visitor type to distinguish a passer-by from a scheduled visitor. That's not person type.

Anyway if you guys want to search for a sim who lives in that dorm, you can do as twojeffs said before. You can check if a sim has a dorm key, and then compare the dorm door owners with the questioned sim.
One horse disagreer of the Apocalypse
#9 Old 30th Nov 2005 at 12:32 PM
What values do you test for, in visitor type, to differentiate between passer by and scheduled visitor?

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Field Researcher
#10 Old 30th Nov 2005 at 2:03 PM
Passers-by has 2, and scheduled visitors has 0 for their visitor type.

For an example, if a sim's visitor type is 0, and its family number is different from the global current family, and its greet status is 0, and it's not a npc-on-the-job, I regard it as a scheduled visitor. Then who is a scheduled visitor? I think a scheduled visitor is a sim who rings the doorbell. (Why they ring the doorbell, may vary )

But if its visitor type is 2, I regard it as a passer-by.
Field Researcher
Original Poster
#11 Old 30th Nov 2005 at 3:08 PM Last edited by syberspunk : 30th Nov 2005 at 3:28 PM.
Any idea what Visitor Type 3 is?

And does Visitor Type 0 also apply to sims that "auto greet" as in the ones that have very outgoing personalities, and therefore "bypass" the greeting requirement and just barge into your home?

Ste

PS. I think I figured out how to reference the attribute.

Is it simply just using the data owner 00 for My attribute?
And if I understand it correctly, Stack Object attribute (data owner 01) would be the same as My attribute if the Stack Object is Me. Usually the Stack Object or Me tends to be a the sim, if the BHAV is an interaction for a sim or between sims?

Thanks again for all your help.
Field Researcher
#12 Old 30th Nov 2005 at 4:04 PM Last edited by christianlov : 30th Nov 2005 at 4:18 PM.
Quote: Originally posted by syberspunk
And if I understand it correctly, Stack Object attribute (data owner 01) would be the same as My attribute if the Stack Object is Me.


Right.

Quote: Originally posted by syberspunk
Usually the Stack Object or Me tends to be a the sim, if the BHAV is an interaction for a sim or between sims?

Thanks again for all your help.


How can you be sure that the stack object tends to be a sim when it's an interaction for a sim or between sims? You need to verify the object, then you are able to see if that's a sim or a non-sim object. If it's not a sim, then the attr 0 is something else. It may be something meaningful to that certain object, or it may be just meaningless empty number.

I think you can find some information on the visitor type 3 if you look up at the dorm controllers or related objects. Actually I never heard of visitor type 3 before I came to this thread.
Field Researcher
Original Poster
#13 Old 30th Nov 2005 at 6:15 PM
Quote: Originally posted by christianlov
How can you be sure that the stack object tends to be a sim when it's an interaction for a sim or between sims? You need to verify the object, then you are able to see if that's a sim or a non-sim object. If it's not a sim, then the attr 0 is something else. It may be something meaningful to that certain object, or it may be just meaningless empty number.


Thanks! Yeah, I've seen the Verify BHAV. I just wanted to be sure that I understood that correctly. I get easily befuddled, and although there are a lot of great tutorials out there, it's always a mix of either too elementary or a bit too advanced. Like, some of it is kinda basic and easy to follow, but it still requires that you have some prior knowledge. And although I was a CS major SimAntics is still a mysetry to me. I suppose though, if it were that easy, everyone would be making their own mods all the time.

Quote: Originally posted by christianlov
I think you can find some information on the visitor type 3 if you look up at the dorm controllers or related objects. Actually I never heard of visitor type 3 before I came to this thread.


I'll take a deeper look into it when I have time. I was just super lazy, and hoping that other people who are in the know might be willing to share their knowledge. If I find anything definitive, I'll try and post about it. Upon superficial inspection of error logs, my hypothesis is that Visitor Type 3 might very well be the designation of a dormie living on the same lot as you.

I was wondering, do Locals get initalized to some value (possibly 0, null, or some undefined state)? The spaghetti-like, circuitous code of BHAVs is often confusing, but I could have sworn that I've seen comparisons with Local values that were not assigned any value prior to the comparison.

Typically, a Local gets assigned first (Local 1 := foo), and then compared to something (My foo == Local 1). But I think I've seen BHAVs where a Local is compared without any kind of previous assignment.

So... is it safe to say that Locals get initialized with some value?
And if so, what value is this (0, null, undefined - are they all the same, is it like Perl where essentially this can be compared to any var type?)
And if not... then what happens? Does it just get some garbage/junk value?

Thanks again! Cheers!

Ste
Lab Assistant
#14 Old 30th Nov 2005 at 7:06 PM Last edited by ebruere : 30th Nov 2005 at 7:10 PM. Reason: forgot something
The Has key ? is the only thing that you have to use.
The visitor type 3 main effect is to disable the "I must leave" thing but it is not enough.
When the dorm controller tries to add a Townie dormie, it is immediately set to type 3 but the townie will only become a dormie if the Claim Door is succesful.
And if there is overcrowding in lot, the controller will remove townies but visitor type stays at 3.
The fact that the sim has the key means that the Claim was successful and he is a dormie.
The "Has key" requires 3 parameters : Neighbor ID, Lot ID and Door ID
Use Nid,FFFF,FFFF to know if it is a dormie somewhere
Use Nid,global 0A,FFFF to know if it is a dormie in this lot
Use Nid,global 0A,Door ID to know if he owns this specific Door.
Use FFFF,global 0A,Door ID to find if this door has a dormie.

If you use a "set to next" loop, be aware that a dormie is often "disabled" and you have the option to "include disabled objects" or search only for active sims.

A sim can only have one key.
A door can only have one key.

Edit: I forgot this : The Door ID is the ID of the Master Tile
Field Researcher
#15 Old 30th Nov 2005 at 8:24 PM
Quote: Originally posted by syberspunk
Thanks! Yeah, I've seen the Verify BHAV. I just wanted to be sure that I understood that correctly. I get easily befuddled, and although there are a lot of great tutorials out there, it's always a mix of either too elementary or a bit too advanced.


Dizzy2 is perfectly explaining it in his documents. If it's not the person ME, or a person whom you found using Set to Next, you can't be sure that it is a sim.

Quote: Originally posted by syberspunk
I was wondering, do Locals get initalized to some value (possibly 0, null, or some undefined state)?


I believe so.

Quote: Originally posted by syberspunk
Typically, a Local gets assigned first (Local 1 := foo), and then compared to something (My foo == Local 1). But I think I've seen BHAVs where a Local is compared without any kind of previous assignment.

So... is it safe to say that Locals get initialized with some value?


As far as I know, if there is not something primitive which sets Locals in their primitive itself(like when we search for an object using Set to Next and it puts the result into Local 0, or a primitive just sets the result to be Local :=1), I believe it's safe.
Lab Assistant
#16 Old 30th Nov 2005 at 8:47 PM
I'm sure that Locals are initialized to zero. Original Maxis bhavs use this fact, and I'm using it too with no problems.
One horse disagreer of the Apocalypse
#17 Old 30th Nov 2005 at 10:10 PM
I don't trust to locals initialising to 0 any more. I used to, but I experienced some results once or twice which could only be explained by the locals having started with some random rubbish in them.

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Lab Assistant
#18 Old 1st Dec 2005 at 1:16 AM
Okay,
I don't know if somebody mensioned this already, but here is what I found out about attribut x0000 for persons:

attribut 0 = 0 means : person is staying on lot, but not yet beeing greeted OR
person has "checked out" already meaning that Sim has decided to go autonomiously or has been told to leave.

attribut 0 = 1 means : Sim is visiting, (has been greeted in privat household, or on comunity lots decided to stay and is not yet ready to leave.)

attribut 0 = 3 means : that Sim has been invited to stay (over night) and has agreed to invitation. This is set (attr.0 = 3) in a routine of the invtation controller object (can't quite remember which but there are only 5 in number or so)
Attr. 0 is beeing reset to 0 in the Main-Visitor-bhav which is part of person globals I believe. This is happening under certain circumstances, for instance if the visitor does not find a place to sleep in the host's house and is getting too tired. In this case the value will be reset to 0 in order to make it possible to enter the "leave-subroutines"...

hope that helps
Ernesto
Field Researcher
#19 Old 1st Dec 2005 at 3:40 AM
An addition to Flyby's list above:

Vistitor Type (Attribute 0) = 2 means that the sim is a random walkby visitor.

None of these attributes or persondata fields are good for checking for dormies though. I ran into this problem with my NPC & Visitor zapper. The only way to do it is to use the College - Has Key? global. And thanks to ebruere for the details on that one!

My mods for The Sims 2 can now be downloaded from this site.
Field Researcher
Original Poster
#20 Old 1st Dec 2005 at 9:08 PM
Thanks everyone! I really appreciate your time, patience, and help! This is exactly what I needed and it seems to work fine so far. I was thinking I would have to resort to something like checking if the sim owned a door, but I was afraid it would be have been complex and difficult. But it turns out to be easier than I thought. You guys totally rock!! Cheers to you all!

Ste
Field Researcher
Original Poster
#21 Old 3rd Dec 2005 at 3:38 AM
Default Request please
I am having trouble with my hack, and I don't know why. The code looks like it should work, but I don't know what I'm doing wrong.

I was wondering if any of you would be so kind as to look at it? I am only posting the code instead of the actual hack, since I don't want any one to try and download and use it, since it isn't working (at least in my game).

The background info:

Basically, I wanted to satisfy someone's request for a hack that would prevent sims from doing college homework assignments during a party. So basically, I took the "Interaction - Do Homework - TEST" BHAV and modified that. As I understand it, modifying the "TEST"s will affect non selected sims who are under autonomous control. In other words, it is a "test" for whether the sim will autonomously do that interaction. I think it also affects whether or not the interaction will be available via the pie menu. :shrug:

So, what I did was, I added a test for the party controller. If there is a party, then I have it check if they are being influenced, otherwise they shouldn't do it.

If there is no party, then I check if it is a College Lot. if that's true, then I check if they are a visitor (Person Data 20 == Const Person Types: 1). If that's true, then I check if it is a Community lot. If it is, then check if they are a YA and proceed as normal. This way, dormies can still do homework on any Community lot, such as libraries and student centers.

If it is NOT a Community lot, then I check if it is a Dorm. If so, then I check if they Visitor Type is 3 (My attribute 0 == Const Visitor Types and Status: 3). Then I check if the sim has a key on the current lot. This way, these checks should exclude dormies and other YA visitors who DO NOT live on the current dorm lot.

I have some other code I'm toying with for Secret Society and what not, I will probably tweak that later.

Anyways, essentially, the hack should check if there is a party in progress, and if not, only allow "valid" dormies who live on the current lot to do homework. Other YA visitors shouldn't. This part appears to work ok so far. My problem is that, when I have a party going, dormies still seem to do homework? :confused: The code looks right to me, but maybe because I'm too close to it, I can't wrap my head around it and figure out what is wrong.

If anyone would be so kind as to take a look at the code below. If you would be willing to test it out and have me send you the actual package, I can do that as well.

Anyways, I would really appreciate any help that anybody can offer.

Thanks again!

Ste


Here's my code:

Quote:
# Group = 0x7FD7764E, Instance = 0x100B
# Title = Interaction - Do Homework - TEST
#
# Format = 8007, Params = 1, Locals = 2
# Tree type = 0, Header flag = 4, Tree version = FFFF8017 (-32745)

0: Set to Next: Temp 0 := next object of type GUID 0x2C91C16A (0x7FB4DF10: Controller - Party); true: 1, false: 2
1: Influence - Am I Being Influenced?; true: true, false: false
2: Lot - Is College Lot? - EP1; true: 3, false: 1
3: my person data Person Type (0x20) == Const 0x104(Person Types):0x1; true: 4, false: 13
4: Lot - Is Community?; true: 5, false: 14
5: Age - Am I a Young Adult?; true: 6, false: 1
6: Param 0 > 0; true: 7, false: 9
7: Stack Obj's Attribute 0x0 != Me; true: 1, false: 8
8: my motives Mood (0x3) <= 0; true: 1, false: 9
9: .0x1013(Stack Object, Stack Object, Stack Object, Stack Object); true: A, false: error
A: Stack Object := Temp 0; true: B, false: error
B: In Use?; true: 1, false: C
C: Local 0 := Stack Obj's Attribute 0x1; true: D, false: error
D: Stack Object := Stack Obj's Attribute 0x0; true: E, false: error
E: Verify - Person ID(Stack Object); true: F, false: false
F: Age - Am I a Child?; true: 10, false: 11
10: stack obj's person data Person Age (0x3A) > Const 0x110(Person Ages):0x1; true: 1, false: 11
11: Stack Object == Me; true: 12, false: 17
12: Add/Change the Action String: Add / Change Interaction string Mode, [Private STR# 0x12E:0x1]; true: true, false: error
13: my person data Person Type (0x20) == Const 0x104(Person Types):0x2; true: 1, false: 5
14: Lot - Is Dorm? - EP1; true: 15, false: 18
15: My Attribute 0x0 == Const 0x10F(Visitor Types and Status):0x3; true: 16, false: 1
16: College - Have Key?(my person data neighbor id (0x1F), Global(Current House), -1 (0xFFFF)); true: 5, false: 1
17: Add/Change the Action String: Add / Change Interaction string Mode, [Private STR# 0x12E:0x0]; true: true, false: error
18: Lot - Is Secret Society? - EP1; true: 5, false: 1
One horse disagreer of the Apocalypse
#22 Old 3rd Dec 2005 at 8:29 AM
Without looking deeper, the reason is *probably* that most of what semi-automatom dormies do is "pushed" onto their queues by various other University controllers. It might be a good idea to look to the dorm controller or controllers to make your changes there rather than on the homework book itself. This is reminding me why I try to avoid hacks that involve NPC behaviour :D

Edit: Ah! Try this - set Temp 0 to literal 0 before looking for the party controller. You may simply be missing it because Temp 0 starts at something weird. Temps are used all the time and stay set between calls. Better still use a local variable that you can keep complete control over.

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Lab Assistant
#23 Old 3rd Dec 2005 at 7:31 PM
First things I see :
You are not sure to find the party controller, because you forgot to set Stack Object ID 0 to zero before the "set to next" instruction.
The rest looks OK but you can optimize a lot :
A set to next loop costs a lot of processor time. You should make tests that don't need it first.
Check the Owner atrribute first. ( your line 7 )
and User Selected ( your line 6 )
You want to prevent "Homies in their own dorm"
You only have to check for the key : your line 16 will return true for all owners in current lot. This means they live here, they are YAs, it is a dorm or a greek house or a secret society. No further test is needed.
Finish with the party check ( your set to next with StO ID to zero first )
and the original tests.
One horse disagreer of the Apocalypse
#24 Old 3rd Dec 2005 at 7:38 PM
Well except it's not Stack Object that Syberspunk would be wanting to set to zero, but the counter he'd decided to use instead. Now that we don't have to use Stack Obj, he's sensibly decided to use something else instead rather than have to store and restore stack object. But I would avoid using a Temp when the variable will only be used inside the one BHAV - it's more reliable to use a Local.

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Field Researcher
Original Poster
#25 Old 3rd Dec 2005 at 10:00 PM
Thank you for your suggestions Inge and ebruere! I hate to sound so saccharinely sychophantic but I really do appreciate all the help. I'll definately try out your suggestions and report back, probably later today.

First, the reason I chose Temp 0 was actually because I stole that bit from one of Pescado's examples. I looked at several other BHAVs and I saw that it usually stored the result in the Stack Object. But... I figured that the other lines of code in the BHAV rely on Stack Object pretty much being Me (i.e. the Sim that is doing the interaction). As I understand it, most if not all Interactions for Sims pretty much assume the Stack Object is a Sim or Me specifically. Since I didn't want to have to save the Stack Object first, since using the Set to Next: Stack Object := would change it, and then assign it back. I figured Pescado's code was a good example to clone, since presumably it worked for him. :shrug: The point is, I just wanted to test if the Party Controller existed, but I wasn't going to do anything with it, nor would I have to check any attribute (like what type of Party it was) because I wanted this to occur with any type of Party.

Second, I added in a lot of checks, which might seem kind of redundant (Lot Type checking and Person Data checking) just to "be on the safe side" of things. I know that I could probably get away with fewer checks, since YAs most likely will be the only sims who actually should have keys anyway, but I just wanted to be sure that it is very specific as to who is allowed to do homework. Just in case, for any odd reason, something weird happens at somehow the wrong type of sim manages to slip past one of those checks. I looked at one of the BHAVs related to the Dorm Controller, I think it was an Interaction for sending Sims to someones room (probably the one Pescado used for his novanishindorms mod), and it had a bunch of checks which I pretty much modeled my changes after.

Anyways, I'll be orf to edit and test in a bit. Be back laters to report. :D

Ste
Page 1 of 2
Back to top