almaniak 2 Posted August 29, 2014 Hello, I'm looking for a way to find out what kind of magazines a particular weapon uses. I want this to be done automatically in a way that the script would detect what kind of weapon a unit has, and then depending on that weapon fill the units inventory with the proper variance of magazines. My original plan was to make huge array's with the info in them, but I'd like the system to be a bit more flexible. I've found that you might be able to get the magazines a gun uses by checking its config, however I've no idea how to properly do this. The biki does not give enough workable information in how I might extract the magazines. Can anyone point me in the right direction here? Share this post Link to post Share on other sites
nimrod_z 8 Posted August 29, 2014 Hello,I'm looking for a way to find out what kind of magazines a particular weapon uses. I want this to be done automatically in a way that the script would detect what kind of weapon a unit has, and then depending on that weapon fill the units inventory with the proper variance of magazines. My original plan was to make huge array's with the info in them, but I'd like the system to be a bit more flexible. I've found that you might be able to get the magazines a gun uses by checking its config, however I've no idea how to properly do this. The biki does not give enough workable information in how I might extract the magazines. Can anyone point me in the right direction here? to get the ammo of current weapon you can use _magazines = getArray (configFile >> "CfgWeapons" >> currentWeapon player >> "magazines"); to add that type of magazine, you would use player addMagazine (_magazines select 0); Share this post Link to post Share on other sites
almaniak 2 Posted August 29, 2014 (edited) Works like a charm, thank you! If I may bother you with one more question. If the weapon also has a grenade launcher attached, how would I go get the magazine types of those? I reckoned it would be be _magazines = getArray (configFile >> "CfgWeapons" >> currentWeapon player >> "EGLM" >> "magazines"); (Because of the configs) However this returns to me an empty array. EDIT: Nevermind, I've found out that BLUEFOR uses "GL_3GL_F" and REDFOR uses "GLM". Edited August 29, 2014 by AlManiak Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted August 29, 2014 Just use BIS_fnc_addWeapon. Share this post Link to post Share on other sites
almaniak 2 Posted August 29, 2014 I needed a bit more control then the standard mag load outs, but that does seem like a handy command to have in the future (that I did not yet know about), so thank you! Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted August 29, 2014 I needed a bit more control then the standard mag load outs, but that does seem like a handy command to have in the future (that I did not yet know about), so thank you! You can use the addWeapon function to add every single magazine that's compatible to the weapon by using the fourth parameter. If 0 is the default mag, then every number above 0 will be a tracer mag, or specifically colored flare/smoke for UGLs. Share this post Link to post Share on other sites