- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- (Scripting) Custom Interaction for children and teens.
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- (Scripting) Custom Interaction for children and teens.
Replies: 9 (Who?), Viewed: 507 times.
#1
7th Jul 2022 at 7:02 PM
Posts: 106
Thanks: 222 in 5 Posts
(Scripting) Custom Interaction for children and teens.
So, I'm really, REALLY new at modding and could use some pointers, I was watching this tutorial on custom interactions by Puddingface, and i think i did it right but honestly I'm not sure, here is my current code (I need to learn how to make it just for teens and children and add more then one notification message but right now I'm just trying to make it work; also, I'm suppose to set it to x84 on any cpu, right???)
Advertisement
#2
7th Jul 2022 at 7:39 PM
Posts: 56
Thanks: 295 in 7 Posts
I can help with this? I think? Anyways, I'll share how I did some things and others can correct me if I'm wrong.
To get whether someone's a teen, I did this after getting the actor (how to do that depends on your method):
Then, I checked whether that bool was true in an if statement.
For child, just replace all instances of teen with child.
As for getting it to work... have you hooked it up to a listenerevent, or some other trigger? It needs some type of trigger to be called. And, have you used kInstantiator and created the matching XML?
Edit: Oh wait, this is a social interaction... durr...
To get whether someone's a teen, I did this after getting the actor (how to do that depends on your method):
Code:
bool ActorIsTeen = Actor.SimDescription.Teen;
Then, I checked whether that bool was true in an if statement.
Code:
if (ActorIsTeen == true) { (Do what you want to) } else { (What you want to happen otherwise) }
For child, just replace all instances of teen with child.
As for getting it to work... have you hooked it up to a listenerevent, or some other trigger? It needs some type of trigger to be called. And, have you used kInstantiator and created the matching XML?
Edit: Oh wait, this is a social interaction... durr...
Space Pony
#3
7th Jul 2022 at 8:04 PM
Posts: 433
Thanks: 793 in 6 Posts
It seems like you have mixed a template with the setup in the tutorial which you probably didnt want to do.
you can extract this to \S3_TemplateCreator\Templates folder (from The ScriptTemplateCreator program) and use the template with the name ImmediateInteraction_NoUtility to have a project that already has a immediate interaction ready to go you only need to replace the text with something more to your liking.
you can extract this to \S3_TemplateCreator\Templates folder (from The ScriptTemplateCreator program) and use the template with the name ImmediateInteraction_NoUtility to have a project that already has a immediate interaction ready to go you only need to replace the text with something more to your liking.
Attached files:
ImmediateInteraction_NoUtility.7z (1.1 KB, 5 downloads) |
#4
7th Jul 2022 at 8:38 PM
Posts: 106
Thanks: 222 in 5 Posts
Quote: Originally posted by Battery
It seems like you have mixed a template with the setup in the tutorial which you probably didnt want to do. you can extract this to \S3_TemplateCreator\Templates folder (from The ScriptTemplateCreator program) and use the template with the name ImmediateInteraction_NoUtility to have a project that already has a immediate interaction ready to go you only need to replace the text with something more to your liking. |
Lol, I'm not surprised i blotched it, So, what do i need to add from the tutorial to the template? I don't really what to botch it again
#5
7th Jul 2022 at 8:39 PM
Posts: 106
Thanks: 222 in 5 Posts
Quote: Originally posted by YolkSims
I can help with this? I think? Anyways, I'll share how I did some things and others can correct me if I'm wrong. To get whether someone's a teen, I did this after getting the actor (how to do that depends on your method):
Code:
bool ActorIsTeen = Actor.SimDescription.Teen; Then, I checked whether that bool was true in an if statement.
Code:
if (ActorIsTeen == true) { (Do what you want to) } else { (What you want to happen otherwise) } For child, just replace all instances of teen with child. As for getting it to work... have you hooked it up to a listenerevent, or some other trigger? It needs some type of trigger to be called. And, have you used kInstantiator and created the matching XML? Edit: Oh wait, this is a social interaction... durr... |
Yeah, maybe i should have set that, sorry but thank you for the pointers :D
Space Pony
#6
7th Jul 2022 at 8:54 PM
Posts: 433
Thanks: 793 in 6 Posts
Quote: Originally posted by OhCrapItsTBGP
Lol, I'm not surprised i blotched it, So, what do i need to add from the tutorial to the template? I don't really what to botch it again |
While i use SharpDevelop Visual studio should work very similar you can follow these steps:
0. Navigate to Interaction.cs and open after loading your Project into your IDE
1. You can right click on TemplateImmediateInteraction and select Rename to give your interaction another name (this is optional and not needed)
2. change "Hello" to a make the actor say something you like dont forget the "" around it example "Ahoi everyone !"
3. change the "Template ImmediateInteraction" to the name you want to appear in the sims pie menu example "Ask for something"
Then you can compile your project, import it into the package file and test what you already have. if everything works you can think of taking the next step.
Renaming (Step 1) [optional]
#7
7th Jul 2022 at 9:19 PM
Posts: 106
Thanks: 222 in 5 Posts
Quote: Originally posted by Battery
While i use SharpDevelop Visual studio should work very similar you can follow these steps: 0. Navigate to Interaction.cs and open after loading your Project into your IDE 1. You can right click on TemplateImmediateInteraction and select Rename to give your interaction another name (this is optional and not needed) 2. change "Hello" to a make the actor say something you like dont forget the "" around it example "Ahoi everyone !" 3. change the "Template ImmediateInteraction" to the name you want to appear in the sims pie menu example "Ask for something" Then you can compile your project, import it into the package file and test what you already have. if everything works you can think of taking the next step. Renaming (Step 1) [optional] |
Thank you so much! This is going to help a ton! Do you mind giving me pointers on how to make this only between Parent and child? I have a small idea on how to do this but honestly I'm probably absolutely wrong.
Space Pony
#8
7th Jul 2022 at 10:02 PM
Posts: 433
Thanks: 793 in 6 Posts
Quote: Originally posted by OhCrapItsTBGP
Thank you so much! This is going to help a ton! Do you mind giving me pointers on how to make this only between Parent and child? I have a small idea on how to do this but honestly I'm probably absolutely wrong. |
you could use this as your test method within your interaction
Code:
public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if(actor == target){return false;} for (int i = 0; i < actor.SimDescription.Genealogy.Parents.Count; i++) //loop through all parents within the actors genealogy { if (actor.SimDescription.Genealogy.Parents[i].SimDescription.SimDescriptionId == target.SimDescription.SimDescriptionId) // pass if true { return true; } } return false; // else dont allow this itneraction }
be aware that this implementation is probably not optimal performance wise but it is most likely the simplest one
#9
7th Jul 2022 at 10:38 PM
Posts: 106
Thanks: 222 in 5 Posts
Quote: Originally posted by Battery
you could use this as your test method within your interaction
Code:
public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if(actor == target){return false;} for (int i = 0; i < actor.SimDescription.Genealogy.Parents.Count; i++) //loop through all parents within the actors genealogy { if (actor.SimDescription.Genealogy.Parents[i].SimDescription.SimDescriptionId == target.SimDescription.SimDescriptionId) // pass if true { return true; } } return false; // else dont allow this itneraction } be aware that this implementation is probably not optimal performance wise but it is most likely the simplest one |
Thank you! Can i ask one more thing? I keep getting errors in both SharpDevelop and VS (I use both btw) Is there a way to fix that? It's probably easy but I'm kinda dumb sometimes :/
Space Pony
#10
8th Jul 2022 at 3:48 PM
Posts: 433
Thanks: 793 in 6 Posts
Quote: Originally posted by OhCrapItsTBGP
Thank you! Can i ask one more thing? I keep getting errors in both SharpDevelop and VS (I use both btw) Is there a way to fix that? It's probably easy but I'm kinda dumb sometimes :/ |
Hmm i am not sure why you did edit the Main.cs which should have been fine. (unless you want to make your own modding life difficult )
it seems that youve removed the parameter enclosures for the constructor which you need to add back in and you need your method you want to call onworldload having the correct name
Code:
static Simbling() //() was missing [Line13] { World.OnWorldLoadFinishedEventHandler += OnWorldLoaded; // was OnWorldLoadFinished before [Line 15] }
E: you can also mark all the text (ctrl+a) and then hit ctrl+i to "reformat" your code so the { and } match up identation wise again
Who Posted
|