I'm currently working on a mod that grants sims the ability to get thirsty. So for that, I figured to instead have townies die of dehydration, to instead give them water bottles in their inventory!
Though, when i'm adding the bottles to the inventory, it's not... doing it? I know nraas has some inventory checking and cleaning, which makes me to think that it's not working for them because of that.
The code is simple, in case that's necessary:
Code: Select all
Code: Select all
ThirstObject bottle = sim.Inventory.Find<ThirstObject>();
if (bottle == null)
{
bottle = GlobalFunctions.CreateObjectOutOfWorld(new ResourceKey(0x653F91D91B915D67, 0x319E4F1D, 0x00000000)) as ThirstObject;
sim.Inventory.ForceAdd(bottle);
if (!sim.Inventory.TryToAdd(bottle))
{
print("Bottle can't be added.");
bottle.Destroy();
}
else
{
print("Bottle should've added...");
}
}