- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Arrest Mod
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Arrest Mod
Posts: 184
Thanks: 1867 in 7 Posts
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.
Posts: 433
Thanks: 782 in 6 Posts
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.
Posts: 184
Thanks: 1867 in 7 Posts
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.
Posts: 433
Thanks: 782 in 6 Posts
god luck with your mod
Posts: 184
Thanks: 1867 in 7 Posts
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.
Posts: 433
Thanks: 782 in 6 Posts
you can use it like this
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 }
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)
Posts: 184
Thanks: 1867 in 7 Posts
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...
Posts: 433
Thanks: 782 in 6 Posts
Sims3.UI.StyledNotification.Show(new Sims3.UI.StyledNotification.Format("Arrest method called", Sims3.UI.StyledNotification.NotificationStyle.kGameMessagePositive));
Posts: 184
Thanks: 1867 in 7 Posts
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
Posts: 184
Thanks: 1867 in 7 Posts
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.
Posts: 433
Thanks: 782 in 6 Posts
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 " ?
Posts: 184
Thanks: 1867 in 7 Posts
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.
Posts: 433
Thanks: 782 in 6 Posts
I don't know if the broadcaster works and I don't know how to tell if it does. |
Posts: 184
Thanks: 1867 in 7 Posts
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.
Posts: 433
Thanks: 782 in 6 Posts
Posts: 184
Thanks: 1867 in 7 Posts
[ 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 |
using System; using Sims3.Gameplay.Utilities; using Sims3.SimIFace; using Sims3.Gameplay.ActiveCareer.ActiveCareers; using Sims3.Gameplay.Abstracts; using Sims3.Gameplay.Situations; using Sims3.Gameplay.EventSystem; using Sims3.Gameplay.Autonomy; using Sims3.Gameplay.Actors; using Sims3.Gameplay.ActorSystems; using Sims3.Gameplay.Interactions; using Sims3.Gameplay.Core; using Sims3.Gameplay.Socializing; using Sims3.Gameplay.Opportunities; using Sims3.Gameplay.Skills; using Sims3.Gameplay.Interfaces; using System.Collections.Generic; using Sims3.Gameplay.Objects.Vehicles; using Sims3.Gameplay.CAS; using Sims3.Gameplay.Services; using Sims3.SimIFace.CAS; using Sims3.UI; namespace Jadaytime { public class BreakIntoHouse : Interaction<Sim, Lot>, IPreventSocialization { [Tunable] bool kInstantiator = false; // value and type aren't important static BreakIntoHouse() { World.OnWorldLoadFinishedEventHandler += new EventHandler(BreakIntoHouse.SomeEventHandler); } public static void SomeEventHandler(object sender, EventArgs e) { foreach (Lot lot in Sims3.Gameplay.Queries.GetObjects<Lot>()) { AddInteractions(lot); } void AddInteractions(Lot lot) { foreach (InteractionObjectPair pair in lot.Interactions) { if (pair.InteractionDefinition.GetType() == BreakIntoHouse.Singleton.GetType()) { return; } } lot.AddInteraction(BreakIntoHouse.Singleton); } // implement initialization code here } private static ReactionBroadcasterParams kBreakIntoHouseBroadcastParams = new ReactionBroadcasterParams(); private static readonly ulong kIconNameHash = ResourceUtils.HashString64("hud_interactions_ringbell"); [Tunable, TunableComment("Multiplier on how long it takes to pick a lock per Logic level")] private static float[] kPickLockTimeMultiplierPerLogicLevel = new float[] { 1.5f, 1.4f, 1.3f, 1.2f, 1.1f, 1f, 0.9f, 0.8f, 0.7f, 0.6f, 0.5f }; [Tunable, TunableComment("Time to pick a lock in sim minutes")] private static float kTimeToPickLock = 30f; private ReactionBroadcaster mBreakIntoHouseBroadcast; private Door mDoor; public static readonly InteractionDefinition Singleton = new Definition(); private const string sLocalizationKey = "Gameplay/Core/SneakIntoHouse"; private void BreakIntoHouseBroadcasterCreate() { this.mBreakIntoHouseBroadcast = new ReactionBroadcaster(base.Actor, kBreakIntoHouseBroadcastParams, new ReactionBroadcaster.BroadcastCallback(Jadaytime.BreakIntoHouse.BreakIntoHouseReactionCallback)); } private void BreakIntoHouseBroadcasterDestroy() { if (this.mBreakIntoHouseBroadcast != null) { this.mBreakIntoHouseBroadcast.Dispose(); this.mBreakIntoHouseBroadcast = null; } } private static void BreakIntoHouseReactionCallback(Sim s, ReactionBroadcaster rb) { if (!s.InteractionQueue.HasInteractionOfType(PrivateEyeInteractions.PrivateEyeCaught.Singleton)) { Sim broadcastingObject = rb.BroadcastingObject as Sim; if (broadcastingObject != null) { InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstance(broadcastingObject, s, new InteractionPriority(InteractionPriorityLevel.High), false, true); s.InteractionQueue.AddNext(entry); } } } InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstanceWithCallbacks(s, s, new InteractionPriority(InteractionPriorityLevel.High), false, false, null, new Callback(Arrest), null); private static IActor s; private static void Arrest(Sim s, float x) { throw new NotImplementedException(); } public void ArrestSim(Sim s, float x) { } public class ArrestSuspectSituation : RootSituation { // Fields private const InteractionPriorityLevel Priority = InteractionPriorityLevel.CriticalNPCBehavior; private static List<string> SimsBeingArrested = new List<string>(); public Lot ArrestLocation; public Sim Cop; public CarService CopCar; public RabbitHole SimsLocation; public Sim SimToArrest; public IPoliceStation Station; // Methods private ArrestSuspectSituation() { } private ArrestSuspectSituation(Lot lot, Sim simToArrest) : base(lot) { lock (SimsBeingArrested) { if (SimsBeingArrested.Contains(simToArrest.Name)) { base.Exit(); } else { SimsBeingArrested.Add(simToArrest.Name); this.SimToArrest = simToArrest; this.ArrestLocation = lot; this.SimsLocation = RabbitHole.GetRandomRabbitHoleOfType(RabbitHoleType.PoliceStation); base.SetState(new CreateCopAndRoute(this)); } } } internal void CancelArrest() { this.SimToArrest.InteractionQueue.CancelAllInteractions(); for (int i = 0; i < 20; i++) { Simulator.Sleep(10); if (!this.SimToArrest.CurrentInteraction.CancellableByPlayer) { this.SimToArrest.InteractionQueue.CancelAllInteractions(); } } } public static ArrestSuspectSituation Create(Lot lot, Sim simToArrest) => new ArrestSuspectSituation(lot, simToArrest); private SimDescription CreateNewCopFromPool() { List<SimDescription> randomList = new List<SimDescription>(); Police instance = Police.Instance; if (instance != null) { foreach (SimDescription description in instance.Pool) { if (!Police.Instance.IsServiceAssigned(description)) { randomList.Add(description); } } } return ((randomList.Count <= 0) ? null : RandomUtil.GetRandomObjectFromList<SimDescription>(randomList)); } public override void Dispose() { if (this.SimToArrest != null) { lock (SimsBeingArrested) { if (SimsBeingArrested.Contains(this.SimToArrest.Name)) { SimsBeingArrested.Remove(this.SimToArrest.Name); } } } if (this.CopCar != null) { this.CopCar.Destroy(); this.CopCar = null; } base.Dispose(); } protected override void OnParticipantDeleted(Sim participant) { if (ReferenceEquals(participant, this.Cop) || ReferenceEquals(participant, this.SimToArrest)) { base.Exit(); } } // Nested Types private class ArrestSimInRabbitHole : RabbitHole.ArrestSimInRabbitHole { // Methods protected override bool InRabbitHole() { base.StartStages(); base.BeginCommodityUpdates(); base.DoLoop(~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); base.EndCommodityUpdates(true); return true; } } private class CreateCopAndRoute : ChildSituation<ArrestSuspectSituation> { // Methods protected CreateCopAndRoute() { } public CreateCopAndRoute(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { IPoliceStation randomRabbitHoleOfType = (IPoliceStation)RabbitHole.GetRandomRabbitHoleOfType(RabbitHoleType.PoliceStation); if (randomRabbitHoleOfType == null) { base.Exit(); } else { parent.Station = randomRabbitHoleOfType; } SimDescription description = parent.CreateNewCopFromPool(); if (description == null) { base.Exit(); } else { if (description.CreatedSim != null) { parent.Cop = description.CreatedSim; parent.Cop.SwitchToOutfitWithoutSpin(OutfitCategories.Career); } else { SimOutfit outfit = description.GetOutfit(OutfitCategories.Career, 0); parent.Cop = (outfit != null) ? description.Instantiate(Vector3.OutOfWorld, outfit.Key) : description.Instantiate(Vector3.OutOfWorld); } parent.CopCar = CarNpcManager.Singleton.CreateServiceCar(ServiceType.None | ServiceType.Police); base.ForceSituationSpecificInteraction(parent.Cop, parent.Cop, new ArrestSuspectSituation.GoToCulpritsLocation.Definition(base.Parent), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.MakeArrest(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Exit(); } } private class GetCulpritInCar : ChildSituation<ArrestSuspectSituation> { // Methods protected GetCulpritInCar() { } public GetCulpritInCar(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { Sim simToArrest = parent.SimToArrest; Sim cop = parent.Cop; CarService copCar = parent.CopCar; base.ForceSituationSpecificInteraction(base.Parent.CopCar, base.Parent.Cop, new ArrestSuspectSituation.GetInPoliceCar.Definition(base.Parent), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.ThrowInJail(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Parent.CancelArrest(); base.Exit(); } } public sealed class GetInPoliceCar : Interaction<Sim, IGameObject> { // Fields public static readonly InteractionDefinition Singleton = new Definition(); // Methods public override void ConfigureInteraction() { base.CancellableByPlayer = false; } protected override bool Run() { ArrestSuspectSituation arrestSituation = (base.InteractionDefinition as Definition).ArrestSituation; CarService copCar = arrestSituation.CopCar; Sim simToArrest = arrestSituation.SimToArrest; if (base.Actor != simToArrest) { copCar.RouteToAndGetIn(arrestSituation.Cop, true); CarNpcManager.Singleton.DriveToLotInCar(copCar, arrestSituation.Cop, arrestSituation.Station.LotCurrent, false); } else { copCar.RouteToAndGetIn(simToArrest, false); InteractionInstance instance = PoliceSituation.Wait.Singleton.CreateInstance(simToArrest, simToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); simToArrest.InteractionQueue.PushAsContinuation(instance, true); } return true; } // Nested Types [DoesntRequireTuning] public sealed class Definition : InteractionDefinition<Sim, IGameObject, ArrestSuspectSituation.GetInPoliceCar> { // Fields public ArrestSuspectSituation ArrestSituation; // Methods public Definition() { } public Definition(ArrestSuspectSituation situation) { this.ArrestSituation = situation; } protected override string GetInteractionName(Sim a, IGameObject target, InteractionObjectPair interaction) => Localization.LocalizeString(a.IsFemale, "Gameplay/Objects/RabbitHoles/PoliceStation/GoToJail:InteractionName", new object[0]); protected override bool Test(Sim a, IGameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) => true; } } public sealed class GoToCulpritsLocation : Interaction<Sim, IGameObject> { // Fields public static readonly InteractionDefinition Singleton = new Definition(); // Methods protected override bool Run() { Definition interactionDefinition = base.InteractionDefinition as Definition; Sim cop = interactionDefinition.arrestSituation.Cop; CarService copCar = interactionDefinition.arrestSituation.CopCar; Lot arrestLocation = interactionDefinition.arrestSituation.ArrestLocation; if ((copCar == null) || !CarNpcManager.Singleton.DriveToLotInServiceCarWithinTime(copCar, cop, arrestLocation, 10f, true)) { return false; } copCar.GetOut(cop); return true; } // Nested Types [DoesntRequireTuning] public sealed class Definition : InteractionDefinition<Sim, IGameObject, ArrestSuspectSituation.GoToCulpritsLocation> { // Fields public ArrestSuspectSituation arrestSituation; // Methods public Definition() { } public Definition(ArrestSuspectSituation situation) { this.arrestSituation = situation; } protected override string GetInteractionName(Sim a, IGameObject target, InteractionObjectPair interaction) => "PickUpCulprit"; protected override bool Test(Sim a, IGameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) => true; } } private class MakeArrest : ChildSituation<ArrestSuspectSituation> { // Fields public ArrestSuspectSituation arrestSituation; // Methods public MakeArrest() { } public MakeArrest(ArrestSuspectSituation parent) : base(parent) { this.arrestSituation = parent; } public void ArrestFailure(Sim actor, float x) { base.UnrequestWalkStyle(actor, Sim.WalkStyle.Run); base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } public void ArrestFinished(Sim actor, float x) { InteractionInstance entry = new ArrestSuspectSituation.GetInPoliceCar.Definition(this.arrestSituation).CreateInstance(this.arrestSituation.CopCar, this.arrestSituation.SimToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); this.arrestSituation.SimToArrest.InteractionQueue.Add(entry); while (((this.arrestSituation.SimToArrest.GetDistanceToObject(this.arrestSituation.CopCar) + 3f) >= this.arrestSituation.Cop.GetDistanceToObject(this.arrestSituation.CopCar)) && !(this.arrestSituation.SimToArrest.Posture is SittingInVehicle)) { Simulator.Sleep(30); } base.UnrequestWalkStyle(actor, Sim.WalkStyle.Run); base.Parent.SetState(new ArrestSuspectSituation.GetCulpritInCar(base.Parent)); } protected override void CleanUp() { base.UnrequestWalkStyle(base.Parent.Cop, Sim.WalkStyle.Run); base.CleanUp(); } public override void Init(ArrestSuspectSituation parent) { if (base.Parent.SimToArrest == null) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } else { base.RequestWalkStyle(parent.Cop, Sim.WalkStyle.Run); SituationSocial.Definition i = new SituationSocial.Definition("Policeman Express Disappointment", new string[0], null, false); InteractionInstance instance = base.ForceSituationSpecificInteraction(parent.SimToArrest, parent.Cop, i, null, new Callback(this.ArrestFinished), new Callback(this.ArrestFailure), InteractionPriorityLevel.CriticalNPCBehavior); if (instance != null) { instance.CancellableByPlayer = false; } } } } private class RideOffIntoTheSunset : ChildSituation<ArrestSuspectSituation> { // Methods protected RideOffIntoTheSunset() { } public RideOffIntoTheSunset(ArrestSuspectSituation parent) : base(parent) { } private void ExitSituation(Sim actor, float x) { base.Exit(); } public override void Init(ArrestSuspectSituation parent) { base.ForceSituationSpecificInteraction(base.Parent.Lot, base.Parent.Cop, new DriveAwayInServiceCar.Definition(base.Parent.CopCar), null, new Callback(this.ExitSituation), new Callback(this.ExitSituation)); } } private class ThrowInJail : ChildSituation<ArrestSuspectSituation> { // Methods protected ThrowInJail() { } public ThrowInJail(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { Sim simToArrest = parent.SimToArrest; Sim cop = parent.Cop; CarService copCar = parent.CopCar; IPoliceStation target = parent.Station; InteractionInstance entry = target.GetGoToJailDefinition().CreateInstance(target, simToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); simToArrest.AddExitReason(ExitReason.CanceledByScript); simToArrest.InteractionQueue.AddNext(entry); copCar.GetOut(cop); base.ForceSituationSpecificInteraction(target, cop, new RabbitHole.ArrestSimInRabbitHole.Definition(), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); base.Parent.CancelArrest(); } } } public static bool CheckOpportunitiesForLot(Sim actor, ulong targetId) { return true; } public override void Cleanup() { if (this.mDoor != null) { this.mDoor.SetLockType(CommonDoor.tLock.Anybody); this.mDoor = null; } this.BreakIntoHouseBroadcasterDestroy(); base.Cleanup(); } public override ThumbnailKey GetIconKey() { return new ThumbnailKey(new ResourceKey(kIconNameHash, 0x2f7d0004, 0), ThumbnailSize.Medium); } public string GreyedOutTooltipText(Sim simA, Sim simB) { string entryKey = "Gameplay/Socializing/SocialInteractionA:CannotSocializeAtWork"; return Localization.LocalizeString(simB.IsFemale, entryKey, new object[] { simB.SimDescription }); } private static string LocalizeString(string name, params object[] parameters) { return Localization.LocalizeString("Gameplay/Core/SneakIntoHouse:" + name, parameters); } protected override bool Run() { bool succeeded = false; bool flag2 = false; PrivateEye.SwitchToWorkOutfit(base.Actor); if (base.Actor.LotCurrent != base.Target) { Route route = base.Actor.CreateRoute(); if (base.Target.PlanToLotEx(route).Succeeded()) { succeeded = base.Actor.DoRoute(route); flag2 = base.Actor.LotCurrent == base.Target; } } else { flag2 = true; } if (flag2) { Slot slot; int index = MathUtils.Clamp(base.Actor.SkillManager.GetSkillLevel(SkillNames.Logic), 0, 10); this.mDoor = base.Target.FindFrontDoor(); if (!base.Actor.RouteToSlotListAndCheckInUse(this.mDoor, new Slot[] { Door.RoutingSlots.Upgrade_Front, Door.RoutingSlots.Upgrade_Rear }, out slot)) { return false; } this.mDoor.SetLockType(CommonDoor.tLock.Nobody); float duration = (kTimeToPickLock * kPickLockTimeMultiplierPerLogicLevel[index]); base.StandardEntry(); base.BeginCommodityUpdates(); base.EnterStateMachine("PrivateEyeBreakIntoHome", "Enter", "x"); bool paramValue = slot == Door.RoutingSlots.Upgrade_Front; if (this.mDoor is DoorDouble) { paramValue = true; } base.mCurrentStateMachine.SetParameter("usingFrontSlot", paramValue); base.SetActor("Door", this.mDoor); base.AnimateSim("BreakInto"); this.BreakIntoHouseBroadcasterCreate(); succeeded = base.DoTimedLoop(duration); this.BreakIntoHouseBroadcasterDestroy(); base.AnimateSim("Exit"); if (succeeded) { this.SimArrivedAtLot(); Sim.RemoveGoHomeInteractions(base.Actor, false); } base.EndCommodityUpdates(succeeded); base.StandardExit(); } return succeeded; } protected void SimArrivedAtLot() { base.Actor.GreetSimOnLot(base.Target); SneakOntoLotSituation.Create(base.Actor, base.Target, SneakOntoLotSituation.SneakType.WithBroadcaster); EventTracker.SendEvent(EventTypeId.kVisitLot, base.Actor, base.Target); } public bool SocializationAllowed(Sim simA, Sim simB) { return false; } // Nested Types public class Definition : InteractionDefinition<Sim, Lot, Jadaytime.BreakIntoHouse> { // Fields public bool bRingDoorbell = true; // Methods public static bool CanBreakIntoHouse(Sim actor, ulong targetId) { if (actor.HasTrait(TraitNames.Good)) { return false; } return true; } protected override string GetInteractionName(Sim a, Lot target, InteractionObjectPair interaction) { return Jadaytime.BreakIntoHouse.LocalizeString("BreakIntoHouse", new object[0]); } protected override bool Test(Sim a, Lot target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (isAutonomous) { return false; } if (target.IsCommunityLot) { return false; } if (a.IsGreetedOnLot(target)) { return false; } if (!CanBreakIntoHouse(a, target.LotId)) { return false; }
[spoiler]
using System; using Sims3.Gameplay.Utilities; using Sims3.SimIFace; using Sims3.Gameplay.ActiveCareer.ActiveCareers; using Sims3.Gameplay.Abstracts; using Sims3.Gameplay.Situations; using Sims3.Gameplay.EventSystem; using Sims3.Gameplay.Autonomy; using Sims3.Gameplay.Actors; using Sims3.Gameplay.ActorSystems; using Sims3.Gameplay.Interactions; using Sims3.Gameplay.Core; using Sims3.Gameplay.Socializing; using Sims3.Gameplay.Opportunities; using Sims3.Gameplay.Skills; using Sims3.Gameplay.Interfaces; using System.Collections.Generic; using Sims3.Gameplay.Objects.Vehicles; using Sims3.Gameplay.CAS; using Sims3.Gameplay.Services; using Sims3.SimIFace.CAS; using Sims3.UI; namespace Jadaytime { public class BreakIntoHouse : Interaction<Sim, Lot>, IPreventSocialization { [Tunable] bool kInstantiator = false; // value and type aren't important static BreakIntoHouse() { World.OnWorldLoadFinishedEventHandler += new EventHandler(BreakIntoHouse.SomeEventHandler); } public static void SomeEventHandler(object sender, EventArgs e) { foreach (Lot lot in Sims3.Gameplay.Queries.GetObjects<Lot>()) { AddInteractions(lot); } void AddInteractions(Lot lot) { foreach (InteractionObjectPair pair in lot.Interactions) { if (pair.InteractionDefinition.GetType() == BreakIntoHouse.Singleton.GetType()) { return; } } lot.AddInteraction(BreakIntoHouse.Singleton); } // implement initialization code here } private static ReactionBroadcasterParams kBreakIntoHouseBroadcastParams = new ReactionBroadcasterParams(); private static readonly ulong kIconNameHash = ResourceUtils.HashString64("hud_interactions_ringbell"); [Tunable, TunableComment("Multiplier on how long it takes to pick a lock per Logic level")] private static float[] kPickLockTimeMultiplierPerLogicLevel = new float[] { 1.5f, 1.4f, 1.3f, 1.2f, 1.1f, 1f, 0.9f, 0.8f, 0.7f, 0.6f, 0.5f }; [Tunable, TunableComment("Time to pick a lock in sim minutes")] private static float kTimeToPickLock = 30f; private ReactionBroadcaster mBreakIntoHouseBroadcast; private Door mDoor; public static readonly InteractionDefinition Singleton = new Definition(); private const string sLocalizationKey = "Gameplay/Core/SneakIntoHouse"; private void BreakIntoHouseBroadcasterCreate() { this.mBreakIntoHouseBroadcast = new ReactionBroadcaster(base.Actor, kBreakIntoHouseBroadcastParams, new ReactionBroadcaster.BroadcastCallback(Jadaytime.BreakIntoHouse.BreakIntoHouseReactionCallback)); } private void BreakIntoHouseBroadcasterDestroy() { if (this.mBreakIntoHouseBroadcast != null) { this.mBreakIntoHouseBroadcast.Dispose(); this.mBreakIntoHouseBroadcast = null; } } private static void BreakIntoHouseReactionCallback(Sim s, ReactionBroadcaster rb) { if (!s.InteractionQueue.HasInteractionOfType(PrivateEyeInteractions.PrivateEyeCaught.Singleton)) { Sim broadcastingObject = rb.BroadcastingObject as Sim; if (broadcastingObject != null) { InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstance(broadcastingObject, s, new InteractionPriority(InteractionPriorityLevel.High), false, true); s.InteractionQueue.AddNext(entry); } } } InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstanceWithCallbacks(s, s, new InteractionPriority(InteractionPriorityLevel.High), false, false, null, new Callback(Arrest), null); private static IActor s; private static void Arrest(Sim s, float x) { throw new NotImplementedException(); } public void ArrestSim(Sim s, float x) { } public class ArrestSuspectSituation : RootSituation { // Fields private const InteractionPriorityLevel Priority = InteractionPriorityLevel.CriticalNPCBehavior; private static List<string> SimsBeingArrested = new List<string>(); public Lot ArrestLocation; public Sim Cop; public CarService CopCar; public RabbitHole SimsLocation; public Sim SimToArrest; public IPoliceStation Station; // Methods private ArrestSuspectSituation() { } private ArrestSuspectSituation(Lot lot, Sim simToArrest) : base(lot) { lock (SimsBeingArrested) { if (SimsBeingArrested.Contains(simToArrest.Name)) { base.Exit(); } else { SimsBeingArrested.Add(simToArrest.Name); this.SimToArrest = simToArrest; this.ArrestLocation = lot; this.SimsLocation = RabbitHole.GetRandomRabbitHoleOfType(RabbitHoleType.PoliceStation); base.SetState(new CreateCopAndRoute(this)); } } } internal void CancelArrest() { this.SimToArrest.InteractionQueue.CancelAllInteractions(); for (int i = 0; i < 20; i++) { Simulator.Sleep(10); if (!this.SimToArrest.CurrentInteraction.CancellableByPlayer) { this.SimToArrest.InteractionQueue.CancelAllInteractions(); } } } public static ArrestSuspectSituation Create(Lot lot, Sim simToArrest) => new ArrestSuspectSituation(lot, simToArrest); private SimDescription CreateNewCopFromPool() { List<SimDescription> randomList = new List<SimDescription>(); Police instance = Police.Instance; if (instance != null) { foreach (SimDescription description in instance.Pool) { if (!Police.Instance.IsServiceAssigned(description)) { randomList.Add(description); } } } return ((randomList.Count <= 0) ? null : RandomUtil.GetRandomObjectFromList<SimDescription>(randomList)); } public override void Dispose() { if (this.SimToArrest != null) { lock (SimsBeingArrested) { if (SimsBeingArrested.Contains(this.SimToArrest.Name)) { SimsBeingArrested.Remove(this.SimToArrest.Name); } } } if (this.CopCar != null) { this.CopCar.Destroy(); this.CopCar = null; } base.Dispose(); } protected override void OnParticipantDeleted(Sim participant) { if (ReferenceEquals(participant, this.Cop) || ReferenceEquals(participant, this.SimToArrest)) { base.Exit(); } } // Nested Types private class ArrestSimInRabbitHole : RabbitHole.ArrestSimInRabbitHole { // Methods protected override bool InRabbitHole() { base.StartStages(); base.BeginCommodityUpdates(); base.DoLoop(~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); base.EndCommodityUpdates(true); return true; } } private class CreateCopAndRoute : ChildSituation<ArrestSuspectSituation> { // Methods protected CreateCopAndRoute() { } public CreateCopAndRoute(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { IPoliceStation randomRabbitHoleOfType = (IPoliceStation)RabbitHole.GetRandomRabbitHoleOfType(RabbitHoleType.PoliceStation); if (randomRabbitHoleOfType == null) { base.Exit(); } else { parent.Station = randomRabbitHoleOfType; } SimDescription description = parent.CreateNewCopFromPool(); if (description == null) { base.Exit(); } else { if (description.CreatedSim != null) { parent.Cop = description.CreatedSim; parent.Cop.SwitchToOutfitWithoutSpin(OutfitCategories.Career); } else { SimOutfit outfit = description.GetOutfit(OutfitCategories.Career, 0); parent.Cop = (outfit != null) ? description.Instantiate(Vector3.OutOfWorld, outfit.Key) : description.Instantiate(Vector3.OutOfWorld); } parent.CopCar = CarNpcManager.Singleton.CreateServiceCar(ServiceType.None | ServiceType.Police); base.ForceSituationSpecificInteraction(parent.Cop, parent.Cop, new ArrestSuspectSituation.GoToCulpritsLocation.Definition(base.Parent), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.MakeArrest(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Exit(); } } private class GetCulpritInCar : ChildSituation<ArrestSuspectSituation> { // Methods protected GetCulpritInCar() { } public GetCulpritInCar(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { Sim simToArrest = parent.SimToArrest; Sim cop = parent.Cop; CarService copCar = parent.CopCar; base.ForceSituationSpecificInteraction(base.Parent.CopCar, base.Parent.Cop, new ArrestSuspectSituation.GetInPoliceCar.Definition(base.Parent), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.ThrowInJail(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Parent.CancelArrest(); base.Exit(); } } public sealed class GetInPoliceCar : Interaction<Sim, IGameObject> { // Fields public static readonly InteractionDefinition Singleton = new Definition(); // Methods public override void ConfigureInteraction() { base.CancellableByPlayer = false; } protected override bool Run() { ArrestSuspectSituation arrestSituation = (base.InteractionDefinition as Definition).ArrestSituation; CarService copCar = arrestSituation.CopCar; Sim simToArrest = arrestSituation.SimToArrest; if (base.Actor != simToArrest) { copCar.RouteToAndGetIn(arrestSituation.Cop, true); CarNpcManager.Singleton.DriveToLotInCar(copCar, arrestSituation.Cop, arrestSituation.Station.LotCurrent, false); } else { copCar.RouteToAndGetIn(simToArrest, false); InteractionInstance instance = PoliceSituation.Wait.Singleton.CreateInstance(simToArrest, simToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); simToArrest.InteractionQueue.PushAsContinuation(instance, true); } return true; } // Nested Types [DoesntRequireTuning] public sealed class Definition : InteractionDefinition<Sim, IGameObject, ArrestSuspectSituation.GetInPoliceCar> { // Fields public ArrestSuspectSituation ArrestSituation; // Methods public Definition() { } public Definition(ArrestSuspectSituation situation) { this.ArrestSituation = situation; } protected override string GetInteractionName(Sim a, IGameObject target, InteractionObjectPair interaction) => Localization.LocalizeString(a.IsFemale, "Gameplay/Objects/RabbitHoles/PoliceStation/GoToJail:InteractionName", new object[0]); protected override bool Test(Sim a, IGameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) => true; } } public sealed class GoToCulpritsLocation : Interaction<Sim, IGameObject> { // Fields public static readonly InteractionDefinition Singleton = new Definition(); // Methods protected override bool Run() { Definition interactionDefinition = base.InteractionDefinition as Definition; Sim cop = interactionDefinition.arrestSituation.Cop; CarService copCar = interactionDefinition.arrestSituation.CopCar; Lot arrestLocation = interactionDefinition.arrestSituation.ArrestLocation; if ((copCar == null) || !CarNpcManager.Singleton.DriveToLotInServiceCarWithinTime(copCar, cop, arrestLocation, 10f, true)) { return false; } copCar.GetOut(cop); return true; } // Nested Types [DoesntRequireTuning] public sealed class Definition : InteractionDefinition<Sim, IGameObject, ArrestSuspectSituation.GoToCulpritsLocation> { // Fields public ArrestSuspectSituation arrestSituation; // Methods public Definition() { } public Definition(ArrestSuspectSituation situation) { this.arrestSituation = situation; } protected override string GetInteractionName(Sim a, IGameObject target, InteractionObjectPair interaction) => "PickUpCulprit"; protected override bool Test(Sim a, IGameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) => true; } } private class MakeArrest : ChildSituation<ArrestSuspectSituation> { // Fields public ArrestSuspectSituation arrestSituation; // Methods public MakeArrest() { } public MakeArrest(ArrestSuspectSituation parent) : base(parent) { this.arrestSituation = parent; } public void ArrestFailure(Sim actor, float x) { base.UnrequestWalkStyle(actor, Sim.WalkStyle.Run); base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } public void ArrestFinished(Sim actor, float x) { InteractionInstance entry = new ArrestSuspectSituation.GetInPoliceCar.Definition(this.arrestSituation).CreateInstance(this.arrestSituation.CopCar, this.arrestSituation.SimToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); this.arrestSituation.SimToArrest.InteractionQueue.Add(entry); while (((this.arrestSituation.SimToArrest.GetDistanceToObject(this.arrestSituation.CopCar) + 3f) >= this.arrestSituation.Cop.GetDistanceToObject(this.arrestSituation.CopCar)) && !(this.arrestSituation.SimToArrest.Posture is SittingInVehicle)) { Simulator.Sleep(30); } base.UnrequestWalkStyle(actor, Sim.WalkStyle.Run); base.Parent.SetState(new ArrestSuspectSituation.GetCulpritInCar(base.Parent)); } protected override void CleanUp() { base.UnrequestWalkStyle(base.Parent.Cop, Sim.WalkStyle.Run); base.CleanUp(); } public override void Init(ArrestSuspectSituation parent) { if (base.Parent.SimToArrest == null) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } else { base.RequestWalkStyle(parent.Cop, Sim.WalkStyle.Run); SituationSocial.Definition i = new SituationSocial.Definition("Policeman Express Disappointment", new string[0], null, false); InteractionInstance instance = base.ForceSituationSpecificInteraction(parent.SimToArrest, parent.Cop, i, null, new Callback(this.ArrestFinished), new Callback(this.ArrestFailure), InteractionPriorityLevel.CriticalNPCBehavior); if (instance != null) { instance.CancellableByPlayer = false; } } } } private class RideOffIntoTheSunset : ChildSituation<ArrestSuspectSituation> { // Methods protected RideOffIntoTheSunset() { } public RideOffIntoTheSunset(ArrestSuspectSituation parent) : base(parent) { } private void ExitSituation(Sim actor, float x) { base.Exit(); } public override void Init(ArrestSuspectSituation parent) { base.ForceSituationSpecificInteraction(base.Parent.Lot, base.Parent.Cop, new DriveAwayInServiceCar.Definition(base.Parent.CopCar), null, new Callback(this.ExitSituation), new Callback(this.ExitSituation)); } } private class ThrowInJail : ChildSituation<ArrestSuspectSituation> { // Methods protected ThrowInJail() { } public ThrowInJail(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { Sim simToArrest = parent.SimToArrest; Sim cop = parent.Cop; CarService copCar = parent.CopCar; IPoliceStation target = parent.Station; InteractionInstance entry = target.GetGoToJailDefinition().CreateInstance(target, simToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); simToArrest.AddExitReason(ExitReason.CanceledByScript); simToArrest.InteractionQueue.AddNext(entry); copCar.GetOut(cop); base.ForceSituationSpecificInteraction(target, cop, new RabbitHole.ArrestSimInRabbitHole.Definition(), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); base.Parent.CancelArrest(); } } } public static bool CheckOpportunitiesForLot(Sim actor, ulong targetId) { return true; } public override void Cleanup() { if (this.mDoor != null) { this.mDoor.SetLockType(CommonDoor.tLock.Anybody); this.mDoor = null; } this.BreakIntoHouseBroadcasterDestroy(); base.Cleanup(); } public override ThumbnailKey GetIconKey() { return new ThumbnailKey(new ResourceKey(kIconNameHash, 0x2f7d0004, 0), ThumbnailSize.Medium); } public string GreyedOutTooltipText(Sim simA, Sim simB) { string entryKey = "Gameplay/Socializing/SocialInteractionA:CannotSocializeAtWork"; return Localization.LocalizeString(simB.IsFemale, entryKey, new object[] { simB.SimDescription }); } private static string LocalizeString(string name, params object[] parameters) { return Localization.LocalizeString("Gameplay/Core/SneakIntoHouse:" + name, parameters); } protected override bool Run() { bool succeeded = false; bool flag2 = false; PrivateEye.SwitchToWorkOutfit(base.Actor); if (base.Actor.LotCurrent != base.Target) { Route route = base.Actor.CreateRoute(); if (base.Target.PlanToLotEx(route).Succeeded()) { succeeded = base.Actor.DoRoute(route); flag2 = base.Actor.LotCurrent == base.Target; } } else { flag2 = true; } if (flag2) { Slot slot; int index = MathUtils.Clamp(base.Actor.SkillManager.GetSkillLevel(SkillNames.Logic), 0, 10); this.mDoor = base.Target.FindFrontDoor(); if (!base.Actor.RouteToSlotListAndCheckInUse(this.mDoor, new Slot[] { Door.RoutingSlots.Upgrade_Front, Door.RoutingSlots.Upgrade_Rear }, out slot)) { return false; } this.mDoor.SetLockType(CommonDoor.tLock.Nobody); float duration = (kTimeToPickLock * kPickLockTimeMultiplierPerLogicLevel[index]); base.StandardEntry(); base.BeginCommodityUpdates(); base.EnterStateMachine("PrivateEyeBreakIntoHome", "Enter", "x"); bool paramValue = slot == Door.RoutingSlots.Upgrade_Front; if (this.mDoor is DoorDouble) { paramValue = true; } base.mCurrentStateMachine.SetParameter("usingFrontSlot", paramValue); base.SetActor("Door", this.mDoor); base.AnimateSim("BreakInto"); this.BreakIntoHouseBroadcasterCreate(); succeeded = base.DoTimedLoop(duration); this.BreakIntoHouseBroadcasterDestroy(); base.AnimateSim("Exit"); if (succeeded) { this.SimArrivedAtLot(); Sim.RemoveGoHomeInteractions(base.Actor, false); } base.EndCommodityUpdates(succeeded); base.StandardExit(); } return succeeded; } protected void SimArrivedAtLot() { base.Actor.GreetSimOnLot(base.Target); SneakOntoLotSituation.Create(base.Actor, base.Target, SneakOntoLotSituation.SneakType.WithBroadcaster); EventTracker.SendEvent(EventTypeId.kVisitLot, base.Actor, base.Target); } public bool SocializationAllowed(Sim simA, Sim simB) { return false; } // Nested Types public class Definition : InteractionDefinition<Sim, Lot, Jadaytime.BreakIntoHouse> { // Fields public bool bRingDoorbell = true; // Methods public static bool CanBreakIntoHouse(Sim actor, ulong targetId) { if (actor.HasTrait(TraitNames.Good)) { return false; } return true; } protected override string GetInteractionName(Sim a, Lot target, InteractionObjectPair interaction) { return Jadaytime.BreakIntoHouse.LocalizeString("BreakIntoHouse", new object[0]); } protected override bool Test(Sim a, Lot target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (isAutonomous) { return false; } if (target.IsCommunityLot) { return false; } if (a.IsGreetedOnLot(target)) { return false; } if (!CanBreakIntoHouse(a, target.LotId)) { return false; } return true; } } } }
Posts: 433
Thanks: 782 in 6 Posts
Posts: 184
Thanks: 1867 in 7 Posts
remove the first space so its [spoiler] |
there we go, can you see it? (The Post above)
Posts: 433
Thanks: 782 in 6 Posts
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 )
MyClass.7z (5.0 KB, 3 downloads) |
Posts: 184
Thanks: 1867 in 7 Posts
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
Posts: 184
Thanks: 1867 in 7 Posts
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..
Posts: 433
Thanks: 782 in 6 Posts
if so replace this code
InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstance(broadcastingObject, s, new InteractionPriority(InteractionPriorityLevel.High), false, true);
with
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.
Posts: 184
Thanks: 1867 in 7 Posts
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
Posts: 433
Thanks: 782 in 6 Posts
private static void Arrest(Sim s, float x) { throw new NotImplementedException(); }
you can remove
public void ArrestSim(Sim s, float x) { }
Posts: 184
Thanks: 1867 in 7 Posts
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)
Who Posted
|