Jump to content
Sign in to follow this  
zwobot

Custom gunner animation for static weapon

Recommended Posts

Hi community

 

I'm trying to implement a custom animation for the gunner of a static weapon and the details of how to get it work are a bit hazy for me. The proxy of the gunner embarked in the weapon does either not show up or reverts to the standard "standing" animation.

 

The - I think relevant parts - of my config.cpp for the addon are:

class CfgVehicleActions
{
	zvs_FoxholeStand = "zvs_FoxholeStand";
};
class CfgMovesMC
{
	access=3;
	class Default {};

	class States
   {
	   class Driver: Default {};
	   class M2Gunner: Driver {};
	   class zvs_Base: M2Gunner
	   {
			variantsAI[]={};
			interpolateWith[]={};
			equivalentTo="zvs_Base";
			connectTo[]={};
	   };
	   
		class zvs_FoxholeStand: zvs_Base
		{
			file="foxholestand.rtm";
			equivalentTo="zvs_FoxholeStand";
		};
	};
};

class Foxhole : M2StaticMG
	{
		vehicleClass = "Foxholes";
		scope = protected;
		nameSound = "bunker";
		picture = "\Foxhole\Foxhole.paa";
		icon = "\Foxhole\foxhole1.pac";
		mapSize = 2.7;
		model = "\Foxhole\Foxhole1";
		accuracy = 0.2;
		gunnerAction = "ManActzvs_FoxholeStand";
		gunnerInAction = "ManActzvs_FoxholeStand";
		...
	};

Is there a custom proxy necessary in CfgNonAIVehicles also? It doesn't seem to be necessary from what I saw in other addons.

 

Does the .rtm file need to follow any special guidelines?

 

Am I doing something wrong in the config?

Share this post


Link to post
Share on other sites

Hello. My head's a bit fuzzy at the moment. Got a cold. I don't see anything that pops out at me.

 

Have you tried setting the scope value to public/2?

 

The only guidelines relating to a rtm would be in it's initial creation. Other than that, you reference it in configs or scripts like any other source file. In the same way you would textures or sound samples.

 

Edit:

Actually you shouldn't be able to select it from the mission editor if the scope is set to 1 or protected. Are you sure you're actually selecting your addon and not a "duplicate" or similar class without a custom animation?

Share this post


Link to post
Share on other sites

reverts to the standard "standing" animation.

So if I understand this correctly it sometimes works and sometimes not (so randomly), but when it does work it always reverts back to the default anim without exception? And always at the same moment/situation? Would this be right after starting preview in the editor? It shows up for a second or two, then reverts to the default one?

Share this post


Link to post
Share on other sites

@Macser, you have a valid point about the scope of the vehicle. I was posting the base class from which the actual editor placed objects which I'm testing are derived - their scope is configures as public. And I confirmed that I'm really testing those vehicles in the editor by changing their names and repackaging the addon. I also moved the gunnerAction and gunnerInAction attributes to the child classes but the situation is the same.

 

I moved the proxy a bit higher in all of the LODs in Oxygen and as it turns out the proxy was just hidden below the ground when my custom animation was assigned. Now I can see that the behaviour is that the animation shown for the gunner is identical to stance of men models in Oxygen (gun on the back and arms straight down).

Now I'm also in doubt whether my alignment of the model / proxy is correct or if it is offset in the animation (if that's possible?)?

The vertical alignment looked fine in OfpAnim I think. I tried a stock animation (M1A1Gunner) and it works fine.

 

I tried an animation from another third party addon instead of mine but it does not work either, which would suggest that something is wrong with my config also?

 

What is it about you have to take care of when initially creating an animation which might prevent it from working and can this be changed on existing .rtm files?

 

@JdB: The behaviour was not like the animation is shown for a very brief moment and then reverts to the "standard" animation. It was not visible due to the situation described above.

Share this post


Link to post
Share on other sites

I just meant that the only problems that you might encounter with rtms would be the creation of them. But that process won't cause what's happening to you. I know one thing for sure. If you ever see a character default to the zero frame, or t-pose as it's often called, then it's because the engine can't find the animation it's being instructed to play.

 

It's not an animation as such. Think of it like the base state of the model. With no rtm playing on it that's how the model looks.

 

Now that I've said that I looked back at your config. 

 

file="foxholestand.rtm";

 

Tells the engine to look for \DTA\Anim\foxholestand.rtm.  I assume you didn't pack your own rtm in there and re-binarise it.

 

It should ideally be:

 

file= "\myfolder\foxholestand.rtm";

 

Where you specify a custom addon folder containing your rtms. It's not enough to put the rtm in your addon folder. With custom data the engine needs the correct path to the folder specified. The path should always start with a backslash, followed by the addon folder name. A subfolder if needed. And then the actual file name.

 

As I said. My mind's not in tip-top condition at the moment. :)

 

Even if the proxy is roughly placed the rtm can be used to correct the character's position.

  • Like 1

Share this post


Link to post
Share on other sites

[...]

 

Now that I've said that I looked back at your config. 

 

file="foxholestand.rtm";

 

Tells the engine to look for \DTA\Anim\foxholestand.rtm.  I assume you didn't pack your own rtm in there and re-binarise it.

 

It should ideally be:

 

file= "\myfolder\foxholestand.rtm";

 

[...]

 

That was exactly the problem - I corrected that and the animation is displayed now, thank you! I feel really stupid now to not having noticed this myself  :mellow:

Share this post


Link to post
Share on other sites

It happens. I've often overlooked things staring me right in the face. Sometimes a fresh pair of eyes is exactly what's needed. :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×