Jump to content
Sign in to follow this  
hkurban

weapon model.cfg "ammo" animation source

Recommended Posts

So long story short, I'm trying to animate an ammo counter that correctly displays the number of rounds in the magazine on the weapon model.

This should be easy enough with the "revolving" animation source for weapons with only one magazine size like many LMGs and translucent mag'd weapons do (although being able to hide and unhide would make the model a lot cleaner looking. Not sure how to accomplish that.)

Unfortunately, this wouldn't work for weapons that have more than one magazine size, so I started looking for other options. I noticed on the BI wiki (https://community.bistudio.com/wiki/Model_Config#Animation_sources) that there's a new animation source called "Ammo" and that seems to be exactly what I'm looking for. Unfortunately, I can't find any examples of it in use, either through the BI wiki, in sample models, or anyone elses work. I've tried a few things, like setting the hideValue to whatever the desired ammo level would be, but no luck so far, even on the weapon that has only one ammo type.

If anyone could show a good example of how to accomplish this (assuming it's possible), I would be a very happy man and I might buy you a (virtual) beer*. :p

*Assuming you are of age in your country or province of legal residence

Share this post


Link to post
Share on other sites

Hey, I'm bringing up this thread because I wanted to do this and this was the top google result, and there was no info online. I eventually figured it out, and I hope this helps others.

 

Here's how the ammo animation source works, with an example from a belt fed MG that hides bullets as they're fired:

 

class mag_bullet_01_hide {
        type="hide";
        source="ammo";
        selection="bullet_01";
        sourceAddress="clamp";
        minValue=0
        maxValue=7; //Maximum amount of ammo you want to animate
        hideValue = 0;
        unhideValue=0.99/7; //Replace '7' with whatever maximum amount of ammo you want to represent, and 0.99 with 'bullet you want to hide' - 0.01
};

 

 

So, the advantage of using 'ammo' over 'revolving' is whereas revolving is based on a fixed maximum magazine size, ammo can be set to whatever maximum amount of ammo you want to have animating - in the case of a belt fed MG, you might only want to have 7 bullets that are shown/hidden, but have 100 and 200 round belts.

 

 

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  

×