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
Virtual gardener
staff: administrator
Original Poster
#1 Old 10th Oct 2019 at 7:34 PM Last edited by Lyralei : 12th Oct 2019 at 12:17 PM.
Default Best way for a script to recognise build item
So to get objects, it's easy. However, in this case, I need to get some foundations and I thought the way how I did it could work but this, unfortunately, doesn't seem to catch any foundation:

Code:
GameObject foundation = gObjectGuid.ObjectFromId<GameObject>();

BuildBuyProduct foundation = Sims3.SimIFace.UserToolUtils.GetProduct(Sims3.SimIFace.UserToolUtils.BuildBuyProductType.DeckFoundation, foundation.GetResourceKey());


Now I guess it's probably because of the last bit of the "GetProduct" overload but if anyone has any suggestions as to how to get all foundations as an Object I'd really appreciate it

EDIT: Just for the ones wondering, i'm trying to give foundations a snow overlay when it's winter. Kind of how windows get one when it's winter )
Advertisement
Virtual gardener
staff: administrator
Original Poster
#2 Old 11th Oct 2019 at 9:16 PM
So upon more reseach, I found out that "ResourceKey" Is actually the OBJD of an object. However, foundations of course only have CAWL so I wonder if that would do the job...
Virtual gardener
staff: administrator
Original Poster
#3 Old 12th Oct 2019 at 11:28 AM
Sadly, this is not going to work.

Walls are visual effects, so are fences, half walls, foundations, etc. Which sounds probably super odd to some, because you're able to create more and more fences so why would that be a visual effect?

Now, of course, most of it is Game engine related, meaning that the game knows that sims can't walk through walls and such. Obviously there is some code defined in Sims3.UI.Buildcontroller that "Talks" to the game engine and back, saying that if you draw this wall/foundation/fence, create the mesh for it.

See, most visual effects (Like butterflies, Birthday puffers, spoons, etc) have an actual mesh. Although, the examples I just said are also considered props, meaning that you could call them through a script. Walls and such you can't however, despite them having a mesh. And this is because it's missing a OBJD file.

Now, some might think "Why not just.... add a OBJD file to the foundation?" Unfortunately, if you would, and link it well, it wouldn't work. The game only picks a few things that it needs to give to the game engine itself. So unfortunately this won't work
Virtual gardener
staff: administrator
Original Poster
#4 Old 12th Oct 2019 at 12:16 PM
On second thought, has anyone done any "Texture replacements" with a script?

Basically my thought is now, foundations have a linked overlay texture (0x00B2D882-0x00000000-0x75F8F21E0F143CAC). However, this overlay is a global empty overlay. Now this is no problem, since I can just easily make an override and create a new resource key, link it correctly in the material section, etc. Tedious but easy peasy!

However, would this be the right thinking logic?

Code:
var texture key = textureKey( Default overlay texture );

If( it's winter )
{
   texturekey = new texturekey(Instance, Type, Group); // this being the new overlay
} else {
   texture key; // this being the default overlay texture
}
Back to top