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
Field Researcher
Original Poster
#1 Old 15th Jun 2022 at 10:23 PM
Default My social Interaction animation method does not work.
Hello, so my social interaction animation does not work. Basically I want the interaction to route the sims to each other, play the chat animation for the sims, and depending whether the Target sim has had FirstWoohoo a notification message will pop up to the top right side of the screen.
Code:
public class V : SocialInteraction
    {

        public class Definition : InteractionDefinition<Sim, Sim, V>
        {
            public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                return actor.IsMale;
            }

            public override string GetInteractionName(Sim actor, Sim target, InteractionObjectPair iop)
            {
                return Localization.LocalizeString(actor.IsMale, "MonoDoll/V/V:InteractionName");
            }
        }
        [Tunable]

        public static InteractionDefinition Singleton = new 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


            if (!Target.SimDescription.HadFirstWooHoo)
            {
                AnimateSim("Chat");
                string V = Localization.LocalizeString("MonoDoll/V/V:Message", new object[] { base.Target });
                base.Actor.ShowTNSIfSelectable(V, StyledNotification.NotificationStyle.kSimTalking);
                EventTracker.SendEvent(EventTypeId.kSocialInteraction, Actor, Target);
            }

            else
            {
                AnimateSim("Chat");
                String NonV = Localization.LocalizeString("MonoDoll/V/NonV:Message", new object[] { base.Target });
                base.Actor.ShowTNSIfSelectable(NonVirgin, StyledNotification.NotificationStyle.kSimTalking);
                EventTracker.SendEvent(EventTypeId.kSocialInteraction, Actor, Target);
            } 
            

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

            EndCommodityUpdates(true);
                return true;
            
        }
    }

Code:
private static void AddInteraction(Sim sim)
        {
			if (sim.SimDescription.IsMale)
			if (sim.SimDescription.TeenOrAbove)
            {
			return;
            }
			foreach (InteractionObjectPair interaction in sim.Interactions)
			{
				if (interaction.InteractionDefinition.GetType() == V.Singleton.GetType())
                {
					return;
                }
			}
			sim.AddInteraction(V.Singleton);

Another important thing to note is that I used the ITUN from the "Chat" animation. I used notepad to change the <interaction name> to Namespace.Class+Definition . Additionally, I also changed the Tradeoff name to something else. Not sure if it needs to be specific. I left the Object name and CodeVersion name untouched however. What exactly could be wrong with it? The interaction does not play out. I select it and it goes to queos, but disappears after a few seconds and does not perform any tasks. One thing to keep in mind is that I initinially had the <interaction name> of the ITUN as just the Namespace+Definition of the project and it would atleast play out the sims routing to eachother, but then immediately teleports the Actor Sim away (I then get a trap error message from Nrass). However, now that I changed it to Namespace.Class+Definition it does not do anything. Any help would be appreciated.
Advertisement
Field Researcher
Original Poster
#2 Old 16th Jun 2022 at 3:52 PM
This can be disregarded. I found a different method in applying vanilla animations from Pudding's Face Custom Interaction Part 4 tutorial.
Code:
public override bool Run()
        {
            if (Target.IsFemale)
            {
                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

                if (!Target.SimDescription.HadFirstWooHoo)
                {
                    AcquireStateMachine("social_neutral_talk");
                    EnterStateMachine("social_neutral_talk","Enter", "x","y");
                    SetActor("x", base.Actor);
                    SetActor("y", base.Target);
                    EnterSim("Join");
                    AnimateJoinSims("a2a_soc_talkListen_loop150_");

                    string V = Localization.LocalizeString("MonoDoll/V/V:Message", new object[] { base.Target });
                    base.Actor.ShowTNSIfSelectable(V, StyledNotification.NotificationStyle.kSimTalking);
                    EventTracker.SendEvent(EventTypeId.kSocialInteraction, Actor, Target);
                }



                else if (Target.SimDescription.HadFirstWooHoo)
                {
                    AcquireStateMachine("social_neutral_talk");
                    EnterStateMachine("social_neutral_talk", "Enter", "x", "y");
                    SetActor("x", base.Actor);
                    SetActor("y", base.Target);
                    EnterSim("Join");
                    AnimateJoinSims("a2a_soc_talkListen_Loop150_");

                    String NonV = Localization.LocalizeString("MonoDoll/AskIfV/NonV:Message", new object[] { base.Target });
                    base.Actor.ShowTNSIfSelectable(NonV, StyledNotification.NotificationStyle.kSimTalking);
                    EventTracker.SendEvent(EventTypeId.kSocialInteraction, Actor, Target);
                }


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

                EndCommodityUpdates(true);
                return true;
            }

            return true;
        }
    }

Back to top