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
Miss BHAVing
retired moderator
Original Poster
#1 Old 18th Jan 2009 at 5:24 PM
Default Enumerate Objects of a type
Is there a way to enumerate through all objects of a certain type when those objects are not on the lot - i.e. in order to randomly create an object of a particular type.

Set to Next only seems to find objects that exist on the lot - unless there is some other way of using it that I haven't found yet.

Any help gratefully appreciated
Cheers
Mog
Advertisement
One horse disagreer of the Apocalypse
#2 Old 18th Jan 2009 at 5:39 PM
I haven't personally found a way to do that just based on availability in the catalogue or Downloads. Only like you say for objects on the lot.

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Retired Duck
retired moderator
#3 Old 18th Jan 2009 at 10:57 PM
I've looked for something like this before and never found it. As far as I can tell, there's no way for a BHAV to know about uninstantiated catalogue items unless you can provide it with a GUID. If you do happen to find one, I'd love to get some details!
The ModFather
retired moderator
#4 Old 18th Jan 2009 at 11:25 PM
Do you want a BHAV to randomly select one object from a specific category, and then create it? Probably with an array containing all the possible GUIDs you can do it, but only for Maxis objects of course...
Preloading the array with all the GUIDs of the objects, you can then read a random record of the array, load the Temp0/1 with the read values and create the object by its GUID.

I've finally started my Journal. Information only, no questions.

My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD)


I *DON'T* accept requests, sorry.
Slippery When Wet
#5 Old 19th Jan 2009 at 4:18 AM
Take a look at the code in the accessory spawner. (Group 0x7f461c50)
It doesn't contain a list of GUID's, but uses the category.

You can see how the object works if you spawn it. I think it's available with testing cheats, and then shift-clicking a sim.
Retired Duck
retired moderator
#6 Old 19th Jan 2009 at 8:20 AM
That's pretty cool... I can think of a few uses for this! (And I guess "Set to next (influence)" doesn't do what it says on the box? )
Slippery When Wet
#7 Old 19th Jan 2009 at 12:12 PM
Ooops, sorry yes my mistake. It's not by category, but by 'selector'. It was a long time ago that I played with that

The temp value of 0x99 before that call corresponds to the 0x99 in the selector field (0x4b) of the accessory objects. There's another temp for sub-selector too if I remember correctly.
I don't know if there are predefined selectors for other types of object. I just had a quick scan through and most are set to 0. So probably useless for randomly choosing an EA object. It leaves it open to use for custom objects though.
Miss BHAVing
retired moderator
Original Poster
#8 Old 19th Jan 2009 at 10:17 PM
Quote: Originally posted by Numenor
Do you want a BHAV to randomly select one object from a specific category, and then create it? Probably with an array containing all the possible GUIDs you can do it, but only for Maxis objects of course...
Preloading the array with all the GUIDs of the objects, you can then read a random record of the array, load the Temp0/1 with the read values and create the object by its GUID.


Yes - that's about where I'd got to - but the objects I want to do it with are Cars - and there are probably more Custom Cars than there are Maxis Cars, so the idea of just cycling through with Set to Next to a random point and then creating the one you're at had a certain niceness to it.

Trying to keep an array of all the custom car GUIDs would be a challenge

I'll take a look at the Accessory Spawner - see if there's anything similar for non-accessories - at least it's something to look for.

Cheers
Mog
The ModFather
retired moderator
#9 Old 20th Jan 2009 at 12:29 AM
That Accessory Spawner is a very interesting find. thank you Tuna for the heads up.
As far as I know, the "selector" in the OBJD corresponds to the "Category" as determined in the init BHAV. In fact, in the global BCON 0x016C (Category2), 0x0099 is "Accessory".

Therefore, from what I can guess, the Set To Next instruction (mistakely labeled as "next influence") actually does the following:
- reads the category from Temp0
- reads the subcategory for Temp1 (not sure... Temp1 ranges from 1 to "num of categories", i.e. 4)
- finds the next object in the mentioned category/subcategory
- stores in Temp2/3 the GUID of the object.

Am I right?

I don't remember which accessories are spawned by this test object, but the random accessories I've checked are NOT "global sim object",i.e. they are NOT automatically instantiated when the game starts. This should mean that the Set To Next is capable of findind even non-instantiated objects?

I've finally started my Journal. Information only, no questions.

My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD)


I *DON'T* accept requests, sorry.
Retired Duck
retired moderator
#10 Old 20th Jan 2009 at 12:48 AM
I would assume that they would have to be searching non-instantiated objects, because otherwise the behavior would be identical to "Set to next (object in category)" which I *have* used before for instantiated objects.
Slippery When Wet
#11 Old 20th Jan 2009 at 4:35 AM
Numenor, I tested it.

I changed the 99 to 00, as that is what most of the objects have in the selector field. I left the temp1 cycle through the 1 to 4 sub-selector, and clicked on the menu to see what it found.
I got all kinds of objects appear. From stairs to baby milk bottles, and controler objects and beds. No accessories from the 99 selector though.

If you change the description to say 'selector' instead of 'category', then yes you're right about the rest I think.

One thing I noticed too, is that 6 of Pes's objects appeared in the 00-02 selector menu, and no others. I changed the 'spawn all' menu to only spawn these 6, but the 'stuck objects remover' landed on the 'ffs lot debugger'... so that menu was not as useful as I thought They were not on the lot though, so non-instantiated part is true.

Analysis of the actual flags might reveal how to search by category for the non-instantiated.

I saw Pet Beds listed in BCON 0x016C. Off to test.
#12 Old 20th Jan 2009 at 4:58 AM
Can anyone give me some specifics on where to find this "Accessory Spawner", both in-game and with SimPE, please?

This Space Intentionally Left Blank
Slippery When Wet
#13 Old 20th Jan 2009 at 5:19 AM Last edited by tunaisafish : 20th Jan 2009 at 2:20 PM. Reason: Added info
I posted the group number of the spawner above. Use the SimPE filter located near the right side of the screen. It's in objects.package from about pets(?) onward.
In game... boolprop testingcheatsenabled true
shift cklick your sim -> Spawn.../More.../Accessory Cheat

Results of my test with the selector set at 0x9f (the value for Pet beds)
Nothing found. The menu displayed 'not used'.

I looked at a sample Pet Bed, and yes the category is not actually set until the Init function. So there is no way of finding this particular object via the category even if by category did search non-instantiated stuff. Probably the same with most objects.
The selector of the bed was 00, so it may have been among the gazziliion things I saw in the last test.

So, is this useful to MogHughson's initial request?
Not yet I don't think
I don't know if there's a quick way to filter the GUID's down somehow to just the cars.

ETA: I did another test.
Selector was 00-02 in temps 0/1. All other temps were set to 0.
Called the 'set to next influence', then an immediate break-point to examine the temps in the logfile.

Temps 0/1 unchanged
Temps 2/3 GUID of the Stuck Objects Remover
Temps 4+ all still 0.

I did have my fingers crossed that Temps 4+ might hold the catalog sort info, but no such luck.

So if you already have GUID's of CC objects, this could be used to check that they exist in the users downloads folder before trying to spawn them.
#14 Old 20th Jan 2009 at 7:01 PM
I looked in objects.package from IKEA Home Stuff, my newest installed expansion, the one whose executable I run, and couldn`t find it. I`ll have to try again after I install Seasons in February, or Pets in April. Thank you anyway.

This Space Intentionally Left Blank
The ModFather
retired moderator
#15 Old 21st Jan 2009 at 8:26 AM
The objects.package from IKEA does contain the Accessory Spawner. If you can't find it in the Object Workshop, open the objects.package and use the "Filter Resources" panel to filter by GroupID 0x7F461C50, as suggested by tunaisafish.
NOTE: you have to open the package in ...Res\Objects, and NOT the one in ...Res\StuffPack\Objects.

I've finally started my Journal. Information only, no questions.

My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD)


I *DON'T* accept requests, sorry.
Miss BHAVing
retired moderator
Original Poster
#16 Old 20th Feb 2009 at 11:56 PM
Thought I should feed back. Tunaisafish's suggestion of using Set To Next works wonderfully :lovestruc

It does mean that the Selector must be changed on custom cars, but it's a very very small change and it's works perfectly.

I now have an object that can randomly select any car (that has the selector set). EXACTLY what I wanted!

Thank you, thank you, thank you.

Perhaps I should write a small tutorial? (with large tunaisafish credits!!)

Cheers
Mog
Slippery When Wet
#17 Old 21st Feb 2009 at 4:01 AM
Glad it worked out and omg you're making me blush with the praise.

I've since found another place in the game where Set To Next influence is used.
PhoneGlobals 0x204D "Call - Check Type Availability"
This BHAV and the caller (0x2050) both appeared in Pets.

Temp0 := Const 0x016C:0x11 ("Phone Call Type" Value: 0x0091)
Temp1 := various values from Const 0x016C

So again this constant makes an appearance in relation to selectors and sub-selectors.
Kudos to Numenor for spotting the connection for the accessories above.
With that in mind it may be pointing out so that values a user chooses for custom objects are less likely to clash with in-game use.

I'd love a tutorial on this, it would be better than my scribbled notes
I also remember that it was something in one of Dizzy's notes that made me look at the selector fields in the first place. So I'd say he deserves credit too in addition to those here
The ModFather
retired moderator
#18 Old 21st Feb 2009 at 4:06 PM
I do hope you'll write a tutorial on this; btw it would be a great way to keep track of these info, and to easily retrieve them when needed.
Create a thread in this forum and then PM me, so that I can move the thread to the Tutorial forum.

I've finally started my Journal. Information only, no questions.

My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD)


I *DON'T* accept requests, sorry.
Fat Obstreperous Jerk
#19 Old 21st Feb 2009 at 5:32 PM
The selector feature is used in a few EAxis objects, like the Phone Calls and whatnot. I don't otherwise recall anything particularly interesting about it offhand.

Grant me the serenity to accept the things I cannot change, the courage to change the things I cannot accept, and the wisdom to hide the bodies of those I had to kill because they pissed me off.
Slippery When Wet
#20 Old 22nd Feb 2009 at 5:38 AM
Well, you must have found it interesting at some stage. You appear to be using a custom sub-selector field in some of your objects.
Do you actually use it for anything?
Miss BHAVing
retired moderator
Original Poster
#21 Old 22nd Feb 2009 at 10:47 PM
Tutorial created here. Your comments welcome whilst the topic is paged into your memories, to capture anything else required to be said on the subject.
Back to top