Game Development Community

IFL Animation on Weapon

by Greg Gardinier · in Torque Game Engine · 07/19/2005 (8:17 pm) · 5 replies

Greetings,

I just finished a weapon that needs to play an IFL animation when it is added to the player. In short, I don't know how to do this.

Here is my ShapeImage datablock, its pretty simple:

datablock ShapeBaseImageData(theblade)
{
   shapeFile = "~/data/shapes/theblade/theblade.dts";
   mountPoint = 4;

};


I am adding this weapon to the player using this:

%obj.mountImage(theblade, 4);

It mounts just fine but I don't know what I can do to get the IFL animation to play. I just want it to run somthing like the code bellow when I mount the weapon to the player.

%obj.playThread(0,"idle1");

I am sure this is simple, but I am not a coder by trade. Could somone help me out?

Thanks

#1
07/19/2005 (9:22 pm)
Does it work in the show tool?


Some simple things to look for:
- Do you have the .ifl file and graphics files in the same location as your dts file?
- Is the texture that you applied to the model have the same name as the .ifl file?
#2
07/19/2005 (10:08 pm)
My IFL animations work fine. The issue is a scripting one. They work in the showtool and in the engine I just need to be able to trigger them when the player is added to the world, or when they are mounted to the player. In other words I want the Animation to play when the game starts
#3
07/20/2005 (3:05 am)
Well I have been at this now for well over 6 hours and havn't been able to figure anything out. I am going to call it a night...errr morning. If some could please help me out that would be great. I don't know what I should script to get a mounted ShapeImage to play an IFL animation when it is added or mounted.

The animation works fine, I just have to figure what script will make it play.

I have been trying stuff like this:

datablock ShapeBaseImageData(theblade)
{
   shapeFile = "~/data/shapes/theblade/theblade.dts";
   mountPoint = 4;
};

function theblade::onAdd(%this,%obj)
{
%obj.playThread(0,"blade");
}

However, this does not work. The Image mounts to the player just as it should but it just shows the first frame of my IFL animation and nothing happens.

It is possible to have IFL animation on ShapeImages right?
#4
07/20/2005 (3:53 am)
Greg - If the ifl animaiton is baked into the model, then you may be able to use the shapeSequence to play the ifl. You will probably want to make sure the last and first images in the ifl are blank so the ifl doesnt show after its done playing.

Just set the stateSequence of the preload (or something) state to be the name of the animation (ie. "weapon_preloadifl")
#5
03/12/2006 (5:47 pm)
I just realized the big issue here is that the IFl animation needs to loop. Can you loop an animation with a State?