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 9th Oct 2014 at 9:18 AM Last edited by ArtUrlWWW : 9th Oct 2014 at 2:47 PM.
[SOLVED] How to route sim to sim in Sims 3?
Hello.
I am trying to make ImmediateInteraction to route one sim to another sim.
I have try many combinations of the code, but actor.DoRoute(route) already return False and

Code:
 this.Actor.RouteTurnToFace(this.Target.Position);

showing symbol on the sim, what means "Can't go to there".

For example code:

Code:
using Sims3.Gameplay.Abstracts;
using Sims3.Gameplay.Actors;
using Sims3.Gameplay.Autonomy;
using Sims3.Gameplay.Core;
using Sims3.Gameplay.Interactions;
using Sims3.Gameplay.Interfaces;
using Sims3.SimIFace;
using Sims3.UI;
using System;
using System.Collections.Generic;
using System.Text;

namespace YourNameSpaceHere
{
    internal sealed class GoToSim3 : ImmediateInteraction<Sim, Sim>
    {
        public static readonly InteractionDefinition Singleton = new Definition();

        protected override bool Run()
        {
            base.Actor.ShowTNSIfSelectable("RUNNED", StyledNotification.NotificationStyle.kSimTalking);

            base.Actor.SynchronizationLevel = Sim.SyncLevel.NotStarted;
            base.Target.SynchronizationLevel = Sim.SyncLevel.NotStarted;
            base.Target.InteractionQueue.CancelAllInteractions();
            base.Actor.InteractionQueue.CancelAllInteractions();

            //this.Target.kTimeSinceLastMove = SimClock.ElapsedTime(TimeUnit.Hours);
            Sim actor = this.Actor;
            GameObject target = this.Target;
            Route route = this.Actor.CreateRoute();
            route.ExitReasonsInterrupt = 0;
            route.ReplanAllowed = true;
            route.PlanToPointRadius(target.Position, 0.2f + RandomUtil.GetFloat(0.8f), RouteOrientationPreference.NoPreference, target.LotCurrent.LotId, new int[]
				{
					target.RoomId
				});
            if (route.PlanResult.Succeeded())
            {
                base.Actor.ShowTNSIfSelectable(" Succeeded = TRUE", StyledNotification.NotificationStyle.kSimTalking);
            }
            else
            {
                base.Actor.ShowTNSIfSelectable(" Succeeded = FALSE", StyledNotification.NotificationStyle.kSimTalking);
            }

            if (actor.DoRoute(route))
            {
                base.Actor.ShowTNSIfSelectable(" DoRoute = TRUE", StyledNotification.NotificationStyle.kSimTalking);
            }
            else
            {
                base.Actor.ShowTNSIfSelectable(" DoRoute = FALSE", StyledNotification.NotificationStyle.kSimTalking);
            }


            return true;
        }

        [DoesntRequireTuning]
        private sealed class Definition : ImmediateInteractionDefinition<Sim, Sim, GoToSim3>, IOverrideStartInteractionBehavior
        {
            protected override string GetInteractionName(Sim a, Sim target, InteractionObjectPair interaction)
            {
                return "GoToSim3_5+";
            }

            protected override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                return true;
            }

            public void StartInteraction(Sim actor, IGameObject target)
            {
            }

        }


    }
}



On interaction run I see messages "RUNNED", " Succeeded = TRUE" and " DoRoute = FALSE".
Where is my mistake? How to get going one sim to another?

Sorry my bad English.
Advertisement
Inventor
#2 Old 9th Oct 2014 at 10:36 AM
I'm not sure using an ImmediateInteraction is right, as far as I know
it's for things like turning on a light or any other action that doesn't take time.

Not a permanent solution, but just to see if it works you can try this:
Code:
Sim actor = this.Actor;
GameObject target = this.Target; // maybe this requires a cast or something like that
if (!actor.RouteToObjectRadialRange(target, 0, 2))
{
  return false;
}


I'm willing to help but I don't want to write the missing parts,
can you upload the whole package?
1978 gallons of pancake batter
#3 Old 9th Oct 2014 at 11:14 AM
Quote: Originally posted by Arsil
I'm not sure using an ImmediateInteraction is right, as far as I know
You can be sure, because you're right. ImmediateInteraction is only for stuff that runs instantly without animations etc. ImmediateInteractions aren't even added to the queue.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Lab Assistant
Original Poster
#4 Old 9th Oct 2014 at 11:48 AM
Quote: Originally posted by Arsil
I'm not sure using an ImmediateInteraction is right, as far as I know
it's for things like turning on a light or any other action that doesn't take time.

Not a permanent solution, but just to see if it works you can try this:
Code:
Sim actor = this.Actor;
GameObject target = this.Target; // maybe this requires a cast or something like that
if (!actor.RouteToObjectRadialRange(target, 0, 2))
{
  return false;
}


I'm willing to help but I don't want to write the missing parts,
can you upload the whole package?


Hi.
I tryed to use your code, it's return True and nothing happens - sims both are staying at place, not moving.

I have attached zip archive with C# project of the package lib.
Package contains only this dll (S3SA) + _XML 0x0333406C with code
Code:
<?xml version="1.0" encoding="utf-8"?>
<base>
  <Current_Tuning>
    <kInstantiator value="True" />
  </Current_Tuning>
</base>


If ImmediateInteraction doesn't support animation, then what object I must use instead of ImmediateInteraction?
Attached files:
File Type: zip  Experiments_n1.zip (9.23 MB, 7 downloads) - View custom content
Inventor
#5 Old 9th Oct 2014 at 12:49 PM
Next time please upload the .package file and not 20Mbyte of debugging information,
I lost more time recreating it than writing the interaction.

Here.

Code:
namespace YourNameSpaceHere
{
    internal sealed class GoToSimOne : Interaction<Sim, Sim>
    {
        public static readonly InteractionDefinition Singleton = new Definition();

        protected override bool Run()
        {
            if (!base.Actor.RouteToObjectRadialRange(base.Target, 0, 5))
            {
                return false;
            }
            return true;
        }

        [DoesntRequireTuning]
        private sealed class Definition : InteractionDefinition<Sim, Sim, YourNameSpaceHere.GoToSimOne>
        {
            protected override string GetInteractionName(Sim a, Sim target, InteractionObjectPair interaction)
            {
                return "GoToSim1";
            }

            protected override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (a == target) return false;
                return true;
            }
        }        
    }
}


There's something missing in your Instantiator, it doesn't add the interaction to all sims
(I added a new sim to my household to try the mod and he didn't have it).
Also, in "addInteractions" check if the sim already has that interaction before adding it again
and again. Check THIS for reference.
Lab Assistant
Original Poster
#6 Old 9th Oct 2014 at 2:15 PM
Cool! It's working! Thank you very much!

Quote: Originally posted by Arsil
Next time please upload the .package file and not 20Mbyte of debugging information,
I lost more time recreating it than writing the interaction.

OK, sorry me for that. I am newbie at this forum and I don't know all rules of the forum.

Quote: Originally posted by Arsil
There's something missing in your Instantiator, it doesn't add the interaction to all sims
(I added a new sim to my household to try the mod and he didn't have it).
Also, in "addInteractions" check if the sim already has that interaction before adding it again
and again. Check THIS for reference.

Thank you!
Back to top