Jump to content

Recommended Posts

Hi,

I've been having trouble with the model.cfg where it won't work, for example on the reload animation the magazine doesn't translate or dissapear. I am new to modding in arma 3.

 

I've basically stolen one of the tutorial examples

Spoiler

class CfgSkeletons
{
    class Makarov_PM
    {
        isDiscrete = 1;//From wiki: 1 stands for discrete skinning values (0 or 100 % for each vertex of every selection), 0 stands for non-discrete (each vertex may have different skinning values for selections - animations have just partial effect on that vertex)
        skeletonInherit = "";
        skeletonBones[] =
        {
            "bolt","bolt_Handel",
            "bolt_Handel","",
            "magazine","",//these are the named selections we are going to move
            "trigger","",
            "zasleh",""
        };
    };
};
class CfgModels
{
    class Default;
//     class Optic: Default
//    {
//        sections[]=
//        {
//            "zasleh"
//        };
//    };
    class Weapon: Default
    {
        sections[]=
        {
            "zasleh"
        };
        skeletonName="Weapon";
        htMin = 1;        // Minimum half-cooling time (in seconds)
        htMax = 600;    // Maximum half-cooling time (in seconds)
        afMax = 0;        // Maximum temperature in case the model is alive (in celsius)
        mfMax = 0;        // Maximum temperature when the model is moving (in celsius)
        mFact = 1;        // Metabolism factor - number from interval <0, 1> (0 - metabolism has no influence, 1 - metabolism has full influence (no other temperature source will be considered)).
        tBody = 100;     // Metabolism temperature of the model (in celsius)
        
    
        class Animations//this config was made with trial and error and based of the sample weapon's mode.cfg. I'm leaving the junk as it might be useful to you. Otherwise, consult other samples.
        {

            class magazine_hide
            {
                type="hide";
                source="reloadMagazine";
                sourceAddress="mirror";
                selection="magazine_loaded";
                minValue=0.0;
                maxValue=0.4;
                hideValue=0.5;
        //        //unhideValue = 0.76;//0.76
        //    };
        //    class reload_ammobelt_hide: magazine_hide
        //    {
        //        selection="ammo_belt";
        //    };
        //    class reload_ammobelt_bottom_hide: magazine_hide
        //    {
        //        selection="ammo_belt_bottom";
        //    };
        //    class ammobelt_hide: magazine_hide
        //    {
        //        source="isEmpty";
        //        selection="ammo_belt";
        //        minValue=0.000000;
        //        maxValue=1.000000;
        //        hideValue=1.000000;
        //    };
        //    class ammobelt_bottom_hide: ammobelt_hide
        //    {
        //        selection="ammo_belt_bottom";
        //    };
        //    class no_magazine
        //    {
        //        type="hide";
        //        source="hasMagazine";
        //        selection="magazine_loaded";
        //        minValue=0.000000;
        //        maxValue=1.00000;
        //        hideValue=0.5;
        //        unhideValue = -1.0;
        //    };
        };
    };
    class Makarov_PM_Base: Weapon//Pistol
    {
        skeletonName = "Makarov_PM";
        sectionsInherit = "";
        sections[] = {"zasleh"};//safety
        class Animations
        {
            class zaslehROT//rotate our muzzle flash upon firing
            {
                type="rotationX";
                source="ammoRandom";      //use ammo count as phase for animation
                sourceAddress="loop";     //loop when phase out of bounds
                selection="zasleh";  //selection we want to rotate
                axis="";                  //no own axis - center of rotation is computed from selection
                centerFirstVertex=true;   //use first vertex of selection as center of rotation
                minValue=0;
                maxValue=4;               //rotation angle will be 360/4 = 90 degrees
                angle0="rad 0";
                angle1="rad 360";
            };
            //class trigger_begin//rotate our trigger backwards on shooting
            //{
            //    type="rotation";
            //    source="reload";//see model.cfg entry on BIS wiki for all sources
            //    //sourceAddress = "clamp";
            //    selection="trigger";//named selection to operate on
            //    axis="trigger_axis";//Memory LOD axis to use for this rotation (also ensure geometry LOD has the property of autocenter = 0 
            //    memory=1;
            //    minValue=0.000000;
            //    maxValue=0.250000;
            //    angle0=0.000000;
            //    angle1=-0.400000;
            //};
            //class trigger_end:trigger_begin//referencing the trigger_begin class and replacing the following values only (as we will be doing the same operation just in reverse)
            //{
            //    minValue=0.30000;
            //    maxValue=0.500000;
            //    angle1=0.000000;
            //}
            //class hammer_fire_begin
            //{
            //    type="rotation";
            //    source="reload";
            //    selection="hammer";
            //    axis="hammer_axis";
            //    memory=1;
            //    minValue=0.000000;
            //    maxValue=0.500000;
            //    angle0=0.000000;
            //    angle1=1;
            //};
            //class hammer_fire_end:hammer_fire_begin
            //{
            //    minValue=0.520000;
            //    maxValue=1.000000;
            //    angle0=0.000000;
            //    angle1=0;//-1 testing 0 like in hammer_empty
            //};
            //class hammer_empty
            //{
            //    type="rotation";
            //    source="isEmpty";
            //    selection="hammer";
            //    axis="hammer_axis";
            //    memory=1;
            //    //minValue=0.990000;
            //    //maxValue=1.000000;
            //    minValue=0.500000;
            //    maxValue=0.800000;
            //    angle0=0.000000;
            //    angle1=0.000000;
                //angle1=1.221730;
            //};
            class bolt_fire_begin
            {
                type="translation";//moving our slide
                source="reload";
                selection="bolt_Handel";
                axis="bolt_end";//if the two vertices that make up your axis are the distance you wish the translate to begin and end at, you can use the offset value of 1.
                minValue=0.000000;
                maxValue=0.500000;//0.5
                offset0=0;
                offset1=-0.200000;//0.2
            };
            class bolt_fire_end:bolt_fire_begin
            {
                minValue=0.5300000;
                maxValue=1.000000;
                offset0=0;
                offset1=0.200000;//0.2
            };
            class bolt_empty//locks the slide back when empty
            {
                type="translation";
                source="isEmpty";
                selection="bolt_Handel";
                axis="bolt_start";
                minValue=0.990000;
                maxValue=1.000000;
                offset0=0;
                offset1=-0.200000;
            };
        //    class slidesafety_fire_begin:slide_fire_begin
        //    {
        //        selection="safety";
        //    };
        //    class slidesafety_empty:slide_empty
        //    {
        //        selection="safety";
        //    };
        //    class magazine_hide:magazine_hide//testingthisdisabled
        //    {
        //        sourceAddress="mirror";
        //        minValue=0.0;
        //        maxValue=0.56;
        //        hideValue=0.25;//was 0.36
        //    };
        //    class safety_rotation//rotates the safety when changing muzzle (as our secondary muzzle functions as a fake safety)
        //    {
        //        type="rotationZ";
        //        source="weaponMuzzle";
        //        sourceAddress = "clamp";
        //        selection="safety";
        //        axis="safety_axis";
        //       memory=1;
        //        minValue=0.000000;
        //        maxValue=0.6;//1.0
        //        angle0=0.0;//"rad 0" angles can be given in radians or degrees, rad -10 would be 10 degrees
        //        angle1=0.6;//"rad -10"
        //    };
        //    class safety_decock//when the safety is enabled, decock the hammer
        //    {
        //        type="rotation";
        //        source="weaponMuzzle";
        //        selection="hammer";
        //        axis="hammer_axis";
        //        memory=1;
        //        minValue=0.000000;
        //        maxValue=0.500000;//0.5
        //        angle0=0.000000;
        //        angle1=0.8;//1.221730
        //    };
            class magazine_reload_move_1//these sections need to be timed with the reload animation. This can be difficult/frustrating.
            // see https://forums.bistudio.com/topic/184670-modelcfg-reloadmagazine-pistol/?p=2911371 , a post where I got help understanding these values.
            {
                type = "translation";
                source = "reloadMagazine";
                selection = "magazine";
                axis = "magazine_axis";
                minValue = 0.07;
                maxValue = 0.2;//0.2
                offset0 = 0.0;
                offset1 = 1.2;//1.0
            };
            class magazine_reload_move_2: magazine_reload_move_1
            {
                //source = "reloadMagazine2";
                minValue = 0.64;
                maxValue = 1.0;
                offset0 = 0.0;
                offset1 = -1.2;
            };
            class magazine_hide
            {
                type="hide";
                source="reloadMagazine";
                selection="magazine";
                minValue=0.000000;
                maxValue=1.0;
                hideValue=0.22;
                unhideValue = 0.64;
            };
            class no_magazine
            {
                type="hide";
                source="hasMagazine";
                selection="magazine";
                minValue=0.000000;
                maxValue=1.00000;
                hideValue=0.5;
                unhideValue = -1.0;
            };
        };
    };
    class hkump45: Makarov_PM_Base {};//bek_makarov MUST be the name of our model file. So, the model file associated with this mode.cfg is therefore bek_makaro.p3d. If this is not the case you will get the muzzle flash bug.
};

 

Share this post


Link to post
Share on other sites

I'm not sure what i did to get it to work but i works now

Spoiler

class CfgSkeletons
{
    class Makarov_PM
    {
        isDiscrete = 1;//From wiki: 1 stands for discrete skinning values (0 or 100 % for each vertex of every selection), 0 stands for non-discrete (each vertex may have different skinning values for selections - animations have just partial effect on that vertex)
        skeletonInherit = "";
        skeletonBones[] =
        {
            "bolt","bolt_Handel",
            "bolt_Handel","",
            "magazine","",//these are the named selections we are going to move
            "trigger",""
        };
    };
};
class CfgModels
{
    class Default;
//     class Optic: Default
//    {
//        sections[]=
//        {
//            
//        };
//    };
    class Weapon: Default
    {
        sections[]=
        {

        };
        skeletonName="Weapon";
        htMin = 1;        // Minimum half-cooling time (in seconds)
        htMax = 600;    // Maximum half-cooling time (in seconds)
        afMax = 0;        // Maximum temperature in case the model is alive (in celsius)
        mfMax = 0;        // Maximum temperature when the model is moving (in celsius)
        mFact = 1;        // Metabolism factor - number from interval <0, 1> (0 - metabolism has no influence, 1 - metabolism has full influence (no other temperature source will be considered)).
        tBody = 100;     // Metabolism temperature of the model (in celsius)
        
    
        class Animations//this config was made with trial and error and based of the sample weapon's mode.cfg. I'm leaving the junk as it might be useful to you. Otherwise, consult other samples.
        {

            class magazine_hide
            {
                type="hide";
                source="reloadMagazine";
                sourceAddress="mirror";
                selection="magazine";
                minValue=0.0;
                maxValue=0.4;
                hideValue=0.5;
                //unhideValue = 0.76;//0.76
            };
        //    class reload_ammobelt_hide: magazine_hide
        //    {
        //        selection="ammo_belt";
        //    };
        //    class reload_ammobelt_bottom_hide: magazine_hide
        //    {
        //        selection="ammo_belt_bottom";
        //    };
        //    class ammobelt_hide: magazine_hide
        //    {
        //        source="isEmpty";
        //        selection="ammo_belt";
        //        minValue=0.000000;
        //        maxValue=1.000000;
        //        hideValue=1.000000;
        //    };
        //    class ammobelt_bottom_hide: ammobelt_hide
        //    {
        //        selection="ammo_belt_bottom";
        //    };
        //    class no_magazine
        //    {
        //        type="hide";
        //        source="hasMagazine";
        //        selection="magazine_loaded";
        //        minValue=0.000000;
        //        maxValue=1.00000;
        //        hideValue=0.5;
        //        unhideValue = -1.0;
        //    };
        };
    };
    class Makarov_PM_Base: Weapon
    {
        skeletonName = "Makarov_PM";
        sectionsInherit = "";
        sections[] = {""};
        class Animations
        {
            //class zaslehROT//rotate our muzzle flash upon firing
            //{
            //    type="rotationX";
            //    source="ammoRandom";      //use ammo count as phase for animation
            //    sourceAddress="loop";     //loop when phase out of bounds
            //    selection="zasleh";  //selection we want to rotate
            //    axis="";                  //no own axis - center of rotation is computed from selection
            //    centerFirstVertex=true;   //use first vertex of selection as center of rotation
            //    minValue=0;
            //    maxValue=4;               //rotation angle will be 360/4 = 90 degrees
            //    angle0="rad 0";
            //    angle1="rad 360";
            //};
            //class trigger_begin//rotate our trigger backwards on shooting
            //{
            //    type="rotation";
            //    source="reload";//see model.cfg entry on BIS wiki for all sources
            //    //sourceAddress = "clamp";
            //    selection="trigger";//named selection to operate on
            //    axis="trigger_axis";//Memory LOD axis to use for this rotation (also ensure geometry LOD has the property of autocenter = 0 
            //    memory=1;
            //    minValue=0.000000;
            //    maxValue=0.250000;
            //    angle0=0.000000;
            //    angle1=-0.400000;
            //};
            //class trigger_end:trigger_begin//referencing the trigger_begin class and replacing the following values only (as we will be doing the same operation just in reverse)
            //{
            //    minValue=0.30000;
            //    maxValue=0.500000;
            //    angle1=0.000000;
            //}
            //class hammer_fire_begin
            //{
            //    type="rotation";
            //    source="reload";
            //    selection="hammer";
            //    axis="hammer_axis";
            //    memory=1;
            //    minValue=0.000000;
            //    maxValue=0.500000;
            //    angle0=0.000000;
            //    angle1=1;
            //};
            //class hammer_fire_end:hammer_fire_begin
            //{
            //    minValue=0.520000;
            //    maxValue=1.000000;
            //    angle0=0.000000;
            //    angle1=0;//-1 testing 0 like in hammer_empty
            //};
            //class hammer_empty
            //{
            //    type="rotation";
            //    source="isEmpty";
            //    selection="hammer";
            //    axis="hammer_axis";
            //    memory=1;
            //    //minValue=0.990000;
            //    //maxValue=1.000000;
            //    minValue=0.500000;
            //    maxValue=0.800000;
            //    angle0=0.000000;
            //    angle1=0.000000;
                //angle1=1.221730;
            //};
            class bolt_fire_begin
            {
                type="translationX";//moving our slide
                source="reload";
                selection="bolt_Handel";
                axis="bolt_end";//if the two vertices that make up your axis are the distance you wish the translate to begin and end at, you can use the offset value of 1.
                begin="bolt_start";
                end="bolt_end";
                memory=1;
                minValue=0.000000;
                maxValue=0.100000;//0.5
                offset0=0;
                offset1=-1;//0.2
                sourceAddress="clamp";
            };
            class bolt_fire_end:bolt_fire_begin
            {
                begin="bolt_end";
                end="bolt_start";
                minValue=0.0000000;
                maxValue=0.100000;
                offset0=0;
                offset1=0.1;//0.2
            };
            class bolt_empty//locks the slide back when empty
            {
                type="translationX";
                source="isEmpty";
                selection="bolt_Handel";
                axis="bolt_start";
                begin="bolt_start";
                end="bolt_end";
                memory=1;
                minValue=0.000000;
                maxValue=0.100000;
                offset0=0;
                offset1=-0.100000;
            };
        //    class slidesafety_fire_begin:slide_fire_begin
        //    {
        //        selection="safety";
        //    };
        //    class slidesafety_empty:slide_empty
        //    {
        //        selection="safety";
        //    };
        //    class magazine_hide:magazine_hide//testingthisdisabled
        //    {
        //        sourceAddress="mirror";
        //        minValue=0.0;
        //        maxValue=0.56;
        //        hideValue=0.25;//was 0.36
        //    };
        //    class safety_rotation//rotates the safety when changing muzzle (as our secondary muzzle functions as a fake safety)
        //    {
        //        type="rotationZ";
        //        source="weaponMuzzle";
        //        sourceAddress = "clamp";
        //        selection="safety";
        //        axis="safety_axis";
        //       memory=1;
        //        minValue=0.000000;
        //        maxValue=0.6;//1.0
        //        angle0=0.0;//"rad 0" angles can be given in radians or degrees, rad -10 would be 10 degrees
        //        angle1=0.6;//"rad -10"
        //    };
        //    class safety_decock//when the safety is enabled, decock the hammer
        //    {
        //        type="rotation";
        //        source="weaponMuzzle";
        //        selection="hammer";
        //        axis="hammer_axis";
        //        memory=1;
        //        minValue=0.000000;
        //        maxValue=0.500000;//0.5
        //        angle0=0.000000;
        //        angle1=0.8;//1.221730
        //    };
            class magazine_reload_move_1//these sections need to be timed with the reload animation. This can be difficult/frustrating.
            // see https://forums.bistudio.com/topic/184670-modelcfg-reloadmagazine-pistol/?p=2911371 , a post where I got help understanding these values.
            {
                type = "translation";
                source = "reloadMagazine";
                selection = "magazine";
                axis = "magazine_axis";
                memory=1;
                minValue = 0.07;
                maxValue = 0.2;//0.2
                offset0 = 0.0;
                offset1 = 1.2;//1.0
            };
            class magazine_reload_move_2: magazine_reload_move_1
            {
                //source = "reloadMagazine2";
                minValue = 0.64;
                maxValue = 1.0;
                offset0 = 0.0;
                offset1 = -1.2;
            };
            class magazine_hide
            {
                type="hide";
                source="reloadMagazine";
                selection="magazine";
                minValue=0.000000;
                maxValue=1.0;
                hideValue=0.22;
                unhideValue = 0.64;
            };
            class no_magazine
            {
                type="hide";
                source="hasMagazine";
                selection="magazine";
                minValue=0.000000;
                maxValue=1.00000;
                hideValue=0.5;
                unhideValue = -1.0;
            };
        };
    };
    class hkump45: Makarov_PM_Base {};//bek_makarov MUST be the name of our model file. So, the model file associated with this mode.cfg is therefore bek_makaro.p3d. If this is not the case you will get the muzzle flash bug.
};

 

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

×