Kitabalibar
5th Mar 2012, 12:19 PM
Hello,
I have successfully created some animations with object interaction, and I think there is a lot to do with it. But still, I have been requested quite a few times to create new interactions between Sims. And that is something I would love to do. But for now, I don't manage to create it.
So I looked at the few mods which do this, like Moar Interaction from Buzzler (especially the HelpwithHomework), and the Kolipoki Wand. But those two mods are pretty complex and massive, and hard to read for a beginner like me.
So I wrote a code, which of course does not work, but I would like to know which step I am missing
I know it has to do with the initialization because the interaction does not show up
Here is the code
namespace Sims3.Gameplay.Socializing.Oscar
{
public class MyInteraction
{
public static void AddInteractions(GameObject sim)
{
sim.AddInteraction(SlowDance.Singleton);
}
public class SlowDance : SocialInteraction
{
// Fields
public static readonly InteractionDefinition Singleton = new Definition();
// Methods
protected override bool Run()
{
Sim actor = base.Actor;
Sim target = base.Target;
base.Actor.SynchronizationLevel = Sim.SyncLevel.NotStarted;
base.Target.SynchronizationLevel = Sim.SyncLevel.NotStarted;
base.Target.InteractionQueue.CancelAllInteractions();
base.Actor.RouteTurnToFace(base.Target.Position);
base.AcquireStateMachine("StateDance");
base.SetActor("x", base.Actor);
base.SetActor("y", base.Target);
base.EnterSim("EnterDance");
base.AnimateSim("SlowDancing");
base.AnimateSim("Exit");
Simulator.Sleep(0x23);
AgingManager.Singleton.CancelAgingAlarmsForSim(base.Target);
Simulator.Sleep(0x41);
return true;
}
public bool TestFunction(IGameObject obj, object customData)
{
return !base.Autonomous;
}
// Nested Types
[DoesntRequireTuning]
public sealed class Definition : InteractionDefinition<Sim, Sim, SlowDance>
{
public string MenuText;
// Methods
protected override string GetInteractionName(Sim a, Sim target, InteractionObjectPair interaction)
{
return "Slow Dance";
}
public Definition(string text)
{
this.MenuText = string.Empty;
}
public Definition()
{
this.MenuText = string.Empty;
}
protected override void AddInteractions(InteractionObjectPair iop, Sim actor, Sim target, List<InteractionObjectPair> results)
{
results.Add(new InteractionObjectPair(new SlowDance.Definition("Slow Dance"), iop.Target));
}
protected override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
return true;
}
}
}
}
}
Also I thought that the package file might need something else besides the dll and the clip of the animation..?
I have successfully created some animations with object interaction, and I think there is a lot to do with it. But still, I have been requested quite a few times to create new interactions between Sims. And that is something I would love to do. But for now, I don't manage to create it.
So I looked at the few mods which do this, like Moar Interaction from Buzzler (especially the HelpwithHomework), and the Kolipoki Wand. But those two mods are pretty complex and massive, and hard to read for a beginner like me.
So I wrote a code, which of course does not work, but I would like to know which step I am missing
I know it has to do with the initialization because the interaction does not show up
Here is the code
namespace Sims3.Gameplay.Socializing.Oscar
{
public class MyInteraction
{
public static void AddInteractions(GameObject sim)
{
sim.AddInteraction(SlowDance.Singleton);
}
public class SlowDance : SocialInteraction
{
// Fields
public static readonly InteractionDefinition Singleton = new Definition();
// Methods
protected override bool Run()
{
Sim actor = base.Actor;
Sim target = base.Target;
base.Actor.SynchronizationLevel = Sim.SyncLevel.NotStarted;
base.Target.SynchronizationLevel = Sim.SyncLevel.NotStarted;
base.Target.InteractionQueue.CancelAllInteractions();
base.Actor.RouteTurnToFace(base.Target.Position);
base.AcquireStateMachine("StateDance");
base.SetActor("x", base.Actor);
base.SetActor("y", base.Target);
base.EnterSim("EnterDance");
base.AnimateSim("SlowDancing");
base.AnimateSim("Exit");
Simulator.Sleep(0x23);
AgingManager.Singleton.CancelAgingAlarmsForSim(base.Target);
Simulator.Sleep(0x41);
return true;
}
public bool TestFunction(IGameObject obj, object customData)
{
return !base.Autonomous;
}
// Nested Types
[DoesntRequireTuning]
public sealed class Definition : InteractionDefinition<Sim, Sim, SlowDance>
{
public string MenuText;
// Methods
protected override string GetInteractionName(Sim a, Sim target, InteractionObjectPair interaction)
{
return "Slow Dance";
}
public Definition(string text)
{
this.MenuText = string.Empty;
}
public Definition()
{
this.MenuText = string.Empty;
}
protected override void AddInteractions(InteractionObjectPair iop, Sim actor, Sim target, List<InteractionObjectPair> results)
{
results.Add(new InteractionObjectPair(new SlowDance.Definition("Slow Dance"), iop.Target));
}
protected override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
return true;
}
}
}
}
}
Also I thought that the package file might need something else besides the dll and the clip of the animation..?