Jump to content
Belbo

ADV Gear Distribution Script

Recommended Posts

ADV Gear Distribution



by

Belbo & Joko

Description:

I've played a lot of missions with either buggy or performance demanding gear distribution scripts or systems.

Some switch to Tonic's VAS because of that, but I personally don't really like using it in my missions (it's a great script though, no questions asked!). That's why I created this little script (pretty much for my own use).

But as requested I make this public and offer you my little gear distribution script.

As of version 2.0 the ADV Gear Distribution system comes with an executable file that creates all the necessary scripts for you. This is the ADV Gear Configurator made by Joko.

The script version is put into the download file as well, if you want to have a look at how the system works. (Or even create your loadouts without the ADV Gear Setup. It's highly recommended though.)

Features:

- combines playable units in classes

- every class gets their predefined loadout

- loadouts completely customizable

- script output all in all just ~70kB (with loadouts for 8 unit categories)

- JIP-compatible

- compatible with AGM (You can define agm-items separately. They will be added to the loadout if AGM is active.)

- creating loadouts has never been easier thanks to the ADV Gear Configurator (made by Joko)!

It might be a bit tricky in the beginning, but the reward is a set-up-and-forget loadout script that doesn't put much weight on your mission and does not require you to add each and every magazine.

Installation:

1. Copy the ADV Gear Setup.exe to a folder of your choice and launch it. Click on "Create Script". After that it pretty much does most of the work for you.

If you want to create loadouts only, click on "Loadout Editor".

2. Select your mission folder and hit "Ok". If you want to have players respawn with their custom loadouts every time, select the box "Respawn with custom loadouts". Without that you should use another gearsaving script.

After that click on "Create initPlayerLocal.sqf". If you already have on, it will just add the necessary call to the end of your initPlayerLocal.sqf. You might check if that's right for your mission.

3. Click on "Create adv_fnc_gear.sqf" and on "Create loadoutsInit.sqf" afterwards. With these clicks you basically created the necessary files for adding the loadouts you're creating in the next steps.

But first you have to select the amount of different playable units you have in your mission and enter their unit names. Add the playable unit's names under "Unit names". Make sure they're in quotation marks

and separated by commas, without a comma at the end.

(eg. "player1","player2").

"Script name" defines the names of the sqf-files your loadouts will be saved as. "Type of unit" is for your own good. That way you can keep track which units belong to which category. If you're done, hit "Done".

4. Now, and after a click on "Create loadouts", you can create your loadouts. You can either select items from the drop down menus or enter your own classnames. Don't put them in quotation marks, except for those in

the tab "Other". By clicking on "Info" you'll get information on the expected format for (almost) each entry.

If you're done with your first loadout, just click on "Save Configuration" and then on "Next loadout" - as long as there are loadouts you need to create. If you have created all loadouts, just close the application

and you're good to go.

If you're not too keen on creating a loadout from the scratch and want to see how it's being done, you can open one of the prefabs contained in ADV_Gear_Prefabs\ to try one of the prefabricated loadouts. You can

save your loadouts as prefab-files as well if you want to.

For editing the loadouts, just take a look at ADV_gear\loadouts\. There you'll find all the loadouts you have just created according to the preferences you set in step 3. The loadouts are saved as sqf-scripts and as prefabs. But even within the sqf-files it's

easy as pie to edit the loadouts. Just try it for yourself.

5. Have fun and don't boss your players around too much! ;)

Usage:

There's a sample mission included with a prewritten loadout script. Just take a look at it to know how this script and the ADV Gear Setup-Configurator work.

If you want to submit bugs in ADV Gear Setup.exe, you can do it either here or on https://github.com/jokoho48/ADV-Gear/issues.

Requirements:

- NET-Framework 4.0 (http://www.microsoft.com/en-us/download/details.aspx?id=17718)

Change log:

v2.0.1: - Minor bugfixes in ADV Gear Setup.exe.

v2.0: - Major update. ADV Gear Setup.exe is now doing all the work for you. Creating loadouts has never been easier and less demanding for your missions. :)

- Removed BWmod-Navpad-compatibility. Otherwise it would add the navpad to your loadout even if you were playing an Afghan tribal fighter as long as BWmod was running.

v1.3.2: - fixed error with Chemlights. Wrong classnames in adv_fnc_gear.sqf

- noticed little error in the prefabs: Under the tab "Other" you can enter items. Saving or loading a prefab will result in

missing " in front and at the end of the array. Currently you have to manually edit them back in. Will be fixed in upcoming

bigger update v1.4.

v1.3.1: - added prefabs to ADV Gear Configurator. Now you can load and save preconfigured loadouts.

- additionally some little changes were made to ADV Gear Configurator-netcode.

v1.3: - added goggles to loadouts.

- reworked adding of medical items.

- reworked adv_fnc_gear.sqf.

- brought look of unitCat*.sqf in line.

- added ADV_Gear.exe (thanks to Joko!)

- changed ReadMe accordingly.

v1.2.2: - removed issue with 40mm-grenades caused by spelling error.

v1.2.1: - small change to the 40mm-section.

v1.2: - reworked unitCat*.sqf-structure and adv_fnc_gear.sqf in preparation for the upcoming GUI-tool.

v1.1: - refined some issues with order of adding linked items in ADV_fnc_gear.sqf

- added compatibility with FHQ M4 pack and Massi's Nato/Russian Weapon Pack.

- removed some custom items from ADV_fnc_gear.sqf that could return errors when AGM is active.

- reworked the example mission for checking the respawn function.

- added respawnWithGear-variable to arguments that are passed to loadoutsInit.sqf.

v1.0: - Initial release

Download Link:

- ADV_Gear_v201.rar

Edited by Belbo

Share this post


Link to post
Share on other sites

Thanks for sending us the release :cool:

Release frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites
Thanks for sending us the release :cool:

And thank to you. :)

Sounds great will check it out thanks!!

No, thank you. :)

By the way: My current method to check if a weapon has an UGL is an array with the classnames of all the weapons I know that have an UGL. But that can't really be the best way to do that.

Does anyone know a way to check if a weapon has an UGL?

Edited by Pergor

Share this post


Link to post
Share on other sites

This looks great, thanks. I stopped making missions because I couldn't get loadouts to work properly - always had JIP issues even though I had code to make it work. Looking forward to making missions again.

Share this post


Link to post
Share on other sites

By the way: My current method to check if a weapon has an UGL is an array with the classnames of all the weapons I know that have an UGL. But that can't really be the best way to do that.

Does anyone know a way to check if a weapon has an UGL?

This is my current method:

private["_weapon","_muzzles"];


_weapon = _this select 0;
_muzzles = getArray (configfile >> "CfgWeapons" >> _weapon >> "muzzles");


if ("GL_3GL_F" in _muzzles) exitWith {3};
if ("EGLM" in _muzzles) exitWith {2};
if ("UGL_F" in _muzzles) exitWith {1};


0

It's not the greatest because the UGL class names are hardcoded, but there doesn't seem to be any clear way to check "dynamically".

Granted, if you're not interested in supporting addon weapons that's not a big deal :)

Share this post


Link to post
Share on other sites
This looks great, thanks. I stopped making missions because I couldn't get loadouts to work properly - always had JIP issues even though I had code to make it work. Looking forward to making missions again.

Knock yourself out, have fun with it. :)

This is my current method:

private["_weapon","_muzzles"];


_weapon = _this select 0;
_muzzles = getArray (configfile >> "CfgWeapons" >> _weapon >> "muzzles");


if ("GL_3GL_F" in _muzzles) exitWith {3};
if ("EGLM" in _muzzles) exitWith {2};
if ("UGL_F" in _muzzles) exitWith {1};


0

It's not the greatest because the UGL class names are hardcoded, but there doesn't seem to be any clear way to check "dynamically".

Granted, if you're not interested in supporting addon weapons that's not a big deal :)

That was kind of the idea unfortunately. :D Adding the standard weapons to my ugl-weapons-array isn't much of a hassle, but with modded weapons it's getting out of hand. That's why I'd need a reliable method to check for ugls, even with modded weapons.

But I'll definitely try your method, thank you very much!

Share this post


Link to post
Share on other sites

Yeah I've been looking for a method as well, if you ever come across a reliable one let me know :p

Share this post


Link to post
Share on other sites

Update to v1.2.1 - I've made a quite irregular workaround for the UGL problem: If you want 40mm grenades, just tell the script how many you want and you will get them. No matter what kind of muzzle you have. :)

Share this post


Link to post
Share on other sites
By the way: My current method to check if a weapon has an UGL is an array with the classnames of all the weapons I know that have an UGL. But that can't really be the best way to do that.

......

It's not the greatest because the UGL class names are hardcoded, but there doesn't seem to be any clear way to check "dynamically".

What about drilling down to the type of ammo the muzzle uses?? and finding out its simulation type and parent class.

e.g something like this (not fully functioning code just something to give the idea)

_muzzles = getArray (configFile >> "CFGWeapons" >> _weapon >> "muzzles");
_muzzleMag = getArray (configFile >> "CFGWeapons" >> _weapon >> _muzzle >> "magazines");
_muzzleMagAmmo = getText (configFile >> "CFGMagazines" >> _muzzleMag >> "ammo");
_muzzleMagAmmoSimulType = getText (configFile >> "CFGAmmo" >> _muzzleMagAmmo >> "simulation"); 

if (
_muzzleMagAmmoSimulType in ["shotIlluminating", "shotShell"]
&&
"GrenadeCore" in ( [(configFile >> "CFGAmmo" >> _muzzleMagAmmo), true] call BIS_fnc_returnParents )
) then {
//I am a muzzle that fires grenade shells
};

Edited by Larrow

Share this post


Link to post
Share on other sites

New version frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Edited by Foxhound
updated to latest

Share this post


Link to post
Share on other sites
What about drilling down to the type of ammo the muzzle uses?? and finding out its simulation type and parent class.

e.g something like this (not fully functioning code just something to give the idea)

_muzzles = getArray (configFile >> "CFGWeapons" >> _weapon >> "muzzles");
_muzzleMag = getArray (configFile >> "CFGWeapons" >> _weapon >> _muzzle >> "magazines");
_muzzleMagAmmo = getText (configFile >> "CFGMagazines" >> _muzzleMag >> "ammo");
_muzzleMagAmmoSimulType = getText (configFile >> "CFGAmmo" >> _muzzleMagAmmo >> "simulation"); 

if (
_muzzleMagAmmoSimulType in ["shotIlluminating", "shotShell"]
&&
"GrenadeCore" in ( [(configFile >> "CFGAmmo" >> _muzzleMagAmmo), true] call BIS_fnc_returnParents )
) then {
//I am a muzzle that fires grenade shells
};

That's definitely a good idea, thank you!:)

With 1.2.1 I revamped the 40mm-distribution in order to include more than just 40mm HE grenades. Checking for UGLs became unnecessary with that. The old system only added 40mm grenades to the loadouts if your weapon had a UGL. But maybe people want to give their units 40mm grenades without giving them a UGL weapon. At least that was my reasoning behind that. :D

Share this post


Link to post
Share on other sites

Big update.

v1.3 now contains a little .exe file with the ADV Gear Configurator (made by Joko). With this tool you can easily define the loadout-classes.

Share this post


Link to post
Share on other sites

minor update - now you can load and save loadouts as prefabs. Some standard loadouts are already included for every side.

Share this post


Link to post
Share on other sites

Minor update with a small bugfix. There's more to come with the upcoming 1.4 update, including a standalone version of the ADV Gear Configurator by Joko, providing you with an even more comfortable way of configuring your loadouts.

Share this post


Link to post
Share on other sites

Thanks, I'm looking forward to upcoming 1.4 update. Keep up great work! :wink_o:

Share this post


Link to post
Share on other sites

Major update v2.0: Now the ADV Gear Configurator almost does the whole work for you. We rewrote and added a whole lot of functions for this update. That's why we (Joko and me) decided to release it as v2.0 instead of v1.4.

A few features of the new release:

- ADV Gear Setup.exe creates all the scripts for you that are necessary for adding the loadouts to your units. All you have to do is select a few options and enter your playable unit's names. After that you can easily create your loadouts with an (almost) intuitive loadout editor.

- You can load and save loadouts as prefabs (a few prefabs for BLUFOR-units are included, as an example).

- You don't actually have to take any look at the ADV_gear-loadout scripts after running the ADV Gear Configurator.

Creating loadouts for your playable units has never been easier (this time for sure!:D) and has never put less weight on your mission.

Share this post


Link to post
Share on other sites

New version frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Minor update v2.0.1, just fixed some mini bugs in ADV Gear Configurator.exe.

Share this post


Link to post
Share on other sites

New version frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

I would love to see the ability to randomize some loadout on certain units. Like having a unit start out with different classnamed helmets or vests etc. :)

Share this post


Link to post
Share on other sites
I would love to see the ability to randomize some loadout on certain units. Like having a unit start out with different classnamed helmets or vests etc. :)

We're currently working on a new release version, maybe we will add a function for that.

But until then you can easily do it yourself:

In the loadout-files (unitCat_X.sqf in ADV_gear\loadouts\) you find the entry _uniform. It should be pretty much on the top of the script, line 11.

Replace this entry with:

_uniforms = ["UNIFORM1","UNIFORM2","UNIFORM3"];
_count = count _uniforms;
_uniform = _uniforms select floor random _count;

The same goes with the _headgear entry:

_headgears = ["HEADGEAR1","HEADGEAR2","HEADGEAR3"];
_count = count _headgears;
_headgear = _headgears select floor random _count;

sqf-scripting: Almost easy as pie. ;)

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

×