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!
Scholar
Original Poster
#1 Old 8th Mar 2018 at 9:21 PM
Default Regarding Interactions and routing
Ok I have to ask, how do I make two Sims route near each other. I've been using

CODE]
base.Actor.RouteTurnToFace(base.Target.Position);
base.Target.RouteTurnToFace(base.Actor.Position);
[/CODE]

Which works but when a Sim is having a group chat the sim won't route exactly near them, it'll be like a foot far and so the animation gets distorted. This is not a problem for when the animations are not making the two sims have any physical contact. But in my interaction I'm making the vampire sim drink from the other sim so it's a problem for me.
Some interactions seem to use jigs. I'm not sure what they are or how to use them. My interactions also currently don't have a Be drank from, that the target usually gets. You seem to need a Jig for that as well. A socialjig I think. Is there any tutorial on that?
Advertisement
Scholar
Original Poster
#2 Old 8th Mar 2018 at 10:02 PM
Oh and in this line
Code:
this.mJig = GlobalFunctions.CreateObjectOutOfWorld("castSpell_jig", ProductVersion.EP7) as SocialJig;

What does "castSpell_jig" mean? Can we put any name here? Why this string?
Scholar
Original Poster
#3 Old 9th Mar 2018 at 3:14 PM
Ok I've managed something. Here is the code.
Code:
public class CompelToDrink : Interaction<Sim,Sim>
        {
            public static InteractionDefinition Singleton = new Definition();
            public ActiveTopic topic = new ActiveTopic();
            public static float kDistanceToForceRouteAway = 2f;
            public static float kCloseEnoughToPlaceJig = 2f;
            SocialJig drinkJig;
            public float socialRadiusWith;

            public override void Cleanup()
            {
                if (this.drinkJig != null)
                {
                    this.drinkJig.Destroy();
                    this.drinkJig = null;
                }
                
            }
            public override bool Run()
            {
                long currentTicks = SimClock.CurrentTicks;
                BeDrankFrom entry = null;
                entry = BeDrankFrom.Singleton.CreateInstance(base.Actor, base.Target, base.GetPriority(), false, false) as BeDrankFrom;
                entry.LinkedInteractionInstance = this;
                entry.Drinker = base.Actor;
                base.Target.InteractionQueue.AddNext(entry);
                if ((base.Actor.GetDistanceToObjectSquared(base.Target) > (kCloseEnoughToPlaceJig * kCloseEnoughToPlaceJig)) && !base.Actor.RouteToPointRadius(base.Target.Position, kCloseEnoughToPlaceJig))
                {
                    return false;
                }
                socialRadiusWith = base.Target.GetSocialRadiusWith(base.Actor);
                this.drinkJig = GlobalFunctions.CreateObjectOutOfWorld("castSpell_jig", ProductVersion.EP7) as SocialJig;
                this.drinkJig.RegisterParticipants(base.Actor, base.Target);
                this.drinkJig.SetOpacity(0f, 0f);
                Vector3 position = base.Actor.Position;
                Vector3 forwardVector = base.Actor.ForwardVector;
                if (!GlobalFunctions.FindGoodLocationNearby(this.drinkJig, ref position, ref forwardVector))
                {
                    return false;
                }
                this.drinkJig.SetPosition(position);
                this.drinkJig.SetForward(forwardVector);
                this.drinkJig.AddToWorld();

                entry.Jig = this.drinkJig as SocialJigTwoPerson;
                while (!this.drinkJig.RouteComplete && !base.Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                {
                    if ((SimClock.ConvertFromTicks(SimClock.CurrentTicks - currentTicks, TimeUnit.Minutes) > 15f) && (base.Actor.GetDistanceToObject(this.drinkJig) < kDistanceToForceRouteAway))
                    {
                        base.Actor.RouteToObjectRadialRange(this.drinkJig, kDistanceToForceRouteAway, kDistanceToForceRouteAway);
                    }
                    Simulator.Sleep(0);
                }
                if (!base.Actor.DoRoute(this.drinkJig.RouteToJigA(base.Actor)))
                {
                    return false;
                }

                Sim actor = base.Actor;
                Sim target = base.Target;
                
                actor.UnregisterGroupTalk();
                target.UnregisterGroupTalk();
                
               base.StandardEntry();
                base.BeginCommodityUpdates();
                base.StartSocialContext();
                if (!target.BuffManager.HasElement((BuffNames)(0xD3C61BD7B1BAF4A4)))
                {
                    base.AcquireStateMachine("vampirehypnoticgaze");
                    base.EnterStateMachine("vampirehypnoticgaze", "Enter", "x", "y");
                    base.SetActor("x", base.Actor);
                    base.SetActor("y", base.Target);
                    base.EnterSim("Join");
                    base.AnimateJoinSims("a2a_soc_vampire_hypnoticGaze_success_");
                    base.FinishLinkedInteraction(true);
                    base.EndCommodityUpdates(true);
                }
               
                base.StandardEntry();
                base.BeginCommodityUpdates();
                base.StartSocialContext();

                base.AcquireStateMachine("DrinkBlood");
                base.EnterStateMachine("DrinkBlood", "Enter", "x", "y");
                base.SetActor("x", base.Actor);
                base.SetActor("y", base.Target);
                base.EnterSim("Join");
                base.AnimateJoinSims("Drink");
                base.FinishLinkedInteraction(true);
                base.EndCommodityUpdates(true);
                base.StandardExit();
                base.WaitForSyncComplete();
                GetStuff.VampireDrinkSuccess2(base.Actor, base.Target, "CompelToDrink", topic, this);
                OccultVampire occultType = actor.OccultManager.GetOccultType(OccultTypes.Vampire) as OccultVampire;
                if ((occultType != null) && (occultType.HuntedSimDescription == target.SimDescription))
                {
                    EventTracker.SendEvent(EventTypeId.kSocialInteraction, actor, target);
                    occultType.ClearHuntedSim();
                }
                EventTracker.SendEvent(EventTypeId.kSocialInteraction, actor, target);
                EventTracker.SendEvent(EventTypeId.kSocialInteraction, Actor);
                return true;
            }
            

           


        }


And this is the Target Sim's Interaction

Code:
public class BeDrankFrom : Interaction<Sim,Sim>
        {
            public Sim mDrinker;
            public SocialJigTwoPerson drinkJig;
            public static InteractionDefinition Singleton = new Definition();

            public override bool Run()
            {
                while (this.drinkJig == null)
                {
                    if (base.Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                    {
                        return false;
                    }
                    Simulator.Sleep(1);
                }
                if (!base.Actor.DoRoute(this.drinkJig.RouteToJigB(base.Actor)))
                {
                    this.mDrinker.AddExitReason(ExitReason.CanceledByScript);
                    return false;
                }
                this.drinkJig.RouteComplete = true;
                base.StandardEntry();
                base.BeginCommodityUpdates();
                base.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                
                base.EndCommodityUpdates(true);
                base.StandardExit();
                return true;
            }

            public Sim Drinker
            {
                set
                {
                    this.mDrinker = value;
                }
            }

            public SocialJigTwoPerson Jig
            {
                set
                {
                    this.drinkJig = value;
                }
            }

            
        }


And this is making them route and the target is also getting the BeDrankFrom like I wanted. But the routing is not near, they're routing as near as Sims route when a witch Sim is Casting a Spell. I want them to route as near as when they would have a normal firnedly or flirty interaction. And I think I know how to do that
This part of the code
Code:
this.drinkJig = GlobalFunctions.CreateObjectOutOfWorld("castSpell_jig", ProductVersion.EP7) as SocialJig; 
does that. I just need to find out what to use inplace of "castSpell_jig" where is that string even from? Hmm.

I'm going to try out this now
Code:
socialRadiusWith = base.Target.GetSocialRadiusWith(base.Actor);
           this.drinkJig = SocialJigTwoPerson.CreateJigForTwoPersonSocial(base.Actor, base.Target, socialRadiusWith);


Hope it works.
Scholar
Original Poster
#4 Old 9th Mar 2018 at 4:16 PM
Ok good news That seems to have done the trick. I'll do some more testing now.
Virtual gardener
staff: administrator
#5 Old 9th Mar 2018 at 9:25 PM
@skydome, if you want to have your custom jigs in the future, you could clone a EA one through S3OC, include that in your S3PE and make sure it has the right name/instances!
Scholar
Original Poster
#6 Old 9th Mar 2018 at 9:32 PM
Quote: Originally posted by Lyralei
@skydome, if you want to have your custom jigs in the future, you could clone a EA one through S3OC, include that in your S3PE and make sure it has the right name/instances!

@Lyralei S3OC? So Jigs are objects? After cloning the Jig I'll have to change it's name and Instance to a custom one right?
Back to top