Novax

[TUTO] How to craft Weapons !

89 posts in this topic

Hello everybody,

Today i'm sharing a small edit in Exile files that will allows you to crafts weapons on your servers.

I hope you'll all enjoy it and if anyone need help to install feel free to ask me !

 

Notes & Updates

- Every weapons crafted are placed on the floor, the other crafts are placed directly in the backpack !  

- It works with and without CDAH mod :

- It is still a Work-In-Progress, i'm ok to take any help on how to improve the code.

- It's my first big modification on Exile, I know it's not the best looking code, but it does the work !

- Now fully support Brama Cookbook (ExAd && xm8Apps) #UPDATED !!!

- Fixed a bug that didn't display name in Crafting windows + Allows to craft from weapons (i.e : Convert a gun to scrap Metal) #UPDATED !!!

- Fixed : Weapons craft now shows Icons ! #UPDATED !!!

COMING SOON :

1 ) Crafting Vest & Backpack !

 

How to Install ? 

 

You can find it on GitHub here : https://github.com/Novax69/weaponsCrafting      

 

I - If you use CDAH :

 

1- Go to the folder : CDAH_crafting/logic and replace the file CDAH_ExileClient_object_item_craft.sqf with the following : 

Spoiler

/**
 * ExileClient_object_item_craft
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 * Reworked by CDAH 
 * Edited by Novax
 */
 
private["_recipeClassName","_quantityToCraft","_quantityCrafted","_metSideConditions","_recipeConfig",
"_returnedItems","_interactionModelGroupClassName", "_interactionVehicleGroupClassName","_components",
"_tools","_equippedMagazines","_addedItems","_concreteMixer","_toolItemClassName","_equippedToolQuantity",
"_interactionModelGroupModels","_foundObject","_i","_hasAllComponents","_componentQuantity",
"_componentItemClassName","_equippedComponentQuantity","_returnedItemQuantity","_returnedItemClassName",
"_feedbackMessage","_returnedItemName", "_baseLevel","_neededBaseLevel",
"_playerPosition","_weaponHolder","_weaponHolderPosition","_spawnRadius","_weaponHolders"];

_recipeClassName = _this select 0;
_quantityToCraft = _this select 1;
_quantityCrafted = 0;
_metSideConditions = true;
_recipeConfig = missionConfigFile >> "CfgCraftingRecipes" >> _recipeClassName;
_returnedItems = getArray(_recipeConfig >> "returnedItems");
_interactionModelGroupClassName = getText(_recipeConfig >> "requiredInteractionModelGroup");
_interactionVehicleGroupClassName = getText (_recipeConfig >> "requiredInteractionVehicleGroup");   
_components = getArray(_recipeConfig >> "components");
_tools = getArray(_recipeConfig >> "tools");
_equippedMagazines = magazines player + weapons player + (items player - weapons player); //CDAH
_addedItems = [];
_playerPosition = player getPos [0,0];
_concreteMixer = objNull;

{
    _toolItemClassName = _x;
    _equippedToolQuantity = { _x == _toolItemClassName } count _equippedMagazines;
    if (_equippedToolQuantity == 0 ) then
    {
        _metSideConditions = false;
    };
}
forEach _tools;

//CDAH BaseLevel Request
_baseLevel = nearestObject [player, "Exile_Construction_Flag_Static"] getVariable ["ExileTerritoryLevel", 1]; 
_neededBaseLevel = getNumber (_recipeConfig >> "requiredBaseLevel");
//CDAH BaseLevel check
if (_neededBaseLevel != 0 ) then
{
    if !( _baseLevel >= _neededBaseLevel ) then
    {
        _metSideConditions = false;
    };
};

if ( getNumber(_recipeConfig >> "requiresOcean") == 1 ) then
{
    if !(surfaceIsWater getPos player) then 
    {
        _metSideConditions = false;
    };
};

if ( getNumber(_recipeConfig >> "requiresFire") == 1 ) then
{
    if !([player, 4] call ExileClient_util_world_isFireInRange) then 
    {
        _metSideConditions = false;
    };
};

if ( getNumber(_recipeConfig >> "requiresConcreteMixer") == 1 ) then
{
    _concreteMixer = (ASLtoAGL (getPosASL player)) call ExileClient_util_world_getNearestConcreteMixer;
    if (isNull _concreteMixer) then 
    {
        _metSideConditions = false;
    };
};

if( _interactionModelGroupClassName != "" ) then
{
    _interactionModelGroupModels = getArray(missionConfigFile >> "CfgInteractionModels" >> _interactionModelGroupClassName >> "models");
    _foundObject = false;
    if ([ASLtoAGL (getPosASL player), 100, _interactionModelGroupModels] call ExileClient_util_model_isNearby) then
    {
        _foundObject = true;    
    }
    else 
    {
        if ( _interactionModelGroupModels call ExileClient_util_model_isLookingAt ) then
        {
            _foundObject = true;
        };
    };
    if !(_foundObject) then
    {
        _metSideConditions = false;
    };
};

//CDAH Vehicle request
if( _interactionVehicleGroupClassName != "" ) then
{
    _interactionVehicleGroupModels = getArray(missionConfigFile >> "CfgInteractionModels" >> _interactionVehicleGroupClassName >> "models");
    _foundObject = false;
    if ([ASLtoAGL (getPosASL player), 100, _interactionVehicleGroupModels] call ExileClient_util_model_isNearby) then
    {
        _foundObject = true;    
    }
    else 
    {
        if ( _interactionVehicleGroupModels call ExileClient_util_model_isLookingAt ) then
        {
            _foundObject = true;
        };
    };
    if !(_foundObject) then
    {
        _metSideConditions = false;
    };
};

//CDAH Delete Vehicle 
_aroundVehicle = nearestObjects [player,["Car","Trucks"],30];
_interactionVehicleGroupModels = getArray(missionConfigFile >> "CfgInteractionModels" >> _interactionVehicleGroupClassName >> "models");
_end = true;

{
    if (_end) then
    {
        _object = _x;
        _objectClassName = str(_object);
        {
            if ((_objectClassName find _x) != -1) exitWith
            { 
                ["deleteVehicle", [netId _object]] call ExileClient_system_network_send;
                _end = false;
            };
        }
        forEach _interactionVehicleGroupModels;
    };
}
forEach _aroundVehicle; 

if (_metSideConditions) then
{
    for "_i" from 1 to _quantityToCraft do 
    {
        _hasAllComponents = true;
        {
            _componentQuantity = _x select 0;
            _componentItemClassName = _x select 1;
            _equippedComponentQuantity = { _x == _componentItemClassName } count _equippedMagazines;
            if (_equippedComponentQuantity < _componentQuantity ) then
            {
                _hasAllComponents = false;
            };
        }
        forEach _components;
        if (_hasAllComponents) then
        {
            if !(isNull _concreteMixer) then 
            {
                ["concreteMixerStartRequest", [netId _concreteMixer, _recipeClassName]] call ExileClient_system_network_send;
                _quantityCrafted = -1; 
            }
            else 
            {
                if ([_components, _returnedItems] call ExileClient_util_inventory_canExchangeItems) then
                {
                    {
                        _componentQuantity = _x select 0;
                        _componentItemClassName = _x select 1;
                        for "_i" from 1 to _componentQuantity do 
                        {
                            //CDAH Code
                            if (player hasWeapon _componentItemClassName) then
                            {
                                player removeWeapon _componentItemClassName;
                            } 
                            else     
                            {
                                player removeItem _componentItemClassName;
                            };
                            
                            if ((_returnedItems select 0 select 1) == "cdah_projectiles_item") then 
                            {        
                                [player, "CDAH_Ammo_Mold_item", -1] call ExileClient_util_gear_repackMagazines;
                            };
                        };
                    }
                    forEach _components;
                    {
                        _returnedItemQuantity = _x select 0;
                        _returnedItemClassName = _x select 1;
                        //_addedItems = createVehicle [_returnedItemClassName, getPosASL player, [], 0, "CAN_COLLIDE"];
                        //_addedItems = [_addedItems, _returnedItemClassName, _returnedItemQuantity] call BIS_fnc_addToPairs;
                        for "_i" from 1 to _returnedItemQuantity do 
                        {
                            _spawnRadius = 2;
                            _weaponHolders = nearestObjects [_playerPosition, ["GroundWeaponHolder"], _spawnRadius];
                            _weaponHolder = objNull;
                            
                            if (_weaponHolders isEqualTo []) then
                            {
                                    _weaponHolderPosition = [_playerPosition, _spawnRadius] call ExileClient_util_math_getRandomPositionInCircle;
                                    _weaponHolderPosition set [2, 0];
                                    _weaponHolder = createVehicle ["GroundWeaponHolder", _weaponHolderPosition, [], 0, "CAN_COLLIDE"];
                                    _weaponHolder setPosATL _weaponHolderPosition;

                            }
                            else 
                            {
                                _weaponHolder = _weaponHolders select 0;
                            };
                    
                            if (_returnedItemClassName isKindOf [_returnedItemClassName, configFile >> "CfgWeapons"]) then
                            {
                                _weaponHolder addItemCargoGlobal [_returnedItemClassName, 1];
                            } 
                            else
                            {
                                player addItem _returnedItemClassName;
                            };

                        };
                    } 
                    forEach _returnedItems;
                    _quantityCrafted = _quantityCrafted + 1;
                };
            };
        };
    };
};


if (_quantityCrafted > -1) then 
{
    if (_quantityCrafted > 0) then
    {    
        _feedbackMessage = "";
        {
            _returnedItemClassName = _x select 0;
            _returnedItemQuantity = _x select 1;
            _returnedItemName = getText(configFile >> "CfgMagazines" >> _returnedItemClassName >> "displayName");
            if (_feedbackMessage != "") then 
            {
                _feedbackMessage = _feedbackMessage + "<br/>";
            };
            _feedbackMessage = _feedbackMessage + format ["+%1x %2", _returnedItemQuantity, _returnedItemName];
        }
        forEach _addedItems;
        
        if (_returnedItemClassName isKindOf [_returnedItemClassName, configFile >> "CfgWeapons"]) then
        {
        ["SuccessTitleAndText", ["Items are on the floor !", _feedbackMessage]] call ExileClient_gui_toaster_addTemplateToast;
        } else
        {
        ["SuccessTitleAndText", ["Items are in your bag !", _feebackMessage]] call ExileClient_gui_toaster_addTemplateToast;
        };
        
    }
    else 
    {
        ["ErrorTitleAndText", ["Failed to craft!", "You do not have enough inventory space left!"]] call ExileClient_gui_toaster_addTemplateToast;
    };
};
true
 

2- Go to the folder : CDAH_crafting/logic and replace the file CDAH_ExileClient_gui_crafting_shows.sqf with the following :

Spoiler

/**
 * ExileClient_gui_crafting_show
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 * Reworked by CDAH

* Edited by Novax
 */
 
private["_recipeClassName","_recipeConfig","_recipeName","_pictureItemClassName",
"_pictureItemConfig","_recipePicture","_canCraftItem","_possibleCraftQuantity",
"_equippedMagazines","_components","_returnedItems","_tools","_dialog","_description",
"_componentQuantity","_componentItemClassName","_componentItemName","_equippedComponentQuantity",
"_toolItemClassName", "_concreteMixer" ,"_toolItemName","_equippedToolQuantity",
"_interactionModelGroupClassName","_interactionModelGroupConfig","_interactionModelGroupName",
"_interactionModelGroupModels","_foundObject","_i","_listBoxIndex",
"_interactionVehicleGroupClassName","_baseLevel", "_neededBaseLevel", "_componentItemNameWeapon","_componentItemNameItem",
"_pictureItemConfigWeapons"];

_recipeClassName = _this;
_recipeConfig = missionConfigFile >> "CfgCraftingRecipes" >> _recipeClassName;
_recipeName = getText(_recipeConfig >> "name");
_pictureItemClassName = getText(_recipeConfig >> "pictureItem");
_returnedItems = getArray(_recipeConfig >> "returnedItems");
_pictureItemConfig = configFile >> "CfgMagazines" >> _pictureItemClassName;
_pictureItemConfigWeapons = configFile >> "CfgWeapons" >> _pictureItemClassName;
_canCraftItem = true;
_possibleCraftQuantity = 99999;
_equippedMagazines = magazines player + weapons player + (items player - weapons player); //////////// CDAH Craft
_components = getArray(_recipeConfig >> "components");
_tools = getArray(_recipeConfig >> "tools");
if(_pictureItemClassName isKindOf[_pictureItemClassName, configFile >> "CfgWeapons"]) then
{
_recipePicture = getText(_pictureItemConfigWeapons >> "picture");
} else {
_recipePicture = getText(_pictureItemConfig >> "picture");
};
createDialog "RscExileCraftItemDialog";
waitUntil { !isNull findDisplay 24005 };
uiNameSpace setVariable ["RscExileCraftItemRecipeClassName", _recipeClassName];
_dialog = uiNameSpace getVariable ["RscExileCraftItemDialog", displayNull];
_description = format["<t size='1.5' font='PuristaMedium' align='left'>%1</t><br/><br/>", _recipeName];
{
    _componentQuantity = _x select 0;
    _componentItemClassName = _x select 1;
    
    _componentItemNameItem = getText(configFile >> "CfgMagazines" >> _componentItemClassName >> "displayName"); /////////// CDAH Craft
    _componentItemNameWeapon = getText(configFile >> "CfgWeapons" >> _componentItemClassName >> "displayName"); //////////// CDAH Craft
    _componentItemName = _componentItemNameWeapon + _componentItemNameItem; /////////// CDAH Craft
    
    _equippedComponentQuantity = { _x == _componentItemClassName } count _equippedMagazines;
    _description = _description + format["<t size='1' font='puristaMedium' align='left'>%1</t>", _componentItemName];
    _possibleCraftQuantity = _possibleCraftQuantity min (floor (_equippedComponentQuantity / _componentQuantity));
    if (_equippedComponentQuantity < _componentQuantity ) then
    {
        _canCraftItem = false;
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2/%3</t>", "#ea0000", _equippedComponentQuantity, _componentQuantity];
    }
    else
    { 
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2/%3</t>", "#b2ec00", _equippedComponentQuantity, _componentQuantity];
    };
    _description = _description + "<br/>";
}
forEach _components;

{
    _toolItemClassName = _x;
    _toolItemName = getText(configFile >> "CfgMagazines" >> _toolItemClassName >> "displayName");
    _equippedToolQuantity = { _x == _toolItemClassName } count _equippedMagazines;
    _description = _description + format["<t size='1' font='puristaMedium' align='left'>%1</t>", _toolItemName];
    if (_equippedToolQuantity == 0 ) then
    {
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2</t>", "#ea0000", "NOT EQUIPPED"];
        _canCraftItem = false;
    }
    else
    { 
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2</t>", "#b2ec00", "EQUIPPED"];
    };
    _description = _description + "<br/>";
}
forEach _tools;

//CDAH BaseLevel Request
_baseLevel = nearestObject [player, "Exile_Construction_Flag_Static"] getVariable ["ExileTerritoryLevel", 1]; 
_neededBaseLevel = getNumber (_recipeConfig >> "requiredBaseLevel");
//CDAH BaseLevel check
if (_neededBaseLevel != 0 ) then
{
    _description = _description + format["<t size='1' font='puristaMedium' align='left'>%1</t>", "Baselevel"];

    if( _baseLevel >= _neededBaseLevel ) then 
    {
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2/%3</t>", "#b2ec00", _baseLevel, _neededBaseLevel];
    }

    else 
    {
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2/%3</t>", "#ea0000", _baseLevel, _neededBaseLevel];
        _canCraftItem = false;
    };
    _description = _description + "<br/>";
};

if ( getNumber(_recipeConfig >> "requiresOcean") == 1 ) then
{
    _description = _description + format["<t size='1' font='puristaMedium' align='left'>%1</t>", "Ocean"];
    if( surfaceIsWater getPosATL player ) then 
    {
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2</t>", "#b2ec00", "FOUND"];
    }
    else 
    {
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2</t>", "#ea0000", "NOT FOUND"];
        _canCraftItem = false;
    };
    _description = _description + "<br/>";
};

if ( getNumber(_recipeConfig >> "requiresFire") == 1 ) then
{
    _description = _description + format["<t size='1' font='puristaMedium' align='left'>%1</t>", "Fire"];
    if( [player, 4] call ExileClient_util_world_isFireInRange ) then 
    {
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2</t>", "#b2ec00", "FOUND"];
    }
    else 
    {
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2</t>", "#ea0000", "NOT FOUND"];
        _canCraftItem = false;
    };
    _description = _description + "<br/>";
};

if ( getNumber(_recipeConfig >> "requiresConcreteMixer") == 1 ) then
{
    _description = _description + format["<t size='1' font='puristaMedium' align='left'>%1</t>", "Concrete Mixer"];
    _concreteMixer = (ASLtoAGL (getPosASL player)) call ExileClient_util_world_getNearestConcreteMixer;
    if (isNull _concreteMixer) then 
    {
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2</t>", "#ea0000", "NOT FOUND"];
        _canCraftItem = false;
    }
    else 
    {
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2</t>", "#b2ec00", "FOUND"];
    };
    _description = _description + "<br/>";
};

_interactionModelGroupClassName = getText(_recipeConfig >> "requiredInteractionModelGroup");
if( _interactionModelGroupClassName != "" ) then
{
    _interactionModelGroupConfig = missionConfigFile >> "CfgInteractionModels" >> _interactionModelGroupClassName;
    _interactionModelGroupName = getText(_interactionModelGroupConfig >> "name");
    _interactionModelGroupModels = getArray(_interactionModelGroupConfig >> "models");
    _description = _description + format["<t size='1' font='puristaMedium' align='left'>%1</t>", _interactionModelGroupName];
    _foundObject = false;
    if ([ASLtoAGL (getPosASL player), 10, _interactionModelGroupModels] call ExileClient_util_model_isNearby) then
    {
        _foundObject = true;    
    }
    else 
    {
        if ( _interactionModelGroupModels call ExileClient_util_model_isLookingAt ) then
        {
            _foundObject = true;
        };
    };
    if (_foundObject) then
    {
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2</t>", "#b2ec00", "FOUND"];
    }
    else 
    {
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2</t>", "#ea0000", "NOT FOUND"];
        _canCraftItem = false;
    };
    _description = _description + "<br/>";
};

//CDAH vehicle Request
_interactionVehicleGroupClassName = getText(_recipeConfig >> "requiredInteractionVehicleGroup");
if( _interactionVehicleGroupClassName != "" ) then
{
    _interactionVehicleGroupConfig = missionConfigFile >> "CfgInteractionModels" >> _interactionVehicleGroupClassName;
    _interactionVehicleGroupName = getText(_interactionVehicleGroupConfig >> "name");
    _interactionVehicleGroupModels = getArray(_interactionVehicleGroupConfig >> "models");
    _description = _description + format["<t size='1' font='puristaMedium' align='left'>%1</t>", _interactionVehicleGroupName];
    _foundObject = false;
    if ([ASLtoAGL (getPosASL player), 10, _interactionVehicleGroupModels] call ExileClient_util_model_isNearby) then
    {
        _foundObject = true;    
    }
    else 
    {
        if ( _interactionVehicleGroupModels call ExileClient_util_model_isLookingAt ) then
        {
            _foundObject = true;
        };
    };
    if (_foundObject) then
    {
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2</t>", "#b2ec00", "FOUND"];
    }
    else 
    {
        _description = _description + format["<t size='1' font='puristaMedium' align='right' color='%1'>%2</t>", "#ea0000", "NOT FOUND"];
        _canCraftItem = false;
    };
    _description = _description + "<br/>";
};

if !([_components, _returnedItems] call ExileClient_util_inventory_canExchangeItems) then
{
    _canCraftItem = false;
    _description = _description + format["<br/><t size='1' font='puristaMedium' align='left' color='%1'>%2</t>", "#ea0000", "Your inventory is full."];
};
if( _canCraftItem ) then 
{
    if ( getNumber(_recipeConfig >> "requiresConcreteMixer") isEqualTo 1 ) then
    {
        _possibleCraftQuantity = 1;
    };
    switch (_possibleCraftQuantity) do
    {
        case 1:
        {
            _description = _description + format["<br/><t size='1' font='puristaMedium' align='left' color='%1'>%2</t>", "#b2ec00", "You can craft this item once."];
        };
        case 99999:
        {
            _description = _description + format["<br/><t size='1' font='puristaMedium' align='left' color='%1'>%2</t>", "#b2ec00", "You can craft this item whenever you like."];
            _possibleCraftQuantity = 10; 
        };
        default 
        {
            _description = _description + format["<br/><t size='1' font='puristaMedium' align='left' color='%1'>%2</t>", "#b2ec00", format["You can craft this item %1 times.", _possibleCraftQuantity]];
        };
    };
    for "_i" from 1 to _possibleCraftQuantity do 
    {
        _listBoxIndex = lbAdd[5002, str(_i)]; 
        lbSetValue[5002, _listBoxIndex, _i];
    };
    lbSetCurSel[5002, 0];
}
else 
{
    _description = _description + format["<br/><t size='1' font='puristaMedium' align='left' color='%1'>%2</t>", "#ea0000", "You cannot craft this item yet."];
    (_dialog displayCtrl 5002) ctrlEnable false; 
    (_dialog displayCtrl 5001) ctrlEnable false; 
};
(_dialog displayCtrl 5000) ctrlSetText _recipePicture;
(_dialog displayCtrl 5003) ctrlSetStructuredText parseText _description;
true

3- Copy the folder Custom into your Mission folder

4- Open the Config.cpp in your Mission folder, search for class CfgCraftingRecipes and add the following lines : 

Spoiler

class CfgCraftingRecipes

{   

        #include "Custom\weaponsCraft\Crafts\meleeCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\accessoriesCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\ammoCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\itemsCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\launchersCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\pistolsCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\riflesCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\SMGCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\heavygunCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\sniperCrafts.hpp"

    .......

};

4- Search for class CfgExileCustomCode and add :

Spoiler

ExileClient_util_item_getCraftingRecipes = "Custom\weaponsCraft\data\ExileClient_util_item_getCraftingRecipes.sqf";

5- Edits the files inside the folder Custom/weaponsCraft/Crafts to make your own crafts :)

6- Enjoy !

 

II - If you dont use CDAH :    

 

1- Download the folders from GitHub (link Above)

2- Copy/paste the folder Custom inside your Mission folder

3- Open config.cpp inside your Mission folder

4- Search for "class CfgCraftingRecipes" and add the following :

Spoiler

class CfgCraftingRecipes

{   

        #include "Custom\weaponsCraft\Crafts\meleeCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\accessoriesCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\ammoCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\itemsCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\launchersCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\pistolsCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\riflesCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\SMGCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\heavygunCrafts.hpp"

        #include "Custom\weaponsCraft\Crafts\sniperCrafts.hpp"

    .......

};

5- Search for "class CfgExileCustomCode" and add the following : 

Spoiler

ExileClient_object_item_craft = "Custom\weaponsCraft\data\ExileClient_object_item_craft.sqf"; 

ExileClient_gui_crafting_show = "Custom\weaponsCraft\data\ExileClient_gui_crafting_show.sqf";

ExileClient_util_item_getCraftingRecipes = "Custom\weaponsCraft\data\ExileClient_util_item_getCraftingRecipes.sqf";

6- Edit the files inside the folder Custom/weaponsCraft/Crafts to add your crafts :) (Dont touch the ExileClient_Object_Item_Craft.sqf)

7- Enjoy

III - For Brama Users !    #UPDATED !!!

Spoiler

III.1 - For ExAd Users !

1- Download the files from : https://github.com/Novax69/weaponsCrafting

2- Go to ExAdClient/XM8/Apps/BRamaRecipes/ and replace the files config.sqf & onOpen.sqf with the one Given !

3- Enjoy ! 

III.2 For XM8apps Users ! 

1- Download the files from : https://github.com/Novax69/weaponsCrafting

2- Go to xm8Apps/BRamaRecipes and replace the file init.sqf with the one Given !

3- Enjoy !

 

 

And voila ! 

Have Fun !

 

P.S : i'd be happy to receive help to improve the edit if anyone have ideas :) 

P.P.S : I took the idea from the Chopping wood files.

P.P.P.S : I edited the tutorial if you saw it while it was in WIP.

Edited by Novax
5 people like this

Share this post


Link to post
Share on other sites

nice, could you maybe show an example of 1 sniper rifle recipe which definitely wouldn't fit into backpack - even if its a rubbish one as it helps people who don't know what they are doing to give it a go before asking for help.

will nicely expand my crafting which is at 100's of items as I am trying to make my new server survival with as much crafting as possible to reduce things in shops

oh and what is the criteria? ie will it just craft weapons from items or can it also maybe upgrade weapons to other weapons?

Edited by red_ned

Share this post


Link to post
Share on other sites
Advertisement

Hi,

Well no snipers fits in the backpack like "Lynx", "M320" etc... (I dont have all the names) or like Heavy Machine guns (Zaffir, mk200)

 

It allows you to use items to crafts weapons, for example using some metal board, metal junk and transform it into weapons, it's just an "update" of the Basic Exile crafting system so that it allows every server owner to place Weapons Crafts,

 

You might be able to upgrade from weapon to another weapon if you place a weaponID in the components list I guess, I didn't try that yet !

 

For example, here is the Craft for the Lynx : 

Spoiler

    class gm6_lynx: Exile_AbstractCraftingRecipe
    {
            name = "GM6 Lynx 12.7mm";
            pictureItem = "srifle_GM6_F";
            //requiresFire = 1;
            //requiresConcreteMixer = true;
            requiredInteractionModelGroup = "WorkBench";
            returnedItems[] =
            {
                    {1, "srifle_GM6_F"},
                    {1, "5Rnd_127x108_Mag"}
            };
            tools[] =
            {
                    "Exile_Item_CordlessScrewdriver"
            };
            components[] =
            {
                    {15, "Exile_Item_WeaponParts"},
                    {2, "Exile_Item_MetalPole"},
                    {4, "Exile_Item_MetalScrews"},
                    {2, "CDAH_Gun_Powder_item"},
                    {2, "CDAH_Cartridges_item"},  
                    {2, "CDAH_Projectiles_item"}    
            };
    };

as i'm Using CDAH, this crafts needs CDAH too, I havent fill every crafting recipes for weapons (as you know it's long to do, just shared some I made and will sure update it when i'm done with it)

One main "bug" is that I didn't find out how to display the weapon pictures in the craft list as you can see :

So if anyone has an idea, i'd gladly take it ^^ 

1 person likes this

Share this post


Link to post
Share on other sites

cheers @Novax just wondered (and also nice to say things like that in the initial post - talks from experience), keep up the good work

Share this post


Link to post
Share on other sites

Thanks for your support :)

 

Hope it at least helps everyone to craft weapons, i'll keep working on it and try to find a way to improve it and send updates ^^

 

Cordially 

Novax

Share this post


Link to post
Share on other sites
11 minutes ago, Novax said:

Thanks for your support :)

 

Hope it at least helps everyone to craft weapons, i'll keep working on it and try to find a way to improve it and send updates ^^

 

Cordially 

Novax

no problems, plus the image of the recipe is generated outside this so if you use Brama etc then it is all in there

Share this post


Link to post
Share on other sites
13 minutes ago, red_ned said:

no problems, plus the image of the recipe is generated outside this so if you use Brama etc then it is all in there

what is Brama ? i never heard of it before ?

Share this post


Link to post
Share on other sites
52 minutes ago, Novax said:

what is Brama ? i never heard of it before ?

XM8 App, I use the ExAd XM8 - categorises recipes

Share this post


Link to post
Share on other sites
16 hours ago, red_ned said:

no problems, plus the image of the recipe is generated outside this so if you use Brama etc then it is all in there

I use Brama too (no ExAd) but there is no image. Any ideas?

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.