Home | Download | Discussion | Help | Site Map | New Posts | Sign in
Replies: 12 (Who?), Viewed: 2786 times.
Test Subject
Original Poster
#1 Old 25th Feb 2012 at 8:10 AM
Default Animation with Object
Hello everyone,

I am quite knew to the modding part of the Sims 3, but I would like to learn more about it!
I would like to create animations interacting with objects. I don't really know if that is possible? I have already read a few tutorials on this website, and I have been able to add knew animations to the game thanks to the great Animation Player by cmomoney
I've read this tutorial, but I could not manage to make it work (my finalized package make the game crash...)
I've also read Buzzler's tutorial on object modding and managed to apply it, but I don't see how I could add an animation inside the code, or if it this way? I guess the process should also involve Jazz?
Any help would be really great!
Advertisement
Test Subject
#2 Old 25th Feb 2012 at 4:16 PM
Quote:
Originally Posted by Kitabalibar
Hello everyone,

I am quite knew to the modding part of the Sims 3, but I would like to learn more about it!
I would like to create animations interacting with objects. I don't really know if that is possible? I have already read a few tutorials on this website, and I have been able to add knew animations to the game thanks to the great Animation Player by cmomoney
I've read this tutorial, but I could not manage to make it work (my finalized package make the game crash...)
I've also read Buzzler's tutorial on object modding and managed to apply it, but I don't see how I could add an animation inside the code, or if it this way? I guess the process should also involve Jazz?
Any help would be really great!


can you show us the package ? because I guess there is a problem with your OBJK or your script ! It's a common errors you know !
Slow is my MO
staff: administrator
#3 Old 25th Feb 2012 at 4:19 PM
Quote:
Originally Posted by Kitabalibar
Hello everyone,

I am quite knew to the modding part of the Sims 3, but I would like to learn more about it!
I would like to create animations interacting with objects. I don't really know if that is possible? I have already read a few tutorials on this website, and I have been able to add knew animations to the game thanks to the great Animation Player by cmomoney
I've read this tutorial, but I could not manage to make it work (my finalized package make the game crash...)
I've also read Buzzler's tutorial on object modding and managed to apply it, but I don't see how I could add an animation inside the code, or if it this way? I guess the process should also involve Jazz?
Any help would be really great!


I have a tutorial in process for this - I hope to get the object and steps to reproduce out by the end of the month.

More downloads by Leesester, BoilingOil and others at Leefish.nl | My Stuff at Leefish.nl | LeeFish RSS | Sims4 News Blog | TumblinLeefish
Test Subject
Original Poster
#4 Old 25th Feb 2012 at 4:28 PM
Ok after digging deeper in the forum I found out that the tutorial here http://www.modthesims.info/wiki.php...stom_Animations was outdated and that now you have to put a namespace include Sims3.Gameplay.Objects (by the way it would be cool to update it with this information !). So now, my game loads correctly and I am able to buy scripted item.
The problem though is that the animation do not show up. It is almost a copy/past from the tutorial quoted before

I added the bolded line because I saw on other posts that It might explain why the script interaction would not show, but now, instead of my own interaction, it is the standard interaction which are displayed..

Code:
namespace Sims3.Gameplay.Objects.Oscar
{

public class AnimTutorial : GameObject, IGameObject, IScriptObject, IScriptLogic, IHasScriptProxy, IObjectUI, IExportableContent
{
/*[Tunable, TunableComment("Range: Positive integers. Description: Maximum number of Sims that can wait in line.")]
private static int kMaximumNumberOfSimsInLine = 0x3;
[TunableComment("Range: Positive floats. Description: Amount of Sim minutes a Sim will wait in line before timing out and exiting."), Tunable]
public static float kTimeToWaitInLine = 15f;
public SimQueue Line = new SimQueue(SimQueue.WaitLocation.HangAroundNearObject, kMaximumNumberOfSimsInLine);*/

protected Sim mRevealingSim;

public override void OnStartup()
{
base.OnStartup();
base.AddInteraction(DoAnimation.Singleton);
}

public bool RunAnimation(InteractionInstance interaction, Sim Actor)
{
/*if (!this.Line.WaitForTurn(interaction, SimQueue.WaitBehavior.Default, ~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), kTimeToWaitInLine))
{
return false;
}
if (!Actor.RouteToSlotAndCheckInUse(this, Slots.Hash("Routing")))
{
return false;
}*/
interaction.StandardEntry();
if (Actor.SimDescription.ChildOrAbove)
{
interaction.AcquireStateMachine("animtutorialjazz");
//interaction.UseAutoParameters(new TraitNames[] { TraitNames.Clumsy, TraitNames.HotHeaded, TraitNames.Unlucky });
interaction.SetActor("x", Actor);
//interaction.SetActor("object", this);
interaction.EnterSim("Enter");
interaction.AnimateSim("OurAnim");
}
return true;
}

public bool FinishAnimation(InteractionInstance interaction, Sim Actor)
{
if (Actor.SimDescription.ChildOrAbove)
{
interaction.AnimateSim("Exit");
}
interaction.StandardExit();

return true;
}

public class DoAnimation : Interaction<Sim, AnimTutorial>
{
// Fields
public static readonly InteractionDefinition Singleton = new Definition();

// Methods
protected override bool Run()
{
//base.BeginCommodityUpdates();
base.Target.RunAnimation(this, base.Actor);
base.Target.FinishAnimation(this, base.Actor);
//base.EndCommodityUpdates(true);
return true;
}

// Nested Types
private sealed class Definition : InteractionDefinition<Sim, AnimTutorial, AnimTutorial.DoAnimation>
{
// Methods
protected override string GetInteractionName(Sim actor, AnimTutorial target, InteractionObjectPair iop)
{
return "Do Animation";
}

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

}

[DoesntRequireTuning]
private sealed class ForceDefinition : InteractionDefinition<Sim, AnimTutorial, AnimTutorial.DoAnimation>
{
// Methods
protected override bool Test(Sim a, AnimTutorial target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
return true;
}
}
}

}
}


your help is more than welcomed
Test Subject
#5 Old 25th Feb 2012 at 4:42 PM
What is your OBJK script string?

For example my Sims3.Gameplay.Objects.Decorations.Mimics.TalkingRug2x1.TalkingRug
Test Subject
Original Poster
#6 Old 25th Feb 2012 at 4:46 PM
Sims3.Gameplay.Objects.Oscar.AnimTutorial is the OBJK script string. So I used Sims3.Gameplay.Objects.Oscar to replace the {namespace} of the tutorial and AnimTutorial for the {ObjectClass}.
But I did the "talkingbear" tutorial and did succesfully import the object in the game with the working interaction.
Test Subject
#7 Old 25th Feb 2012 at 4:53 PM Last edited by abd123 : 25th Feb 2012 at 5:22 PM. Reason: beace = Because
Quote:
Originally Posted by Kitabalibar
Sims3.Gameplay.Objects.Oscar.AnimTutorial is the OBJK script string. So I used Sims3.Gameplay.Objects.Oscar to replace the {namespace} of the tutorial and AnimTutorial for the {ObjectClass}.
But I did the "talkingbear" tutorial and did succesfully import the object in the game with the working interaction.


It worked for me! can I check your package? Because I think they could be something wrong with your package.

Don't worry I will not steal your work I will just look for your mistake that's all ! :D
Test Subject
Original Poster
#8 Old 26th Feb 2012 at 4:03 AM Last edited by Kitabalibar : 26th Feb 2012 at 4:23 AM.
Ok I have restarted from the working script of the talking teddy and now the animation works !
Here is the code of the working script:
Code:

namespace Sims3.Gameplay.Objects.Miscellaneous.Oscar01
{
public class TalkingTeddy : StuffedAnimal
{
/*[Tunable, TunableComment("Range: Positive integers. Description: Maximum number of Sims that can wait in line.")]
private static int kMaximumNumberOfSimsInLine = 0x3;
[TunableComment("Range: Positive floats. Description: Amount of Sim minutes a Sim will wait in line before timing out and exiting."), Tunable]
public static float kTimeToWaitInLine = 15f;
public SimQueue Line = new SimQueue(SimQueue.WaitLocation.HangAroundNearObject, kMaximumNumberOfSimsInLine);*/

protected Sim mRevealingSim;

public override void OnStartup()
{
base.AddInteraction(DoAnimation.Singleton);
}

public bool RunAnimation(InteractionInstance interaction, Sim Actor)
{
/*if (!this.Line.WaitForTurn(interaction, SimQueue.WaitBehavior.Default, ~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), kTimeToWaitInLine))
{
return false;
}
if (!Actor.RouteToSlotAndCheckInUse(this, Slots.Hash("Routing")))
{
return false;
}*/
interaction.StandardEntry();
if (Actor.SimDescription.ChildOrAbove)
{
interaction.AcquireStateMachine("animtutorialjazz");
//interaction.UseAutoParameters(new TraitNames[] { TraitNames.Clumsy, TraitNames.HotHeaded, TraitNames.Unlucky });
interaction.SetActor("x", Actor);
//interaction.SetActor("object", this);
interaction.EnterSim("Enter");
interaction.AnimateSim("OurAnim");
}
return true;
}

public bool FinishAnimation(InteractionInstance interaction, Sim Actor)
{
if (Actor.SimDescription.ChildOrAbove)
{
interaction.AnimateSim("Exit");
}
interaction.StandardExit();

return true;
}

public class DoAnimation : Interaction<Sim, TalkingTeddy>
{
// Fields
public static readonly InteractionDefinition Singleton = new Definition();

// Methods
protected override bool Run()
{
//base.BeginCommodityUpdates();
base.Target.RunAnimation(this, base.Actor);
base.Target.FinishAnimation(this, base.Actor);
//base.EndCommodityUpdates(true);
return true;
}

// Nested Types
private sealed class Definition : InteractionDefinition<Sim, TalkingTeddy, TalkingTeddy.DoAnimation>
{
// Methods
protected override string GetInteractionName(Sim actor, TalkingTeddy target, InteractionObjectPair iop)
{
return "Do Animation";
}

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

}

[DoesntRequireTuning]
private sealed class ForceDefinition : InteractionDefinition<Sim, TalkingTeddy, TalkingTeddy.DoAnimation>
{
// Methods
protected override bool Test(Sim a, TalkingTeddy target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
return true;
}
}
}
}
}


The next step is to learn to use Jazz better, but I cannot find any tutorial on Jazz.. What is the best way to learn it?
My goal would be to try to create interaction with an object
For that I suppose that the code must create a new machine state for the sim and a new machine state for the object as well?
I'd love to know if you have resources on Jazz scripts

Thanks for your help
Test Subject
Original Poster
#9 Old 26th Feb 2012 at 5:08 PM
Ok now I run into a new problem, I want to go to my object first and then launch the animation.
So I looked at the codes and found a way to setup the route but the problem is that when I run the action, the sims immediately start my custom anime.
I think an easy but not very effective way would be to add some delay? But I don't know what procedure would do that..
Otherwise I would need a wait until radius reached or something like that?
Anyone knows a procedure that could proceed that way?

Here is my run
Code:

protected override bool Run()
{
if (!base.Target.Route(this))
{
return false;
}
base.Target.RunAnimation(this, base.Actor);
base.Target.FinishAnimation(this, base.Actor);
return true;
}

And the Route procedure is:
Code:

protected bool Route(InteractionInstance instance)
{
Sim instanceActor = instance.InstanceActor;
return true;
}
Test Subject
#10 Old 26th Feb 2012 at 7:51 PM
Quote:
Originally Posted by Kitabalibar

I think an easy but not very effective way would be to add some delay? But I don't know what procedure would do that..

[/CODE]


You know that was my problem while trying to do the animation I wanted to make my sims route to my object I looked at some code used by sims 3 using ISpy and I found a code to give the sims the ability to go to my object but he keep saying a failure balloon.

The picture should show you what I mean in this thread:
http://modthesims.info/showthread.php?t=469956

I was trying to insert this code with the my correct code for the tutorial but It have to be working or my new way is useless! I am trying to add another cool code to it ! but it will take time for me to find more cool stuff I can't do anything right now until thursday I have much work to do! feel free to try the code out maybe you can figure something.
Test Subject
Original Poster
#11 Old 27th Feb 2012 at 5:01 AM Last edited by Kitabalibar : 27th Feb 2012 at 6:41 AM.
Ok I found a function which works, but the result is not optimal:

Code:

if (!Actor.RouteToObjectRadiusAndCheckInUse(this, 0.5f))
{
return false;
}

I put it in my RunAnimation function (see above).
You might need to change the 0.5 value if you still see the "no route" animation.
I know there must be a better way to do this, but for now i'll go with this solution.
I've also read the script of the MedicineCabinet by lenglel and he used the Routetoobjectradius as well. Maybe it is the best way to get it done

The next step for me is to learn how to have an animated object, then launch it with some C# and Jazz.
I know that cmomoney managed to do that for a window (which seems even more complex because he had to create the rig) but I still need to figure out how.
By the way if you read this cmomoney, I'd love to learn from you

Edit:
After looking more closely at the window of cmomoney, I managed to replicate the routeto structure he used
the first is the function in the interaction class
Code:

public bool RouteToObject(Sim actor)
{
return actor.RouteToSlot(base.Target, Slot.RoutingSlot_0);
}

This part is in the run() of the interaction (at the beginning)
Code:

if (!this.RouteToObject(base.Actor))
{
return false;
}

So now the routeto is prefect, so thanks to Cmomoney
Test Subject
Original Poster
#12 Old 28th Feb 2012 at 3:33 AM
Ok now I try to create a new sims interaction. But the thing is I have found very few interactions of the game, so it is hard to understand how it works....
Does someone know where are the interaction located? The thing is that I can find all the sims2sims interaction but only if they are object related (cuddle on the sofa..), but I would like to try to make an interaction which is not object related. Do you have any code examples of it? Or know where I could find some?
Slow is my MO
staff: administrator
#13 Old 28th Feb 2012 at 9:23 PM
You may find this tutorial useful >> http://www.modthesims.info/showthread.php?t=469283

More downloads by Leesester, BoilingOil and others at Leefish.nl | My Stuff at Leefish.nl | LeeFish RSS | Sims4 News Blog | TumblinLeefish
Back to top

Section jump