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
Lab Assistant
Original Poster
#1 Old 6th Dec 2020 at 1:34 PM
Default add of buffs and thought balloons to motive
Hello, need advice please, I figured out how to do it, but there is a problem, why are toddlers crying, when have buff hungry, but they thought to very hungry, please help where is that written? thanks in advance
Advertisement
Inventor
#2 Old 6th Dec 2020 at 5:14 PM
I can't help with your question, but I'd love to know how to do this -- add buffs and thought balloons to motive.

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Lab Assistant
Original Poster
#3 Old 8th Dec 2020 at 4:28 PM
Quote: Originally posted by echoweaver
I can't help with your question, but I'd love to know how to do this -- add buffs and thought balloons to motive.

it is difficult, a lot of work
By thread: I think it's because of the class ScoringFunctionsForBabiesAndToddlers.
Lab Assistant
Original Poster
#4 Old 10th Dec 2020 at 6:59 PM
Quote: Originally posted by echoweaver
I can't help with your question, but I'd love to know how to do this -- add buffs and thought balloons to motive.

I will definitely help you, only after we make the Toddlers not exaggerate
Inventor
#5 Old 10th Dec 2020 at 11:12 PM
Quote: Originally posted by whiteman-Dara
I will definitely help you, only after we make the Toddlers not exaggerate


Actually, my mods involve cats right now. I'm perfectly happy working only with adult and elder pets.

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Lab Assistant
Original Poster
#6 Old 12th Dec 2020 at 9:55 AM
Judging by the code written
Code:
		public static void ThoughtBalloonBabyCrying(Sim sim, BuffNames buffName)
		{
			ThoughtBalloonManager.BalloonData balloonData = null;
			if (buffName <= BuffNames.Lonely)
			{
				if (buffName <= BuffNames.Exhausted)
				{
					if (buffName != BuffNames.ReallyHasToPee)
					{
						if (buffName != BuffNames.Desolate)
						{
							if (buffName == BuffNames.Exhausted)
							{
								balloonData = ThoughtBalloonManager.GetBalloonData("BuffExhausted", sim);
								balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
							}
						}
						else
						{
							balloonData = ThoughtBalloonManager.GetBalloonData("BuffDesolate", sim);
							balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
						}
					}
					else
					{
						balloonData = ThoughtBalloonManager.GetBalloonData("BuffReallyHasToPee", sim);
						balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
					}
				}
				else if (buffName <= BuffNames.HasToPee)
				{
					if (buffName != BuffNames.Grungy)
					{
						if (buffName == BuffNames.HasToPee)
						{
							balloonData = ThoughtBalloonManager.GetBalloonData("BuffHasToPee", sim);
						}
					}
					else
					{
						balloonData = ThoughtBalloonManager.GetBalloonData("BuffSmelly", sim);
					}
				}
				else if (buffName != BuffNames.Hungry)
				{
					if (buffName == BuffNames.Lonely)
					{
						balloonData = ThoughtBalloonManager.GetBalloonData("BuffLonely", sim);
					}
				}
				else
				{
					balloonData = ThoughtBalloonManager.GetBalloonData("BuffHungry", sim);
				}
			}
			else if (buffName <= BuffNames.Starving)
			{
				if (buffName != BuffNames.Sleepy)
				{
					if (buffName != BuffNames.Smelly)
					{
						if (buffName == BuffNames.Starving)
						{
							balloonData = ThoughtBalloonManager.GetBalloonData("BuffStarving", sim);
							balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
						}
					}
					else
					{
						balloonData = ThoughtBalloonManager.GetBalloonData("BuffSmelly", sim);
						balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
					}
				}
				else
				{
					balloonData = ThoughtBalloonManager.GetBalloonData("BuffSleepy", sim);
				}
			}
			else if (buffName <= BuffNames.VeryHungry)
			{
				if (buffName != BuffNames.Tired)
				{
					if (buffName == BuffNames.VeryHungry)
					{
						balloonData = ThoughtBalloonManager.GetBalloonData("BuffVeryHungry", sim);
						balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
					}
				}
				else
				{
					balloonData = ThoughtBalloonManager.GetBalloonData("BuffTired", sim);
					balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
				}
			}
			else if (buffName != BuffNames.Scared)
			{
				if (buffName == BuffNames.CryingBaby)
				{
					balloonData = ThoughtBalloonManager.GetBalloonData("BuffCryingBaby", sim);
				}
			}
			else
			{
				balloonData = ThoughtBalloonManager.GetBalloonData("BuffScared", sim);
			}
			if (balloonData != null)
			{
				balloonData.mPriority = ThoughtBalloonPriority.High;
				balloonData.Duration = ThoughtBalloonDuration.Medium;
				sim.ThoughtBalloonManager.ShowBalloon(balloonData);
			}
		}

and in balloons.xml
Quote:
<Idle>
<IdleKey>BuffHungry</IdleKey>
<BalloonName>balloon_moodlet_hungry</BalloonName>
</Idle>

but for some unclear reason, he reads the code from:
Quote:
<Idle>
<IdleKey>BuffVeryHungry</IdleKey>
<BalloonName>balloon_moodlet_veryHungry</BalloonName>
</Idle>

a also red thought balloon.
Lab Assistant
Original Poster
#7 Old 15th Dec 2020 at 6:57 PM
thought balloon "hunger" don't work. When I edit a snippet of code
Code:
 					if (buffName == BuffNames.VeryHungry)
					{
						balloonData = ThoughtBalloonManager.GetBalloonData("BuffVeryHungry", sim);
						balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
					}

on
Code:
 					if (buffName == BuffNames.VeryHungry)
					{
						balloonData = ThoughtBalloonManager.GetBalloonData("BuffHungry", sim);
					}

I get change of thought balloon in buffs hunger and very hunger, @Lyralei what do you think about that?
Virtual gardener
staff: administrator
#8 Old 16th Dec 2020 at 12:11 PM Last edited by Lyralei : 16th Dec 2020 at 12:17 PM. Reason: forgot to close the bracket.. woops!
@whiteman-Dara , 

In your post where you're posting the entire function, it all seems like it should work. But only IF you parse in the correct buffname

How are you calling this function? Like so?

Code:
ThoughtBalloonBabyCrying(base.Actor, BuffNames.VeryHungry); 
Also, note that you've noted the 'hungry' one wrong

Code:
if (buffName == BuffNames.Hungry)
{
      balloonData = ThoughtBalloonManager.GetBalloonData("BuffHungry", sim);
}
You initially had the BuffNames as 'VeryHungry'. So the code would never have reached the 'hungry' code at all due to it.

Hope this helps!
Lab Assistant
Original Poster
#9 Old 16th Dec 2020 at 2:00 PM
Lyralei, No, Like so!
Code:
public override void ThoughtBalloon(Sim sim, bool isDistress)
{
ToddlerBuffIdleAnimationData.ThoughtBalloonBabyCrying(sim, this.mBuffInstance.Guid);
}

Quote:
Also, note that you've noted the 'hungry' one wrong

Quote:
Code:
if (buffName == BuffNames.Hungry)
{
      balloonData = ThoughtBalloonManager.GetBalloonData("BuffHungry", sim);
}
This snippet does not work for at me no matter what I write. Thought balloon It remains the same.
Quote:
You initially had the BuffNames as 'VeryHungry'. So the code would never have reached the 'hungry' code at all due to it.

Is it possible learn more about this.
Virtual gardener
staff: administrator
#10 Old 17th Dec 2020 at 1:59 PM Last edited by Lyralei : 17th Dec 2020 at 2:05 PM. Reason: Forgot to add the ShowBalloon, which fires the balloon stuff to begin with
I will be honest, I'm a bit confused about how this is all linked together (Like, which variables are being parsed in by your code and that it's a problem there, etc). Would you be able to share the .cs file of your code?

I also will be honest (Because the original ThoughtBalloonBabyCrying()) is weirdly set up by EA to begin with :p If I were you, I'd actually go as far as doing the following yourself:

Code:
public static void ThoughtBalloonForCryingBabies(Sim sim, BuffNames buff)
   {
   if (buff == BuffNames.Hungry)
   {
      balloonData = ThoughtBalloonManager.GetBalloonData("BuffHungry", sim);
      sim.ThoughtBalloonManager.ShowBalloon(balloonData);
   }
   if (buff == BuffNames.VeryHungry)
   {
      balloonData = ThoughtBalloonManager.GetBalloonData("BuffHungry", sim);
      balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
      sim.ThoughtBalloonManager.ShowBalloon(balloonData);
   }
}

// No idea how you're doing this, but say, you apply this within your Run() function:
public bool Run() {
   ThoughtBalloonForCryingBabies(base.Actor, BuffNames.Hungry)
}
And, from there just expand the code  That's what I usually do, the core goal is "Baby needs to have balloon thought bubble thing" You first start there. Test it in-game, then continue 'grow' the code for 'If the commodity type is hungry, then we use our own function', etc, etc, etc  Because if you start doing ALL the things at once, it won't really help the progress (When I started doing scripting, I did this very badly and it never really worked out)
Lab Assistant
Original Poster
#11 Old 19th Dec 2020 at 6:50 AM
I went to research, and corrected the method to look like this.
Code:
	ThoughtBalloonManager.BalloonData balloonData = null;
	if (buffName <= BuffNames.Lonely)
	{
		if (buffName <= BuffNames.Exhausted)
		{
			if (buffName != BuffNames.ReallyHasToPee)
			{
				if (buffName != BuffNames.Desolate)
				{
					if (buffName == BuffNames.Exhausted)
					{
						balloonData = ThoughtBalloonManager.GetBalloonData("BuffExhausted", sim);
						balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
					}
				}
				else
				{
					balloonData = ThoughtBalloonManager.GetBalloonData("BuffDesolate", sim);
					balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
				}
			}
			else
			{
				balloonData = ThoughtBalloonManager.GetBalloonData("BuffReallyHasToPee", sim);
				balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
			}
		}
		else if (buffName <= BuffNames.HasToPee)
		{
			if (buffName != BuffNames.Grungy)
			{
				if (buffName == BuffNames.HasToPee)
				{
					balloonData = ThoughtBalloonManager.GetBalloonData("BuffHasToPee", sim);
				}
			}
			else
			{
				balloonData = ThoughtBalloonManager.GetBalloonData("BuffSmelly", sim);
			}
		}
		else if (buffName != BuffNames.HungryToddler)
		{
			if (buffName == BuffNames.Lonely)
			{
				balloonData = ThoughtBalloonManager.GetBalloonData("BuffLonely", sim);
			}
		}
		else
		{
			balloonData = ThoughtBalloonManager.GetBalloonData("BuffHungry", sim);
		}
	}
	else if (buffName <= BuffNames.StarvingToddler)
	{
		if (buffName != BuffNames.Sleepy)
		{
			if (buffName != BuffNames.Smelly)
			{
				if (buffName == BuffNames.StarvingToddler)
				{
					balloonData = ThoughtBalloonManager.GetBalloonData("BuffStarving", sim);
					balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
				}
			}
			else
			{
				balloonData = ThoughtBalloonManager.GetBalloonData("BuffSmelly", sim);
				balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
			}
		}
		else
		{
			balloonData = ThoughtBalloonManager.GetBalloonData("BuffSleepy", sim);
		}
	}
	else if (buffName <= BuffNames.VeryHungryToddler)
	{
		if (buffName != BuffNames.Tired)
		{
			if (buffName == BuffNames.VeryHungryToddler)
			{
				balloonData = ThoughtBalloonManager.GetBalloonData("BuffVeryHungry", sim);
				balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
			}
		}
		else
		{
			balloonData = ThoughtBalloonManager.GetBalloonData("BuffTired", sim);
			balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
		}
	}
	else if (buffName != BuffNames.Scared)
	{
		if (buffName == BuffNames.CryingBaby)
		{
			balloonData = ThoughtBalloonManager.GetBalloonData("BuffCryingBaby", sim);
		}
	}
	else
	{
		balloonData = ThoughtBalloonManager.GetBalloonData("BuffScared", sim);
	}
	if (balloonData != null)
	{
		balloonData.mPriority = ThoughtBalloonPriority.High;
		balloonData.Duration = ThoughtBalloonDuration.Medium;
		sim.ThoughtBalloonManager.ShowBalloon(balloonData);
	}
}

To make new motives working, i fix the next method.
Code:
public bool IsHungry()
{
	Motive motive = null;
	if (this.mMotives.TryGetValue(17774807, out motive))
	{
		foreach (MotiveTuning.MotiveBuffTrigger current in motive.Tuning.BuffTriggers)
		{
			if (motive.Value <= Math.Max(current.mTriggerValueEnd, current.mTriggerValueStart) && motive.Value >= Math.Min(current.mTriggerValueEnd, current.mTriggerValueStart))
			{
				bool result;
				if (this.mSim.Toddler)
				{
					result = (current.mAddBuff == BuffNames.HungryToddler || current.mAddBuff == BuffNames.VeryHungryToddler || current.mAddBuff == BuffNames.StarvingToddler);
					return result;
				if (this.mSim.IsPet)
				{
					result = (current.mAddBuff == BuffNames.HungryPet || current.mAddBuff == BuffNames.VeryHungryPet || current.mAddBuff == BuffNames.StarvingPet);
					return result;
				}
				result = (current.mAddBuff == BuffNames.Hungry || current.mAddBuff == BuffNames.VeryHungry || current.mAddBuff == BuffNames.Starving);
				return result;
			}
		}
		return false;
	}
	return false;

But a the motives: hungry, very hungry, starving, tired, sleepy. They do not have thought balloons.
Virtual gardener
staff: administrator
#12 Old 21st Dec 2020 at 9:55 PM
I'd in your case just use print statements on every line. See which if statement they pass. Sometimes that can even be surprising :p Because I can't seem to see a reason why it wouldn't work (But again, that's partially since only snippets are being shared here rather than the project itself or even not really knowing what you're trying to code here, thus it's a bit difficult to figure out how things are called and when the interactions are fired)
So, as an example:

Code:
if (buffName <= BuffNames.Exhausted)
      {
                        print("Is Less or equal to exhausted");
         if (buffName != BuffNames.ReallyHasToPee)
         {
                         print("Is NOT ReallyHasToPee");
            if (buffName != BuffNames.Desolate)
            {
                                         print("Is NOT Desolate");
               if (buffName == BuffNames.Exhausted)
               {
                                                  print("IS Exhausted");
                  balloonData = ThoughtBalloonManager.GetBalloonData("BuffExhausted", sim);
                  balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
               }
            }
      }
Etc. Etc..

In case you're wondering how to make a simple print function, here you go:
Code:
      public static void print(string text)
      {
         StyledNotification.Show(new StyledNotification.Format(text, StyledNotification.NotificationStyle.kDebugAlert));
      }
In theory it should use the XML file that EA provided. But again, I have no idea what the general project looks like, that I also don't know how to help you on how to fix this. And I hope that with print statements you might get somewhere on understanding your code. 
If you do want to share your project (Which I highly recommend), here's a tutorial on how to do this: https://www.youtube.com/watch?v=kFZGq5etfMw

If you don't want to share it with others, I completely understand! Feel free to PM me if that's the case  Else you can attach it to the thread here!
Lab Assistant
Original Poster
#13 Old 24th Dec 2020 at 7:12 PM
Unfortunately it didn't work, there two buffs left, and the problem is not here this method.
Back to top