Editing Bin Sims (and putting them in the world) causes all sorts of weirdness
Heya!
Yep, yet another thread I figured I'd make a new one, but it's indeed still about the bin sims.
I've currently been successfully editing Bin sims/households. More specifically the information of said bin household (Such as their starting money and any sims that should be pregnant).
Problem however is... after I place them on a lot, nraas and the game throw a bunch of null references that are very initializing-related errors. (Such as HUD population of skills, etc).
This is basically what I see, mind you, there are supposed to be 2 sims in this household, it only shows one:
Not exactly playable :p
Here's the function where things go wrong:
Code:
try
{
if (BinModel.Singleton != null && BinModel.Singleton.mExportBin != null)
{
if (BinModel.Singleton.mExportBin.Count > 0)
{
List<ExportBinContents> households = BinManagerRPG.HouseholdPicker(BinModel.Singleton.mExportBin, "Pick any household(s)", -1);
if (households != null && households.Count > 0)
{
for (int i = 0; i < households.Count; i++)
{
if (households[i] != null && households[i].Household != null)
{
for (int j = 0; j < households[i].Household.AllSimDescriptions.Count; j++)
{
ActiveSimsManagerRPG.GoThroughQuestionare(households[i].Household.AllSimDescriptions[j], true, households[i].ContentId);
}
}
}
// Update Export bin with the right info...
for (int i = 0; i < BinModel.Singleton.mExportBin.Count; i++)
{
for (int j = 0; j < households.Count; j++)
{
if (BinModel.Singleton.mExportBin[i].HouseholdId == households[j].HouseholdId)
{
BinModel.Singleton.mExportBin[i].mHouseholdContents.mHousehold = households[j].Household;
}
}
}
}
}
BinModel.Singleton.RefreshExportBinUI();
}
}
catch (Exception ex)
{
printException(ex);
}
Regarding what GoThroughQuestionare() does, currently, it's a relatively small snippet that changes the family funds money:
Code:
private static void GetMoneyChooser(SimDescription sim, bool isBinSim, ulong ContentId)
{
List<ObjectListPickerInfo> typeInfo = new List<ObjectListPickerInfo>();
string[] options = new string[] {
"Very poor ",
"Can barely make ends meet ",
"More Middle class ",
"Richer than middle class, but also not incredibly rich ",
"Rich ",
"Royally rich ",
"Customly set"
};
for(int i = 0; i < options.Length; i++)
{
if(i == 6) { continue; }
options[i] = options[i] + " ($" + RPGManagerUtil.kMoneyPerOptionToBeAddedOrSubstracted[i].ToString() + ")";
}
int index = 0;
foreach (string type in options)
{
ObjectListPickerInfo o = new ObjectListPickerInfo(type.ToString(), index);
typeInfo.Add(o);
index++;
}
string typeReturned = ObjectListPickerDialog.Show(typeInfo).ToString();
if (!string.IsNullOrEmpty(typeReturned))
{
if(int.Parse(typeReturned) == 6)
{
string Parsedpercentage = StringInputDialog.Show("RPG Manager", "[Money Situation Manager]" + '\n' + '\n' + "Customly set the starter money of this household: (NOTE, don't use . or , when typing it out!)", "20000", true);
float result = 20000;
if (!float.TryParse(Parsedpercentage, out result))
{
SimpleMessageDialog.Show("RPG Manager", "[Money Situation Manager]" + '\n' + '\n' + "Wasn't a proper number! Will set it to the default of 20.000...");
}
sim.Household.ModifyFamilyFunds((int)result);
if(isBinSim)
{
BinManagerRPG.UpdateFamilyFundsToUIInfo(sim.Household.HouseholdId, (int)result, ContentId);
}
}
else
{
sim.Household.ModifyFamilyFunds(RPGManagerUtil.kMoneyPerOptionToBeAddedOrSubstracted[int.Parse(typeReturned)]);
if (isBinSim)
{
BinManagerRPG.UpdateFamilyFundsToUIInfo(sim.Household.HouseholdId, RPGManagerUtil.kMoneyPerOptionToBeAddedOrSubstracted[int.Parse(typeReturned)], ContentId);
}
}
}
}
public static void UpdateFamilyFundsToUIInfo(ulong householdId, int newFunds, ulong ContentId)
{
ExportBinContents exportBinContents = (ExportBinContents)BinModel.Singleton.FindExportBinInfo(ContentId);
if (exportBinContents != null)
{
if(PlayFlowHouseholdPanel.Singleton == null) { return; }
RPGManagerUtil.print("Updating family funds...");
exportBinContents.Household.ModifyFamilyFunds(newFunds);
exportBinContents.UIBinInfo.mHouseholdFunds = newFunds;
exportBinContents.mHouseholdWealth = newFunds;
PlayFlowHouseholdPanel.Singleton.SetHouseholdInfo(exportBinContents.HouseholdId, exportBinContents.HouseholdName, exportBinContents.HouseholdFunds, exportBinContents.HouseholdDifficulty);
}
}
However, it seems that even *touching* Household or any sims in them, and changing any data, does some serious damage to a point that the game won't let me actually play with those sims... And I can't quite figure out why. Any ideas?
Hrm upon doing a lot of testing around, I've come to the conclusion that on Edit Town > Bin editing is all fine and works, but in Playflow this isn't the case.
Probably because on the PlayFlowState not everything has been properly set? And that therefore a lot of null references appear... I'll leave the bin editing option in edit town then, though if anyone has any suggestions to get this to work on the PLayFlow state, that would be great!