Home   Help Search Login Register  

Author Topic: putting a static anim into a game  (Read 1193 times)

0 Members and 2 Guests are viewing this topic.

ThEoNeAnDoNlY

  • Guest
putting a static anim into a game
« on: 21 Jan 2005, 22:40:23 »
hey al, i just made my first anim in my life! YAY! lol

but now i wanna put it ingame, it is not a dynamic anim, it is a static weapons anim, a GUNNER annim, for the m2 machinegun.

so could someone please tell me how to put it ingame?


Guy

Lean Bear

  • Guest
Re:putting a static anim into a game
« Reply #1 on: 22 Jan 2005, 12:34:38 »
Congratulations!! :thumbsup:

You'll need to write a config for it.

First, I'd recommend getting (if you don't already have them) the BIS commented configs.

Next, you'll need a config patches etc., should look something like this:

Code: [Select]
class CfgPatches
{
   class YourAddonClassName
   {
      Units[]={};
      Vehicles[]={};
      Weapons[]={};
      requiredVersion=1.30;
   };

   class NewMove
   {
      units[]={};
      weapons[]={};
      requiredVersion=1.30;
   };
};

Then, open up cfgMoves, and look for the closest anim to yours (in your case, it would be the one used for the BIS M2 Gunner which is:

Code: [Select]
class Gunner: Driver
      {
         file="cargo.rtm";
         speed=-10;
         looped=true;
      };
and..

Code: [Select]
VEHICLE_MOVES_VAR(M2Gunner);
Vehicle anims are quite tricky (and even harder to explain). Basically, this is all defined earlier on in the cfgMoves so its replacing it with the correct variant (the one stated).

Code: [Select]
#define VEH_DIE(Name,anim,time) \
         class Name##Dying: DefaultDie \
         { \
            actions = NoActions; \
            file=anim##smrt.rtm; \
            speed=-time; \
            looped=false; \
            soundEnabled=false; \
         }; \
         class Name##Dead: Name##Dying \
         { \
            actions = DeadActions; \
            file=anim##smrt2.rtm; \
            speed=SPEED_STATIC; \
            terminal = true; \
            connectFrom[]={Name##Dying,1}; \
            connectTo[]={DeadState,1}; \
         }

NOTE: This is just the dying anims.

So, for the M2GUNNER, wherever you see the ##, it replaces that with the name of the variant. So, OFP reads it like this:

Code: [Select]
         class M2GUNNERDying: DefaultDie
         {
            actions = NoActions;
            file=M2GUNNERsmrt.rtm;
            speed=-time;
            looped=false;
            soundEnabled=false;
         };
         class M2GUNNERDead: M2GUNNERDying
         {
            actions = DeadActions;
            file=M2GUNNERsmrt2.rtm;
            speed=SPEED_STATIC;
            terminal = true;
            connectFrom[]={M2GUNNERDying,1};
            connectTo[]={DeadState,1};
         }

Which looks a lot nicer and normal :)

Its just a way to make it a lot smaller (in size) and possibly easier for OFP to read (harder for us mortals though).

From what you've seen so far, I hope you realize that you will be needing more than one anim to make it look and work normally.

In theory, this should be much easier to config as all you really need is to put:

Code: [Select]
VEHICLE_MOVES_VAR(YourAnimName);
But, to make it that easy, you'll need to do the dying anims, and the non-static version (you could actually keep the same anim for it - in the BIS ones, the units sway from side to side). And then put it in the same place as all the other BIS anims (so you don't need to put:

Code: [Select]
file=\YourAddonFolderName\YourAnimName.rtm;
Cause that would mess up all the Defined ## stuff before)

If you don't want to do that, you could make your own defines which would be a lot more work :P

Basically, the BIS M2 Gunner anim names look like this:

M2GUNNER.rtm             // The swaying one
M2GUNNERsmrt2.rtm    // The dead anim
M2GUNNERsmrt.rtm      // The dying anim
M2GUNNERstat.rtm       // The completely static one - the one you've done

So, the
Code: [Select]
name##, anim##  etc.has been replaced with M2GUNNER and that's the file name OFP reads.

This probably doesn't make much sense.

There is, of course, an easier solution ;D

If you de-PBO "Anim.pbo" in the Dta folder in your OFP Root dir, name your anim(s) M2GUNNER~~.rtm (where ~~ is the correct ending eg. smrt2, stat etc.) and replace the ones in the Anim.pbo with yours (you might want to make a backup first) and PBO it again.

Done, no configs, nothing. Hope this helps somewhat. Any questions, just post them here.

edit

OK, just wanted to get all that up first.

The other option is to do something like the following, where you just do normal anim classes for each VEH_ANIM using the defines used before (but changing them slightly), have a look:

Code: [Select]
         class YourM2GunnerDying: DefaultDie
         {
            actions = NoActions;
            file=\YourFolderName\YourM2Gunnersmrt.rtm;
            speed=-3.0;
            looped=false;
            soundEnabled=false;
         };

         class YourM2GunnerDead: YourM2GunnerDying
         {
            actions = DeadActions;
            file=\YourFolderName\YourM2Gunnersmrt2.rtm;
            speed=SPEED_STATIC;
            terminal = true;
            connectFrom[]={YourM2GunnerDying,1};
            connectTo[]={DeadState,1};
         };
 
         class YourM2GunnerDying: DefaultDie
         {
            actions = NoActions;
            file=\YourFolderName\YourM2Gunnersmrt.rtm;
            speed=-3.0;
            looped=false;
            soundEnabled=false;
            connectFrom[]={YourM2Gunner,1};
         };

         class YourM2GunnerDead: YourM2GunnerDying
         {
            actions = DeadActions;
            file=\YourFolderName\YourM2Gunnersmrt2.rtm;
            speed=SPEED_STATIC;
            terminal = true;
            connectFrom[]={YourM2GunnerDying,1};
            connectTo[]={DeadState,1};
         };
 
         class YourM2Gunner: Driver
         {
            file=\YourFolderName\YourM2Gunnerstat.rtm;
            speed=SPEED_STATIC;
            looped=true;
         };
 
         class YourM2Gunner: Driver
         {
            file=\YourFolderName\YourM2Gunnerstat.rtm;
            speed=SPEED_STATIC;
            looped=true;
            variantsAI[]= {YourM2GunnerV1,0.7,YourM2Gunner};
            interpolateWith[]={YourM2GunnerV1,0.5};
            equivalentTo=YourM2Gunner;
            interpolationSpeed=1;
            connectTo[]={YourM2GunnerDying,1};
         };

         class YourM2GunnerV1: YourM2Gunner
         {
            file=YourM2Gunner.rtm;
            speed=-3.0;
            looped=true;
         };
 
         class YourM2Gunner: Driver
         {
            file=\YourFolderName\YourM2Gunnerstat.rtm;
            speed=SPEED_STATIC;
            looped=true;
            variantsAI[]= {YourM2GunnerV1,0.7,YourM2Gunner};
            interpolateWith[]={YourM2GunnerV1,0.5};
            equivalentTo=YourM2Gunner;
            interpolationSpeed=1;
         };
 
         class YourM2GunnerV1: YourM2Gunner
         {
            file=\YourFolderName\YourM2Gunnerv1.rtm;
            speed=-3.0;
            looped=true;
         };

All I did was replace all the "anim##", "Name##", "Name", "vartime" and "time" with the correct values, making an almost normal anim config.

(I dunno if that is 100% correct btw :P)

so, the completed config.cpp might look something like this:

Code: [Select]
class CfgPatches
{
   class YourAddonClassName
   {
      Units[]={};
      Vehicles[]={};
      Weapons[]={};
      requiredVersion=1.30;
   };

   class NewMove
   {
      units[]={};
      weapons[]={};
      requiredVersion=1.30;
   };
};

class CfgVehicleActions
{
     m2gunner = "YourM2Gunner"; // This replaces the originals with yours (hopefully)
  };

class cfgMovesMC
{
      class States
      {
            ~~~~~~~~~~~~~~~~~
            All the above for anims
            ~~~~~~~~~~~~~~~~~~
      };
  };
};

That should work :P

Then, put it all in an folder entiled YourFolderName //so all the anims will work, and PBO it. Stick it in your addons folder, put an M2 on the map in the Miss Ed and see if it works.

btw It looks like a lot, but there's only 4 anims to make here. You can probably just use the BIS ones and edit them slightly to look like your static one.

(This is possibly one of the longest and most complex posts ever ;D)

ps. I do hope that the M2 you're talking about is the fixed on that you have to GetIn etc.
« Last Edit: 02 Feb 2005, 18:47:34 by Lean Bear »