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 8th Jul 2022 at 8:59 PM
Default (Scripting) Making different notifications messages for children and teens & Adding animations/routing.
I hate to keep asking questions but this is something that I'm not sure of,

1.) Do I need to make two different scrips to make teens say something different than children?

2.) Where do I add animations in the template from this program, the tutorial i was using is a little different from the template.

3.) Thank you lot for the help ahead of time!

4.) Here is my code so far (I have did the animation yet 'cause I'm a little confused)

Code:
{
	public class AskForAlittleSibling2: SocialInteraction
	{
		public static readonly InteractionDefinition NewYorkRat = new TemplateInteractionInteraction_Definition();

		public override bool Run()
		{
			bool flag = false;
			Actor.SynchronizationLevel = Sim.SyncLevel.NotStarted;
			Target.SynchronizationLevel = Sim.SyncLevel.NotStarted;
			Target.InteractionQueue.CancelAllInteractions();

			if (!BeginSocialInteraction(new SocialInteractionB.Definition(), false, 0.75f, true))
            {
				return flag;
            }
			Actor.RouteTurnToFace(Target.Position);
			Target.RouteTurnToFace(Actor.Position);

			StandardEntry();
			BeginCommodityUpdates();
			StartSocialContext();
			// Animation Start 


			// Animation End
			FinishLinkedInteraction(true);
			StandardExit();
			WaitForSyncComplete();	


			EndCommodityUpdates(true);
			return true;
            }
		}



Bro, I'm So Tired....
Advertisement
Field Researcher
#2 Old 9th Jul 2022 at 7:26 AM
You can check for the Sims age by using Actor.SimDescription and Target.SimDescription. There are different Methods there for all ages like sim.SimDescription.Adult and also things like TeenAndUp.
If you don't know how to do a check like this, I would advice to step away from Sims Modding for a short time and do a little programming basics. CodeCademy has a C# course https://www.codecademy.com/learn/learn-c-sharp
Just make a free Account and work through it, it will help a lot.
Space Pony
#3 Old 9th Jul 2022 at 10:33 AM
if you dont want to "just make an account" here is an alternative without the need for an account (cant speak for the quality of either one though)
https://www.w3schools.com/cs/cs_syntax.php

As for making a new class you can modify the existing interaction and change it from an immediate interaction to a social interaction without having to rewrite everything
Field Researcher
#4 Old 9th Jul 2022 at 12:44 PM
Quote: Originally posted by Battery
if you dont want to "just make an account" here is an alternative without the need for an account (cant speak for the quality of either one though)
https://www.w3schools.com/cs/cs_syntax.php

As for making a new class you can modify the existing interaction and change it from an immediate interaction to a social interaction without having to rewrite everything


Codecademy is an interactive course so that is a bit different^^ In my opinion it is worth the Account since it is not passive absorption of info (which is not very effective).
Space Pony
#5 Old 9th Jul 2022 at 12:53 PM
Quote: Originally posted by KittyTheSnowcat
Codecademy is an interactive course so that is a bit different^^ In my opinion it is worth the Account since it is not passive absorption of info (which is not very effective).


I am not sure what you mean by interactive either you did not even look at the link provided before "comparing" it or having try it yourself sections (with a browser based compiler) and exercises after each segment is not interactive
Lab Assistant
Original Poster
#6 Old 9th Jul 2022 at 3:16 PM
Quote: Originally posted by Battery
I am not sure what you mean by interactive either you did not even look at the link provided before "comparing" it or having try it yourself sections (with a browser based compiler) and exercises after each segment is not interactive


Thank you for all the advise, I have been looking into coding as well as making this mod, I'm just messing around for now to see if i can actually make something work!

Bro, I'm So Tired....
Lab Assistant
Original Poster
#7 Old 9th Jul 2022 at 3:18 PM
Quote: Originally posted by KittyTheSnowcat
You can check for the Sims age by using Actor.SimDescription and Target.SimDescription. There are different Methods there for all ages like sim.SimDescription.Adult and also things like TeenAndUp.
If you don't know how to do a check like this, I would advice to step away from Sims Modding for a short time and do a little programming basics. CodeCademy has a C# course https://www.codecademy.com/learn/learn-c-sharp
Just make a free Account and work through it, it will help a lot.


Thank you, I have been looking into the basics, I'm just trying to see if i can put what i know into action.

Bro, I'm So Tired....
Field Researcher
#8 Old 9th Jul 2022 at 3:40 PM
Quote: Originally posted by OhCrapItsTBGP
Thank you, I have been looking into the basics, I'm just trying to see if i can put what i know into action.

I meant if you cannot write up an if statement from the info provided, not that you necessarily should now every method ingame. It might have been unclear about this^^ So if you can take the info that you can check the Sims age with the simdescription and write an if from that great. If not, then you should do a bit more programming basics before going on, because it will just be frustrating. Hope this is more clear
Field Researcher
#9 Old 9th Jul 2022 at 3:42 PM
Quote: Originally posted by Battery
I am not sure what you mean by interactive either you did not even look at the link provided before "comparing" it or having try it yourself sections (with a browser based compiler) and exercises after each segment is not interactive

You are right, sorry I did not look closely enough.
Lab Assistant
Original Poster
#10 Old 9th Jul 2022 at 4:32 PM
Quote: Originally posted by KittyTheSnowcat
I meant if you cannot write up an if statement from the info provided, not that you necessarily should now every method ingame. It might have been unclear about this^^ So if you can take the info that you can check the Sims age with the simdescription and write an if from that great. If not, then you should do a bit more programming basics before going on, because it will just be frustrating. Hope this is more clear


Oh! I understood, I do know how to check a sims age and set for a specific age group I just want to make sure i won't break my game if i put this in it :D

Also, the only thing that's frustrating is getting the errors from VS or SharpDevelop lol

Bro, I'm So Tired....
Space Pony
#11 Old 9th Jul 2022 at 4:40 PM
Quote: Originally posted by OhCrapItsTBGP
Oh! I understood, I do know how to check a sims age and set for a specific age group I just want to make sure i won't break my game if i put this in it :D

Also, the only thing that's frustrating is getting the errors from VS or SharpDevelop lol


Later on you will be happy for these errors much better than having you script break in game and debug from there (or worse it pretending to work and break in gameplay hours later).
Also the game is somewhat forgiving when it comes to script errors so i would not be to scared of it unless you touch on some of the more core mechanics.
Field Researcher
#12 Old 9th Jul 2022 at 4:45 PM
Quote: Originally posted by OhCrapItsTBGP
Oh! I understood, I do know how to check a sims age and set for a specific age group I just want to make sure i won't break my game if i put this in it :D

Also, the only thing that's frustrating is getting the errors from VS or SharpDevelop lol



Errors are your friends, they tell you what you did wrong so you don't have to figure it out yourself.
Lab Assistant
Original Poster
#13 Old 9th Jul 2022 at 5:34 PM
Quote: Originally posted by KittyTheSnowcat
Errors are your friends, they tell you what you did wrong so you don't have to figure it out yourself.


Some of them are good but i have an error i can't fix and I've been racking my brain trying to fix it, It's an error on this line.

Code:
public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
\

Specifically test, I have no idea why it just keeps saying "TemplateInteractionInteraction_Definition.Test(Sim, Sim, bool, ref GreyedOutTooltipCallback)': not all code paths return a value" Though I have looked it up and tried to fix it but ugh, nothing works :/

Bro, I'm So Tired....
Field Researcher
#14 Old 9th Jul 2022 at 5:37 PM
Quote: Originally posted by OhCrapItsTBGP
Some of them are good but i have an error i can't fix and I've been racking my brain trying to fix it, It's an error on this line.

Code:
public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
\

Specifically test, I have no idea why it just keeps saying "TemplateInteractionInteraction_Definition.Test(Sim, Sim, bool, ref GreyedOutTooltipCallback)': not all code paths return a value" Though I have looked it up and tried to fix it but ugh, nothing works :/

You need to return a bool no matter what happens. So for every if in your code every path it can take it needs to either have a :
return false; //that means the interaction should not show up, for example for adults

or return true; // that's the condition under which the interaction should show up in game
Lab Assistant
Original Poster
#15 Old 9th Jul 2022 at 5:53 PM
Quote: Originally posted by KittyTheSnowcat
You need to return a bool no matter what happens. So for every if in your code every path it can take it needs to either have a :
return false; //that means the interaction should not show up, for example for adults

or return true; // that's the condition under which the interaction should show up in game


I do have some underneath, see
Code:
public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
		{
				if(actor.IsHuman && target.IsHuman)
                {
					if(actor.SimDescription.ChildOrAbove && target.SimDescription.ChildOrAbove)
                    {
						return true;
                    }
					return false;
                }
			}

		}
	}


Are they in the wrong place?

Bro, I'm So Tired....
Space Pony
#16 Old 9th Jul 2022 at 6:02 PM
Quote: Originally posted by OhCrapItsTBGP
I do have some underneath, see
Code:
public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
		{
				if(actor.IsHuman && target.IsHuman)
                {
					if(actor.SimDescription.ChildOrAbove && target.SimDescription.ChildOrAbove)
                    {
						return true;
                    }
					return false;
                }
			}

		}
	}


Are they in the wrong place?



Well that really is hard to read i see why that troubles you. You can select all text and hit ctrl+i to format the text into something more readable

if you click on one of the braces you can see the complementary brace being marked (see picture) each { needs to have a matching } not more not less
within the very first { of that method body you need to have your return at the very end in this case
Screenshots
Field Researcher
#17 Old 9th Jul 2022 at 6:03 PM
The return false is inside your first if you need to move it one bracket down to always give back a value.

Edit: And what Battery said I tried to click helpful on this, but that feature does not seem to work.
But I agree keeping your brackets tidy is important.
Lab Assistant
Original Poster
#18 Old 9th Jul 2022 at 6:35 PM
Quote: Originally posted by Battery
Well that really is hard to read i see why that troubles you. You can select all text and hit ctrl+i to format the text into something more readable

if you click on one of the braces you can see the complementary brace being marked (see picture) each { needs to have a matching } not more not less
within the very first { of that method body you need to have your return at the very end in this case


I knew it was Something so simple! Thank You!

Bro, I'm So Tired....
Lab Assistant
Original Poster
#19 Old 9th Jul 2022 at 6:36 PM
Quote: Originally posted by KittyTheSnowcat
The return false is inside your first if you need to move it one bracket down to always give back a value.

Edit: And what Battery said I tried to click helpful on this, but that feature does not seem to work.
But I agree keeping your brackets tidy is important.


Thank you for all the help! :D

Bro, I'm So Tired....
Back to top