Hellos, i currently have a object that a family member can deposit some money into. The problem is that if you switch households the savings in the object is transferd to the next household. is there anyway i could make the savings per-household?
@PigiePower: The object should already do that for you. You probably made the savings static, so all objects of that kind share the savings. Delete the static modifier and you should be good to go. If that's not the case, show your code.
And if you didn't thinkt of it, you should override the OnDispose() callback function, so the savings in the piggy bank get added to the household it belongs to when it gets destroyed/sold. Maybe write the test function of the refund interaction so that only sims belonging to the same household as the piggy bank pass.
BTW: Does it behave like a real piggy bank? So that the actual savings are a mystery until you destroy it?
Yes, i have a static modifier i'l remove it now and get back. Thank you for mentioning the OnDispose()! That would be bad loseing all your sims savings when you sell it. xD The money in the piggybank is a mystery until the user instucts the sim to take the money out.
EDIT:
so i tried adding the onDispose, and removed the "static". Now the Compiler gives me these errors
static member of outer type 'modOne.Main' via nested type 'modOne.Main.TalktoMe 2.'Sims3.Gameplay.Objects.Decorations.Mimics.SculptureTableCowPlant' does not contain a definition for 'Actor')
The money in the piggybank is a mystery until the user instucts the sim to take the money out.
Piggy banks with a hole on the bottom to take the money out without the need to crush the piggy bank with a hammer are for wussies!
Quote:
Now the Compiler gives me these errors
static member of outer type 'modOne.Main' via nested type 'modOne.Main.TalktoMe 2.'Sims3.Gameplay.Objects.Decorations.Mimics.SculptureTableCowPlant' does not contain a definition for 'Actor')
I can't really make sense of this without knowing your code. Seems like modOne.Main is static, too. It didn't occur to me that such a thing was even possible. I can't think of a reason to make a whole class static, though. Or is modOne a variable?
oops i forgot the code here it is, mind that i'm very new to C#and the first class is based on Kolipoki's tut.
using System;
using System.Collections.Generic;
using System.Text;
using Sims3.Gameplay.Objects.Miscellaneous;
using Sims3.Gameplay.Utilities;
using Sims3.Gameplay.Interactions;
using Sims3.Gameplay.Actors;
using Sims3.Gameplay.Autonomy;
using Sims3.SimIFace;
using Sims3.Gameplay.Skills;
using Sims3.UI;
using Sims3.Gameplay.Objects.Decorations.Mimics;
using Sims3.Gameplay.Objects;
namespace modOne
{
public class Main : SculptureTableCowPlant
{
protected Sim mRevealingSim;
public int moneySaved;
public override void OnStartup()
{
base.OnStartup();
base.AddInteraction(TalktoMe.Singleton);
base.AddInteraction(giveMoney.Singleton);
}
Interaction is a class, too, and the objects instanced from this class can exist independent from the Main class' objects. So inside the Interaction class there's no way to know which object's moneySaved field is meant unless you explicitely specify it.
Same here in the Dispose() method (I never can remember which one is with the "On" and which one is without...):
Code:
base.Actor.Household.FamilyFunds += moneySaved;
There's no Actor at this point, so this won't compile either. Use
Good to hear it worked out. I think it's really a nice idea. Deserves to be fleshed out. Like when grandma comes to visit, she automatically puts 10ยง in the piggy bank. But something like that is at least an intermediate project.
Despite the issue being sloved you're still going to slove the typos as well, right? I mean "balacne" sounds like a really serious skin disease.