PDA

View Full Version : How To Get Many Of The Same Object To Combine Together In Inventory?


gesimz
12th Mar 2012, 11:46 AM
Since 2010 when Ambitions first released, there has been an annoying issue with three of the four Big Inventions (namely, the Floor Hygienator, the Harvester and the Miner). This issue is that when you make many of one or more of these inventions at one time, they do not combine together under the one icon so they can be dragged and sold all at once (like in the green circle with Bananas) in a Sims inventory. Rather each Big Invention appears individually as a new object alongside the previously made Big Invention and don't combine (like in the red circle):

http://thumbs2.modthesims2.com/img/7/0/0/1/5/8/7/MTS_gesimz-1279791-BigInventionInventoryIssue.jpg

This quickly becomes a major annoyance when you are making hundreds of these big inventions as you end up getting hundreds of these big inventions flooding your inventory, and when it comes time to sell them, you have to drag one by one which literally takes minutes to do, a major inconvenience given the fact you can't drag one on top of another to bundle them together.

My question is, what or where is the code that tells the game to combine multiple quantities of the same object together in a Sims Inventory so they can be dragged and/or sold all at once? This is so I can compare to an object like Fruit which do bundle together correctly, find out what is wrong with these big inventions and get closer to creating a solution to this annoying issue.

Buzzler
12th Mar 2012, 05:39 PM
GameObjects have an attribute that stores certain flags. One of them is DoesNotStack which is being set in all Invention's OnStartup() methods. May be possible to work around it with a pure scripting mod. The easy way out would be to replace all Invention classes with custom scripts and override their OBJKs respectively.

gesimz
13th Mar 2012, 10:16 AM
Clicking on the OnStartup() method of one of the Big Inventions (e.g. the Hygienator) reveals this:


public override void OnStartup()
{
base.AddComponent<ItemComponent>(new object[] { ItemComponent.SimInventoryItem });
base.AddFlags(GameObject.FlagField.DoesNotStack);
base.AddInteraction(ChangeFlavor.Singleton);
base.AddInteraction(PutInInventory.Singleton);
base.AddInteraction(IPlaceableObject_Place.Singleton);
base.AddInventoryInteraction(IPlaceableObject_Place.Singleton);
this.AddTriggerVolume();
PlaceableObjectUtil.OnStartup(this);
}

Subsequently clicking DoesNotStack shows just this: DoesNotStack = 0x800. Not sure what thats about, but in terms of this potential mod, Would an object script for each of the three big inventions (excluding Time Machines that require no fix) simply removing the line base.AddFlags(GameObject.FlagField.DoesNotStack) in the OnStartUp() method with all your usual using and class stuff at the top of the script prior to the altered OnStartUp method be sufficient or is there more required for the purposes of this mod? I assume the answer is going to be the latter?

van Dorn
14th Mar 2012, 12:24 AM
Couldn't you just use Debug Enabler and say "stack same?"

gesimz
14th Mar 2012, 03:12 AM
I use debug enabler and I haven't tried that yet. Will give it a shot.

EDIT: Works, is there anything Twallans mods can't do?