[Modding Question] How do you detect what a sim is doing?

<< < (2/2)

J. M. Pescado:
Object X is explicitly passed as mentioned above. How you determine whether a sim is using said object depends entirely on where you got the object from. If you're getting it from a sim, like My/Stack Object's Current Interaction Object (12/13 50 00), then you can pass it in as such. HOW you found the object you want to examine is not something the BHAV cares about.

rufio:
Ok, so, given a sim NID, if you do something like:

Stack Object := (sim NID)
Local 0x0 := neighbor in Stack Object's Current Interaction Object

you can then say

Is Category (Local 0x0, 0xwhatever)

which will tell you whether the sim is using a particular kind of object, right?  The first two lines were basically what I wanted to find out.

J. M. Pescado:
Quote from: rufio on 2009 November 04, 14:38:55

Ok, so, given a sim NID, if you do something like:

Stack Object := (sim NID)
Local 0x0 := neighbor in Stack Object's Current Interaction Object
Never do that. You should never access a persondata's instance values from an NID. To do it properly, if you have only an NID to work from, you need to set it to stack object, then extract its "person instance" using 18 00 00, assign THAT to stack object, then do stack object's persondata Current Interaction object (13 50 00). If you attempt to access neighbor's persondata through 20 50 00, you will get nonsense values. In fact, you should NEVER consult the Neighbor's Persondata without first verifying that the person is NOT instanced on the lot (always use the neighbor in stack object's person instance ID instead, then read the persondata of that). Neighbor's Persondata contains old information and should never be used unless you're looking for static information that will never change in-game, or the sim is definitely not instanced on the lot.

rufio:
Ah, right, I'd forgotten the difference between using the NID versus the object ID.  I actually can't remember whether it's an NID or an object ID I've got to work with, but I will keep that in mind.  Where is data actually being retrieved from when you refer to "neighbor's ___" versus "(object ID)'s ____"?  I take it that the NID goes back to some general-purpose census entry in the neighborhood with the name and family relationships and such, while the object ID refers to an actual instantiated object representing the sim that contains all the temporary variable information like skills and so forth for later storage in the census entry when the sim leaves the lot?  Family relationship info is something you can access through NID, right?  At least, EAxis family relationship BHAVs mostly seem to use NIDs (and my modded BHAVs using NIDs work as expected).  Would that cause inconsistencies or errors if family relationships were changed on-lot via hacks?  (And have you really got all of the operands for every argument for every BHAV memorized?)

J. M. Pescado:
Relationships can be accessed through either way safely, as these are global values that are not cached on the instance. Different arguments are needed to access it with instance IDs vs. NIDs, though.

Navigation

[0] Message Index

[*] Previous page