- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Regarding Interactions and routing
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Regarding Interactions and routing
Replies: 5 (Who?), Viewed: 2409 times.
#1
8th Mar 2018 at 9:21 PM
Posts: 1,497
Thanks: 4279 in 41 Posts
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
#2
8th Mar 2018 at 10:02 PM
Posts: 1,497
Thanks: 4279 in 41 Posts
Oh and in this line
What does "castSpell_jig" mean? Can we put any name here? Why this string?
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?
#3
9th Mar 2018 at 3:14 PM
Posts: 1,497
Thanks: 4279 in 41 Posts
Ok I've managed something. Here is the code.
And this is the Target Sim's Interaction
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
I'm going to try out this now
Hope it works.
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:
does that. I just need to find out what to use inplace of "castSpell_jig" where is that string even from? Hmm.this.drinkJig = GlobalFunctions.CreateObjectOutOfWorld("castSpell_jig", ProductVersion.EP7) as SocialJig;
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.
#4
9th Mar 2018 at 4:16 PM
Posts: 1,497
Thanks: 4279 in 41 Posts
Ok good news That seems to have done the trick. I'll do some more testing now.
#5
9th Mar 2018 at 9:25 PM
Posts: 3,860
Thanks: 8534 in 67 Posts
@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!
#6
9th Mar 2018 at 9:32 PM
Posts: 1,497
Thanks: 4279 in 41 Posts
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?
Who Posted
|