Jump to content
Sign in to follow this  
CptBBQ

Find the right magazine for any static weapon

Recommended Posts

Hey fellas,

I´m looking for a script that determines which type of magazine a given static weapon uses. I know it´s somewhere in Xeno´s vehicle repair script but I´ve got no idea how to rework it for my needs.

Maybe someone here knows a quick way to do so.

Thanks in advance!

Cheers,

CptBBQ

Share this post


Link to post
Share on other sites

Why you need a script for that is beyond me:

In the initline of the weapon:

hint format ["%1 \n\n %2",weapons this,magazines this]

Or even easier:

ArmA2 weapons @ BI Wiki

Share this post


Link to post
Share on other sites

Uh sorry, I probably should´ve explained a bit more...

I want to rearm any static weapon within a certain radius, so I need do determine what magazine the given weapon uses, even if the weapon is currently empty.

I guess I´ll have to get the classname from the vehicle config but I dunno how...

---------------------------

edit: got it working now. thank you W0lle.

Edited by CptBBQ

Share this post


Link to post
Share on other sites

_mags = getArray (configFile >> "CfgVehicles" >> typeOf _veh >> "magazines");

For vehicles with multiple turrets a more complicated algorithm is obviously needed.

Share this post


Link to post
Share on other sites

I´m pretty shure I´ve tested that syntax. But on e.g. a tow launcher it only returned 'FakeWeapon' ...

Share this post


Link to post
Share on other sites
_mags = getArray (configFile >> "CfgVehicles" >> typeOf _veh >> "magazines");

For vehicles with multiple turrets a more complicated algorithm is obviously needed.

I've been looking into that too, with no success.

The proper magazines are listed under a "class" derived from the main config. (my terminology isn't good)

class Turrets: Turrets {class MainTurret: MainTurret {
magazines[] = {"100Rnd_127x99_M2"};
};

How do I getArray for this config entry? Would it be something like this?

_mags = getArray (configFile >> "CfgVehicles" >> typeOf _veh >> "class MainTurret" >> "magazines");

Sorry, am at work so I can't check.

Share this post


Link to post
Share on other sites

On reflection, I think it's one of these two:

_mags = getArray (configFile >> "CfgVehicles" >> typeOf _veh >> "MainTurret" >> "magazines");

or

_mags = getArray (configFile >> "CfgVehicles" >> typeOf _veh >> "Turret" >> "magazines");

Untested. ;)

Share this post


Link to post
Share on other sites

I took a look at the cfgVehicles.. according to the class structure given and the syntax you guys are using the right code should be:

_mags = getArray (configFile >> "CfgVehicles" >> typeOf _veh >> "Turrets" >> "MainTurret" >> "magazines");

And guess what, it works! At least with a tow launcher, I haven´t tested any other statics or vehicles.

Share this post


Link to post
Share on other sites

Cool - thanks for that. I didn't get time to check it last night so thanks for following it up.

Will be useful for a good few things I'm working on. :)

Share this post


Link to post
Share on other sites

You´re wellcome =)

Though I´d expext some troubles with statics and vehicles with a differing class structure.

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  

×