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 23rd Feb 2020 at 12:21 AM
Default About the Distance Between Sims During Actions
Hello again.
As I said in my previous post, I am developing a mod which can implement a workable swordfight interaction in TS3. However - I've ran into a problem.
The method I chose to try to accomplish this was using a "clone" of the martial arts spar interaction and change the animations to those from TSM. But, during the fight, the two sims are too close together for the animations to work correctly. How could I fix this?
Advertisement
Scholar
#2 Old 23rd Feb 2020 at 8:43 AM
Oh wow you made a lot of progress The distance had to do with social Jigs I believe. I'll have to look at the code more to figure it out.

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Lab Assistant
Original Poster
#3 Old 23rd Feb 2020 at 4:01 PM
To be fair, I've not yet done the coding - I noticed this problem while testing the animations using cmomoney Animation Player.
Lab Assistant
#4 Old 24th Feb 2020 at 5:57 AM
Quote: Originally posted by CyrusBanefort
To be fair, I've not yet done the coding - I noticed this problem while testing the animations using cmomoney Animation Player.


I'm afraid I didn't understand your question, but from what I understand, the sims are very close, right?

The interactions of The Sims 3 have specific distances, that is, they always start at a standard distance and end at a standard distance, which are the same. That is why there is X (which is the yes you are controlling) and Y (which is the other yes, inactive). Testing on AnimationPlayer, you may not have a good idea; therefore, I recommend that you make a standard replacement for some game animation, preferably easy to find, such as the hug.

Make the interaction and then you will have the real distance.
Scholar
#5 Old 24th Feb 2020 at 8:54 AM
Quote: Originally posted by CyrusBanefort
To be fair, I've not yet done the coding - I noticed this problem while testing the animations using cmomoney Animation Player.


ctrl + shift + c then use moveobjects on. After that you can manually move the two Sims to whatever distance you want in buy/build mode. That will give you an idea.

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Lab Assistant
Original Poster
#6 Old 24th Feb 2020 at 4:51 PM
Quote: Originally posted by Druyddark
I'm afraid I didn't understand your question, but from what I understand, the sims are very close, right?

The interactions of The Sims 3 have specific distances, that is, they always start at a standard distance and end at a standard distance, which are the same. That is why there is X (which is the yes you are controlling) and Y (which is the other yes, inactive). Testing on AnimationPlayer, you may not have a good idea; therefore, I recommend that you make a standard replacement for some game animation, preferably easy to find, such as the hug.

Make the interaction and then you will have the real distance.


I've done what you asked. Made an default replacement for the "basic" animation of the Spar interaction, and that was the result:

Screenshots
Scholar
#7 Old 24th Feb 2020 at 7:14 PM
Was this happening for the animation player?

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Lab Assistant
Original Poster
#8 Old 25th Feb 2020 at 1:51 PM Last edited by CyrusBanefort : 26th Feb 2020 at 2:45 AM.
Quote: Originally posted by PuddingFace
Was this happening for the animation player?



@PuddingFace , the problem is not in the animations, but in the Spar interaction. The two actor sims are too close together during the interaction for the animations to play out in a manner that looks right - And that's to be expected, since in TSM, the sims are 1-2 squares apart, while in during the Spar, they are in the square adjacent to one another.
Scholar
#9 Old 26th Feb 2020 at 7:00 AM
The distance can be changed using the Jigs. That's not too big of a problem. But in that picture the animations themselves have turned the Sim from humanoid to a pyramid which is a much bigger problem.

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Lab Assistant
Original Poster
#10 Old 26th Feb 2020 at 1:39 PM Last edited by CyrusBanefort : 26th Feb 2020 at 2:35 PM.
Quote: Originally posted by PuddingFace
The distance can be changed using the Jigs. That's not too big of a problem. But in that picture the animations themselves have turned the Sim from humanoid to a pyramid which is a much bigger problem.


@Puddingface That's just the Wing acessories I'm using on them. I'm using my two angel sims to test the mod. Any place where I could read about Social Jigs?
Screenshots
Scholar
#11 Old 26th Feb 2020 at 2:18 PM
I have not seen much discussion about Jigs. I researched it for my other mod. But don't worry we'll figure out how to make our own.

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Lab Assistant
Original Poster
#12 Old 26th Feb 2020 at 2:35 PM


Here's a more clear pĂ­cture.
Scholar
#13 Old 27th Feb 2020 at 7:02 AM
I will look at the Social Jig used today.

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Lab Assistant
Original Poster
#14 Old 1st Mar 2020 at 2:48 PM
Okay, waiting for it, @PuddingFace
Scholar
#15 Old 1st Mar 2020 at 3:00 PM
Oh I did look at the Jig in compel to drink. I actually used a Jig in that interaction.

BTW can you post your interactions's Run()

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Lab Assistant
Original Poster
#16 Old 1st Mar 2020 at 3:42 PM
Here's it, @Puddingface .
It is basically the same as the run () function from the Martial Arts spar, since I'm still trying to figure out a bit of coding.

Code:
protected override bool Run()
{
    if (!base.SafeToSync())
    {
        return false;
    }
    Lot lotCurrent = base.Actor.LotCurrent;
    ObjectGuid objectId = base.Target.ObjectId;
    Household household = base.Target.Household;
    if ((household != null) && (ReferenceEquals(lotCurrent, base.Actor.LotHome) && !household.IsGreetedOnLot(lotCurrent, objectId)))
    {
        household.AddGreetedLotToHousehold(lotCurrent, objectId);
    }
    base.SocialJig = GlobalFunctions.CreateObjectOutOfWorld("SparJig") as SocialJigTwoPerson;
    if (!base.BeginSocialInteraction(new SocialInteractionB.Definition(null, Localization.LocalizeString("Gameplay/Actors/Sim/Spar:InteractionName", new object[0]), false), true, false))
    {
        return false;
    }
    this.mActorsMartialArtsSkill = base.Actor.SkillManager.GetSkill<MartialArts>(SkillNames.MartialArts);
    this.mTargetsMartialArtsSkill = base.Target.SkillManager.GetSkill<MartialArts>(SkillNames.MartialArts);
    base.StandardEntry();
    this.mActorsMartialArtsSkill.ChangeIntoKarateGi();
    this.mTargetsMartialArtsSkill.ChangeIntoKarateGi();
    base.Actor.LookAtManager.DisableLookAts();
    base.Target.LookAtManager.DisableLookAts();
    base.EnterStateMachine("spar", "Enter", "x", "y");
    base.SetParameter("CanXplaySuperAnimations", this.mActorsMartialArtsSkill.mbCanPlaySuperAnimations);
    base.SetParameter("CanYplaySuperAnimations", this.mTargetsMartialArtsSkill.mbCanPlaySuperAnimations);
    this.RegisterAnimationToScriptEventCallbacks();
    this.EnableWatchInteraction();
    base.AnimateJoinSims("Bow");
    MartialArts.StartDisciplinedFunCommodity(this);
    base.BeginCommodityUpdates();
    this.StartSkillGain();
    this.mCurrentSparState = MartialArts.SparState.StartRound;
    bool succeeded = this.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(this.SparLoopDelegate), base.mCurrentStateMachine);
    this.StopSkillGain();
    this.DisposeVisualEffects();
    base.AnimateSim("Exit");
    this.PostMatchCeremony();
    base.FinishLinkedInteraction(true);
    base.EndCommodityUpdates(succeeded);
    MartialArts.EndDisciplinedFunCommodity(this);
    this.DisableWatchInteraction();
    base.StandardExit();
    base.WaitForSyncComplete();
    return succeeded;
}

 

 
protected override bool Run()
{
    if (!base.SafeToSync())
    {
        return false;
    }
    Lot lotCurrent = base.Actor.LotCurrent;
    ObjectGuid objectId = base.Target.ObjectId;
    Household household = base.Target.Household;
    if ((household != null) && (ReferenceEquals(lotCurrent, base.Actor.LotHome) && !household.IsGreetedOnLot(lotCurrent, objectId)))
    {
        household.AddGreetedLotToHousehold(lotCurrent, objectId);
    }
    base.SocialJig = GlobalFunctions.CreateObjectOutOfWorld("SparJig") as SocialJigTwoPerson;
    if (!base.BeginSocialInteraction(new SocialInteractionB.Definition(null, Localization.LocalizeString("Gameplay/Actors/Sim/Spar:InteractionName", new object[0]), false), true, false))
    {
        return false;
    }
    this.mActorsMartialArtsSkill = base.Actor.SkillManager.GetSkill<MartialArts>(SkillNames.MartialArts);
    this.mTargetsMartialArtsSkill = base.Target.SkillManager.GetSkill<MartialArts>(SkillNames.MartialArts);
    base.StandardEntry();
    this.mActorsMartialArtsSkill.ChangeIntoKarateGi();
    this.mTargetsMartialArtsSkill.ChangeIntoKarateGi();
    base.Actor.LookAtManager.DisableLookAts();
    base.Target.LookAtManager.DisableLookAts();
    base.EnterStateMachine("spar", "Enter", "x", "y");
    base.SetParameter("CanXplaySuperAnimations", this.mActorsMartialArtsSkill.mbCanPlaySuperAnimations);
    base.SetParameter("CanYplaySuperAnimations", this.mTargetsMartialArtsSkill.mbCanPlaySuperAnimations);
    this.RegisterAnimationToScriptEventCallbacks();
    this.EnableWatchInteraction();
    base.AnimateJoinSims("Bow");
    MartialArts.StartDisciplinedFunCommodity(this);
    base.BeginCommodityUpdates();
    this.StartSkillGain();
    this.mCurrentSparState = MartialArts.SparState.StartRound;
    bool succeeded = this.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(this.SparLoopDelegate), base.mCurrentStateMachine);
    this.StopSkillGain();
    this.DisposeVisualEffects();
    base.AnimateSim("Exit");
    this.PostMatchCeremony();
    base.FinishLinkedInteraction(true);
    base.EndCommodityUpdates(succeeded);
    MartialArts.EndDisciplinedFunCommodity(this);
    this.DisableWatchInteraction();
    base.StandardExit();
    base.WaitForSyncComplete();
    return succeeded;
}

 
Space Pony
#17 Old 1st Mar 2020 at 3:55 PM Last edited by Battery : 1st Mar 2020 at 4:27 PM.
Hey @CyrusBanefort,

you could try to create the jig via this code
Code:
  base.SocialJig = CreateJigForTwoPersonSocial(actor, target, 1.25f)

I haven't tested that though

E: try replacing Line 14 with that. if that works but is still to close try 1.68f as the last parameter value instead
Lab Assistant
Original Poster
#18 Old 1st Mar 2020 at 8:59 PM
Yeah, I'm trying to do it, but to no avail. Looks like I'm too inexperienced in coding. Is there a form to increase the distance between the two sims in the Spar interaction proper, so I could just make a default replacement for its animations?
Space Pony
#19 Old 1st Mar 2020 at 9:26 PM
Can you specify what the problem with the code is ?
Do you get errors when trying to compile, is the distance still wrong or does something else unexpected happen ?
Lab Assistant
Original Poster
#20 Old 1st Mar 2020 at 9:39 PM
I get errors when trying to compile. Part of it seems to be thanks to my inexperience in coding, but other things seem a bit strange. For example, some of the errors say that a certain thing is inacessible due to my level of protection, others say that the names "actor" and "target" don't exist in the current context.
Space Pony
#21 Old 1st Mar 2020 at 9:41 PM
Could you post(upload) your whole solution then i have a look at it

btw regarding the protection level you might want to get these references instead of the vanilla ones

https://github.com/Chain-Reaction/N.../Sims3/Compiler
Lab Assistant
Original Poster
#22 Old 1st Mar 2020 at 9:53 PM
Here it is. It's mostly a copy/paste of the martial arts one.
Space Pony
#23 Old 1st Mar 2020 at 9:57 PM Last edited by Battery : 1st Mar 2020 at 10:16 PM.
Wow ok thats way to much i would suggest starting with just the interaction and discarding all the skill stuff. Its getting late here, i will have a closer look at it tomorrow.
Scholar
#24 Old 2nd Mar 2020 at 1:17 PM Last edited by PuddingFace : 2nd Mar 2020 at 1:44 PM.
This is the Compel to Drink 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 = SocialJigTwoPerson.CreateJigForTwoPersonSocial(base.Actor, base.Target, socialRadiusWith);
                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();
                BuffMindControl.BuffInstanceMindControl MindControl = target.BuffManager.GetElement((BuffNames)(0xD3C61BD7B1BAF4A4)) as BuffMindControl.BuffInstanceMindControl;
                if (target.BuffManager.HasElement((BuffNames)(0xD3C61BD7B1BAF4A4)))
                {
                    if (MindControl.mMasterSim != actor.SimDescription.SimDescriptionId)
                    {
                        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_fail_");
                        base.FinishLinkedInteraction(true);
                        base.StandardExit();
                        base.WaitForSyncComplete();
                        base.EndCommodityUpdates(true);
                        if (actor.IsInActiveHousehold)
                        {
                            StyledNotification.Show(new StyledNotification.Format("It appears " + base.Target.FirstName + " has already been compelled by another Vampire ",

                            StyledNotification.NotificationStyle.kSimTalking));
                        }

                        return true;
                    }
                }
                else
                {
                    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.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();
                    

                    EventTracker.SendEvent(EventTypeId.kSocialInteraction, actor, target);

                    GetStuff.VampireDrinkSuccess2(base.Actor, base.Target, "CompelToDrink", topic, this);


                }
                return true;
            }


I'm posting more of the code in a minute.

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Scholar
#25 Old 2nd Mar 2020 at 1:26 PM
And this is the code for the Be Drank From 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;
                }
            }

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Page 1 of 2
Back to top