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!
Lab Assistant
Original Poster
#1 Old 28th Dec 2020 at 3:38 PM
Default Arrest Mod
Hello, Hi!
I'm trying to add a feature to the Break Into House Mod I uploaded that makes it so when you get caught, you get arrested.
Since the break into house mod uses the interactions from the private investigator profession, it should be enough to use the game's code for "PrivateEyeCaught" and make a separate DLL with that instead of adding to the break into house DLL.
I have gotten the full PrivateEyeCaught code from the game files and I also have a full code for the arrest itself, but I'm not sure how to make it so that when you get caught, the arrest code will "kick in".
Does anyone perhaps know how to do that?
If you need any additonla info, let me know.
Advertisement
Space Pony
#2 Old 28th Dec 2020 at 4:18 PM
Hello xantak22,
after skimming through some of your code i assume the PrivateEyeCaught interaction works for you.

Instead of using the CreateInstance method you may use the CreateInstanceWithCallbacks method and hook your get arrested code to the completed callback.

Im not sure about the creation of an additional dll i would still include everything into one assembly for varios reasons.
Lab Assistant
Original Poster
#3 Old 28th Dec 2020 at 6:02 PM
Quote: Originally posted by Battery
Hello xantak22,
after skimming through some of your code i assume the PrivateEyeCaught interaction works for you.

Instead of using the CreateInstance method you may use the CreateInstanceWithCallbacks method and hook your get arrested code to the completed callback.

Im not sure about the creation of an additional dll i would still include everything into one assembly for varios reasons.

Thank you for the answer. I will try to do something like that, allthough I'm not very good at modding (I'm super new to this), so I can't guarantee that I can make it work. If I can't its not the end of the world, the arrest thing isn't essential for the mod anyways.
Space Pony
#4 Old 28th Dec 2020 at 6:11 PM
Well if you get stuck you can always ask here for help so dont give up if you face a challenge,

god luck with your mod
Lab Assistant
Original Poster
#5 Old 28th Dec 2020 at 9:46 PM
Quote: Originally posted by Battery
Well if you get stuck you can always ask here for help so dont give up if you face a challenge,

god luck with your mod

Thanks.
I have tried a few things, but nothing has really worked. I'm probably in over my head with this and too inexperienced since I kinda just stumbled into the modding world after I found an unfinished code.
One of the many things I'm confused about is if I should use the DLL I have for the arrest code and use it in the Break into house DLL or if I should use the actual arrest code text (the entire code text itself) in the Break into house DLL.
Space Pony
#6 Old 28th Dec 2020 at 10:13 PM
So the callback did not work then ?

you can use it like this
Code:
InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstanceWithCallbacks(s, s, new InteractionPriority(InteractionPriorityLevel.High), false, false, null, new Callback(ArrestSim), null);

public void ArrestSim(Sim s, float x)
{
  //code to arrest sim s
}


Quote:
One of the many things I'm confused about is if I should use the DLL I have for the arrest code and use it in the Break into house DLL or if I should use the actual arrest code text (the entire code text itself) in the Break into house DLL.


That is something you need to decide for yourself. Just using the premade method is simpler and doesnt bloat the codebase but if you mplement everything yourself you have way more options and you can tailor the method to your needs, so in short if the default arrest method does what you need use that else create your own code and use the default as a base to start from. The broadcaster works ? (i did not try your mod in game so i cant tell)
Lab Assistant
Original Poster
#7 Old 28th Dec 2020 at 11:20 PM
Quote: Originally posted by Battery
So the callback did not work then ?

you can use it like this
Code:
InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstanceWithCallbacks(s, s, new InteractionPriority(InteractionPriorityLevel.High), false, false, null, new Callback(ArrestSim), null);

public void ArrestSim(Sim s, float x)
{
  //code to arrest sim s
}




That is something you need to decide for yourself. Just using the premade method is simpler and doesnt bloat the codebase but if you mplement everything yourself you have way more options and you can tailor the method to your needs, so in short if the default arrest method does what you need use that else create your own code and use the default as a base to start from. The broadcaster works ? (i did not try your mod in game so i cant tell)


I tried this method too but it didn't work either, maybe there is something wrong with the arrest code...
Space Pony
#8 Old 28th Dec 2020 at 11:43 PM
You should check if the method gets called at all with this bit of code if not start there
Code:
Sims3.UI.StyledNotification.Show(new Sims3.UI.StyledNotification.Format("Arrest method called", Sims3.UI.StyledNotification.NotificationStyle.kGameMessagePositive));
Lab Assistant
Original Poster
#9 Old 28th Dec 2020 at 11:49 PM
Quote: Originally posted by Battery
You should check if the method gets called at all with this bit of code if not start there
Code:
Sims3.UI.StyledNotification.Show(new Sims3.UI.StyledNotification.Format("Arrest method called", Sims3.UI.StyledNotification.NotificationStyle.kGameMessagePositive));

I guess I can try that as well, but right now I have to go to bed since it is late where I live. Thank you for all your advice
Lab Assistant
Original Poster
#10 Old 29th Dec 2020 at 10:03 AM Last edited by xantak22 : 29th Dec 2020 at 10:57 AM.
Quote: Originally posted by xantak22
I guess I can try that as well, but right now I have to go to bed since it is late where I live. Thank you for all your advice

Sims3.UI.StyledNotification.Show(new Sims3.UI.StyledNotification.Format("Arrest method called", Sims3.UI.StyledNotification.NotificationStyle.kGameMessagePositive));
That bit of code unfortunatley gives a bunch of errors for me when i implement it. Besides, will I need Tuning Files for the arrest code also? (I plopped the full entire code itself, not the dll, into the break into house code). And about the broadcaster: I suppose it works, because the break into house mod in general works.
Also, when I use the callback method you recommended, a lot of the parameters are unused.
Space Pony
#11 Old 29th Dec 2020 at 10:47 AM
Quote: Originally posted by xantak22
That bit of code unfortunatley gives a bunch of errors for me when i implement it. Besides, will I need Tuning Files for the arrest code also? (I plopped the full entire code itself, not the dll, into the break into house code). And about the broadcaster: I suppose it works, because the break into house mod in general works.
Also, when I use the callback method you recommended, a lot of the parameters are unused.


What errors did you get then ?
Have you got all the necessary usings in place ? (If you are using SharpDevelop you can click on the red underlined code and a pencil should appear on the left side of the screen click that and choose the using directives you want)

The unused parameters is not a Problem the header is just there if you need it. Are you sure the broadcaster works since even if the rest of the mod works you cant be sure all of it does.
You should not need tuning files for that Tuning files are generally just for autonomuos Interactions (to this date i have nevr used a single Tuning file in my mods [unless i overlooked one])

What do you mean by "not plopping the dll into the mod " ?
Lab Assistant
Original Poster
#12 Old 29th Dec 2020 at 11:10 AM
Quote: Originally posted by Battery
What errors did you get then ?
Have you got all the necessary usings in place ? (If you are using SharpDevelop you can click on the red underlined code and a pencil should appear on the left side of the screen click that and choose the using directives you want)

The unused parameters is not a Problem the header is just there if you need it. Are you sure the broadcaster works since even if the rest of the mod works you cant be sure all of it does.
You should not need tuning files for that Tuning files are generally just for autonomuos Interactions (to this date i have nevr used a single Tuning file in my mods [unless i overlooked one])

What do you mean by "not plopping the dll into the mod " ?

I'm using Visual Studio. Most of the errors I get is that they don't exist in the current context

I don't know if the broadcaster works and I don't know how to tell if it does. If it doesn't, maybe its easier to instead of adding the arrest code to the break into house code, maybe adding the arrest code to the code for PrivateEyeCaught (the game's version), since the mod uses that.

I have a DLL of the arrest, but in the break into house DLL, I only used the "code" from the arrest DLL, not the arrest DLL itself.
Space Pony
#13 Old 29th Dec 2020 at 11:19 AM
Hmm Visual Studio should have a similar feature its something like ctrl and . if i remember correctly. It seems your errors stem from the missing using directives if you implement them these errors should vanish.

Quote:
I don't know if the broadcaster works and I don't know how to tell if it does.
You can use the message Code snippet i gave you to test that. if you implement it within the broadcaster and you then get a message the broadcaster works. So you did create 2 different assemblies then one for the arrest and one for the main mod ? I would recommend merging these into one then. It also might be easier if you could upload your files or post your code (preferably in spoilertags) here.
Lab Assistant
Original Poster
#14 Old 29th Dec 2020 at 11:27 AM
Quote: Originally posted by Battery
Hmm Visual Studio should have a similar feature its something like ctrl and . if i remember correctly. It seems your errors stem from the missing using directives if you implement them these errors should vanish.

You can use the message Code snippet i gave you to test that. if you implement it within the broadcaster and you then get a message the broadcaster works. So you did create 2 different assemblies then one for the arrest and one for the main mod ? I would recommend merging these into one then. It also might be easier if you could upload your files or post your code (preferably in spoilertags) here.

Sure, I can post the code here, but I don't how to use spoiler tags here.
Space Pony
#15 Old 29th Dec 2020 at 11:30 AM
[ spoiler] your text [/spoiler] remove the first space bewtween [ and spoiler and you got your text in spoilers you can do the same thing with [ code] your code[/code] to format your code a tiny bit better
Lab Assistant
Original Poster
#16 Old 29th Dec 2020 at 11:34 AM
Quote: Originally posted by Battery
[ spoiler] your text [/spoiler] remove the first space bewtween [ and spoiler and you got your text in spoilers you can do the same thing with [ code] your code[/code] to format your code a tiny bit better

Space Pony
#17 Old 29th Dec 2020 at 11:36 AM
remove the first space so its [spoiler]
Lab Assistant
Original Poster
#18 Old 29th Dec 2020 at 11:38 AM
Quote: Originally posted by Battery
remove the first space so its [spoiler]

there we go, can you see it? (The Post above)
Space Pony
#19 Old 29th Dec 2020 at 11:58 AM
Quote: Originally posted by xantak22
there we go, can you see it? (The Post above)


Positive,

i implemented the message text you will need to change some of the access modifiers back since we use different source dlls ( i use and recommend these ones )
Attached files:
File Type: 7z  MyClass.7z (5.0 KB, 3 downloads)
Lab Assistant
Original Poster
#20 Old 29th Dec 2020 at 12:13 PM
Quote: Originally posted by Battery
Positive,

i implemented the message text you will need to change some of the access modifiers back since we use different source dlls ( i use and recommend these ones )


Thank you! I shall try
Lab Assistant
Original Poster
#21 Old 29th Dec 2020 at 12:35 PM
Quote: Originally posted by Battery
Positive,

i implemented the message text you will need to change some of the access modifiers back since we use different source dlls ( i use and recommend these ones )

The message text came up in game. Thank you! So I guess the broadcaster works. Now the question is how to get the arrest thing to work..
Space Pony
#22 Old 29th Dec 2020 at 12:42 PM
Did both messages appear ? there should be 2 messages
if so replace this code
Code:
InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstance(broadcastingObject, s, new InteractionPriority(InteractionPriorityLevel.High), false, true);


with

Code:
InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstanceWithCallbacks(s, s, new InteractionPriority(InteractionPriorityLevel.High), false, false, null, new Callback(ArrestSim), null);


E: "BreakIntoHouseReactionCallback" is the more important message.
Lab Assistant
Original Poster
#23 Old 29th Dec 2020 at 12:54 PM
Quote: Originally posted by Battery
Did both messages appear ? there should be 2 messages
if so replace this code
Code:
InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstance(broadcastingObject, s, new InteractionPriority(InteractionPriorityLevel.High), false, true);


with

Code:
InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstanceWithCallbacks(s, s, new InteractionPriority(InteractionPriorityLevel.High), false, false, null, new Callback(ArrestSim), null);


E: "BreakIntoHouseReactionCallback" is the more important message.


When I do that the (ArrestSim) generates an error, saying I need an object reference for the non static field, method or property
Space Pony
#24 Old 29th Dec 2020 at 1:03 PM
in the file i sent you use

Code:
            private static void Arrest(Sim s, float x)
            {
                throw new NotImplementedException();
            }


you can remove
Code:
            public void ArrestSim(Sim s, float x)
            {
            }
Lab Assistant
Original Poster
#25 Old 29th Dec 2020 at 1:10 PM
Quote: Originally posted by Battery
in the file i sent you use

Code:
            private static void Arrest(Sim s, float x)
            {
                throw new NotImplementedException();
            }


you can remove
Code:
            public void ArrestSim(Sim s, float x)
            {
            }

The same (ArrestSim) as before keeps generating errors for some reason (doesn't exist in current context)
Page 1 of 3
Back to top