HJohnson 16 Posted September 6, 2013 Hello, I am currently working on a script that will create a variable called "_magazinetype". Magazine type will range is between 0 and 4. 1-4 are different types of magazines and 0 is no magazine. What I want to do is depending on the variable number, I am able to call on the _magazinetype variable as a source in cfgmodel's to determine the weapon's magazine. The way I see it will be done is for example if the current magazine is the 30rnd_65_caseless, it will set _magazinetype to 1, and if it is the 100rnd, it will set it to 2. This is the first thing I need to accomplish. A variable that changes depending on what magazine the player has. Secondly, I want to model a simple rifle, but in the model there will be a vertex group called "magazine" that will be animated with reloading, etc. However, it will have 4 types of magazines. 20rnd, 30rnd,60rnd and 100rnd. Now what I want to have happen here is have the animationsource class pick up the _magazinetype variable. If it is set to 0, it will hide all of the magazines. If it is set to 1, it will show the first, but hide the rest. I believe if this works it will allow for the weapons in Arma to reflect what they have in them more accurately. But because I am relatively new to Arma coding (only been doing such for about a year), I am unsure if I am doing this correctly. Here is the code that I have so far: ///_this select 0: unit ///_this select 1: weapon classname ///_this select 2: Magazine's class ///_this select 3: Magazine Count private ["_unit","_weapon","_magazineclass","_magazinetype"]; _unit = [_this, 0, objnull, [objnull]] call BIS_fnc_param; _weapon = [_this, 1, "", [""]] call BIS_fnc_param; _magazineclass = [_this, 2, 0, [0,""]] call BIS_fnc_paraml _unit setvariable ["_magazinetype", 0, true]; /// 0 is a empty gun /// 1 is a 30 round /// 2 is a 100 round /// 3 is not used yet /// 4 is not used yet /// Eventually 1 will be 20 rnd, 2 will be 30 rnd, 3 will be 60rnd, 4 will be betaC if (_magazinetype < 0) then { _unit setvariable ["_magazinetype", 0, true]}; /// magazines cannot superseed 0; if (_magazinetype > 4) then { _unit setvariable ["_magazinetype", 4, true]}; /// Magazines cannot exceed 4 if (_magazineCount >0) then ///If the unit has magazines { _magazine = getArray (configfile / "cfgweapons"/ _weapon / "magazines"); ///gets the magaizine if (_magazine = "100rnd_65x39_caseless_mag") then { { _unit setvariable ["_magazinetype", 1, true]}; ///Large Mags are 2 }; if (_magazine = "30Rnd_65x39_caseless_mag") then { { _unit setvariable ["_magazinetype", 2, true]}; ///Small Mags are 1 }; }; class Hide; class cfgmodels { class modelskeletonilldefinelater { class animations; }; class weaponmodelilldefinelater : modelskeletonilldefinelater { class Animations:animations { class setmagazine20rnd: hide { source = _magazinetype; animperiod = 1; selection = magazine; } }; }; }; Is there something that I need to do to get this to work properly? Thanks. Share this post Link to post Share on other sites