Jump to content
Sign in to follow this  
twisted

how to find list of all compatible scopes for a random weapon

Recommended Posts

hi. i have an array of weapons randomly chosen from configweapons. like >

_cfgweapons = configFile >> "CfgWeapons";

i then coose one weapon at random from the list/array.

how do i then generate a list of all compatible scopes with that particular weapon? it must be automated as it must automatically detect and work for addon weapons as well.

two approaches i am trying are

_scopez = getArray (configFile >> "CfgWeapons" >> _chosenweapon >> "muzzles");

_scopez2 = getNumber(_chosenweapon >> "scope");

diag_log format[" _scopez _x is %1: ",_scopez ];

diag_log format[" _scopez2 _x is %1: ",_scopez2 ];

the first gives me along list like [this, this, this]

and the second gives me the error:

Error in expression <z ];

_scopez2 = getNumber(_chosenweapon >> "scope");

diag_log format[" _scopez _>

Error position: <>> "scope");

diag_log format[" _scopez _>

Error >>: Type String, expected Config entry

any help or insights will be appreicated.

Share this post


Link to post
Share on other sites

Uh maybe I'm confused but aren't all scopes compatible to all weapons that are able to mount scopes?

At least for vanilla weapons, I think.

Share this post


Link to post
Share on other sites

what you are looking for is:

configfile >> "CfgWeapons" >> _chosenweapon >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems"

This will give you a list over compatible items in the Optic Slot

Share this post


Link to post
Share on other sites

Thanks man, works perfectly.

Can you tell me where this kind of information is kept as configfile seems to be a treasure trove of stuff but its so hard to find any reference on it.

Share this post


Link to post
Share on other sites

You can find it in the game editor.

From the editor you click "Config Viewer (Ctrl G)", here you get the full config list.

The list is HUGE, but its fairly easy to get familiar with using it.

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  

×