DayZ 1.7.7.1 Crafting System - Needing Guidance

Topknot001

New Member
Been loving this system since it was released and works wonders for my server, but I do have one problem that I can't seem to figure out.

Would like to have new "crafting" items that would require the player to have more than one "of" item in their inventory to craft another product.

Example:
3x tank traps = 1x scrap metal

Tried:
Code:
if (("ItemTankTrap" in _items >= 3) && ("ItemToolbox" in _tool)) then {

I know I'm missing something simple, but if anyone could guide me to a resource or how the code line should read proper I would be most thankful. ;)
 
Well it seems when ya cant get an answer then work on figuring it out for yourself.

Figured that I needed to define a few extra variables and then "count" the amount of requested items needed in players inventory:
Code:
_craftItem = "ItemTankTrap";
_itemCountNeeded = 3;

Then I just simply counted through there inventory and if required items found proceed with the rest of the actions:
Code:
    if (_craftItem in _items) then {
        _itemCount = {_x == _craftItem} count magazines player;
    } else {
        _itemCount = 0;
    };
   
    if ((_itemCount >= _itemCountNeeded) && ("ItemToolbox" in _tool) && _isnear) then {

Having dug through other similar types of scripts both defunked and working was able to piece this together. Tested and works like a charm.
;)
 
Hi,

I have a question about your 1.7.7.1 crafting system. I have been able to implement the code on the server OK. it works great. huge thumbs up!! however not everyone can use it! :S

when i approach the chest i get the crafting menu option and i can access the menus and everything works. when majority of my other players try, they can see the crafting menu option on the scroll wheel however when they try to click through to the main crafting menu, nothing happens!

Also one of my players reported receiving the error:
ERROR: creating weapon CraftingItem with scope=private

This error appears when the user is logging into the game NOT when trying to access the menu. weird stuff!

So to recap:
- i can access the menu and it works great
- majority other players CAN see the menu option however CANNOT enter the menus
- one player reported a weird error when logging into the server

Thanks!!


John
 
Depending on how bored I get this weekend, I might be updating this with a new list that you can craft, ie, parts, maybe even some food stuff.

Edit: I'll be working on this when I get home today.
 
Alrighty, new questions abound.. Would there be a way to "check" if a player has a main weapon in their inventory slot? I would assume a true/false type of check? Looking to offer an expanded ability to "break down" a unwanted weapon into components.

Also SASZane, I have really re-worked a ton of your originial "crafting" system to include tier levels of crafting and such if you are interested I can get you my changes if it would help in your "updating". Added in three additional options "Industrial, Survival, and Medical" Been running them for a week now and know they work in game from players active use of them. ;)
 
That's fantastic to hear SASZane, do appreciate the effort into the "2.0" update your working on with Matt L.

At work atm but will tinker with the primaryWeapon check. Hoping it's a general check and not name specific. Such as trying to use "tin cans" as a general loot crafting item only to find out there's a buttload of tin can variations for corn, stew, etc.... and definitly dont get me started on meats lol.

Thanks again for the input..look forward to "2.0"
 
Love the Firebucket behind the fireplace and Chest, you know just incase the failure percentage kicks in..;) Looks great, looking forward to it's release.
 
Well I do have a development server I use to test, build, and try out before moving over to my actual player server. PM me if interested and we can see what we can do...
 
2.0 Sounds Wicked i Currently have your other version and players love it This would be even better keep up the brilliant work and hopely u can release soon goodluck

Oh and could there me a function where players can melt tin cans to make scrap metal just a thought a user had on my server
 
Just found this script and looking over everything it looks absolutely great! The only thing I'm having issues with is they outside website I have to apply the .biedi files to. I add buildings to my server all the time by putting them in the mission.sqm. Works perfectly for us. I don't have a bliss db though and I've attempted to put every username associated with the server in there trying to get anything at all to pop up. We have a Vilayer server so I access it through HeidiSQL. What other way can I apply these desks to the server? I have several programs that convert .biedi and .sqf to .sqm that I have been using to insert buildings.
Also, what is the purpose of moving the init and compiles files? This seems to make things more confusing when inserting other scripts or editing things. Personally I have several copies of my compiles that I've had to move around. It's something I've always wondered, if your init is in your root (Like all servers I know of) why make a copy if servers are pretty much all structured the same in regards to this file?
 
Just found this script and looking over everything it looks absolutely great! The only thing I'm having issues with is they outside website I have to apply the .biedi files to. I add buildings to my server all the time by putting them in the mission.sqm. Works perfectly for us. I don't have a bliss db though and I've attempted to put every username associated with the server in there trying to get anything at all to pop up. We have a Vilayer server so I access it through HeidiSQL. What other way can I apply these desks to the server? I have several programs that convert .biedi and .sqf to .sqm that I have been using to insert buildings.
Also, what is the purpose of moving the init and compiles files? This seems to make things more confusing when inserting other scripts or editing things. Personally I have several copies of my compiles that I've had to move around. It's something I've always wondered, if your init is in your root (Like all servers I know of) why make a copy if servers are pretty much all structured the same in regards to this file?

You can place them yourself, they are something like land_chest_ep1 or some jank. The compiles calls on the fn_selfActions, if you have more than one then you are using unnecessary space. It's usually implied but you have to merge your compiles if you already have a custom one, though if you have a custom one, 9/10 times you won't need to both merging as you have probably already done that step . In regards to the init...each hoster has different files. They do tiny modifications to the files to suit their needs or wants. The init usually doesn't vary much but it can have an impact still. Like on dayz.st you have to disable the original antihacks to use some scripts, while on hfb they come commented out already.
 
Diesel Weasel,

It is normal to have certain files "moved" over into your PBO's to allow for you to add in or modify aspects of your server environment to suit your desire of game play. Like Matt L has mentioned it is not needed to have multi-copies of most files like "fn_selfActions.sqf" in that you can merge additional items into a single copy and keep it clean.

Here's an example of where I have both the crafting system & self blood bag within the single "fn_selfActions.sqf":
Code:
if (!isNull _nearLight) then {
    if (_nearLight distance player < 4) then {
        _canPickLight = isNull (_nearLight getVariable ["owner",objNull]);
    };
};
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);


// ---------------------------------------Crafting Start------------------------------------------------

    _isCraft = cursorTarget isKindOf "Land_Chest_EP1";
        if ((speed player <= 1) && _isCraft && _canDo) then {
        if (s_player_craftBullet < 0) then {
            s_player_craftBullet = player addAction [("<t color=""#F1EF5D"">" + ("Crafting Menu") +"</t>"),"fixes\craft\excute.sqf",cursorTarget, 0, false, true, "",""];
        };
    } else {
        player removeAction s_player_craftBullet;
        s_player_craftBullet = -1;
    };
// ---------------------------------------Crafting End--------------------------------------------------
// ---------------------------------------Krixes Self Bloodbag Start------------------------------------
    _mags = magazines player;
 
    // Krixes Self Bloodbag
    if ("ItemBloodbag" in _mags) then {
        hasBagItem = true;
    } else { hasBagItem = false;};
    if((speed player <= 1) && hasBagItem && _canDo) then {
        if (s_player_selfBloodbag < 0) then {
            s_player_selfBloodbag = player addaction[("<t color=""#c70000"">" + ("Blood Transfusion yourself") +"</t>"),"custom\player_selfbloodbag.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_selfBloodbag;
        s_player_selfBloodbag = -1;
    };
// ---------------------------------------Krixes Self Bloodbag End------------------------------------
 
//Grab Flare
if (_canPickLight and !dayz_hasLight) then {

And as you can see within the "crafting" section I kept the use of the crates as the object the player needs to be at to craft items. I then added several crates (Land_Chest_EP1) within alot of my safe zones that were custom designed and loading into my server with the use of the server.pbo in that "it" loads in all my buildings, bases, temp taxi's along the coast and such all in one neat section within the "server_functions.sqf" as shown below:

Code:
server_spawnCrashSite  =    compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_spawnCrashSite.sqf";

// ------------------------Buildings------------------------------------------------
[] execVM "\z\addons\dayz_server\Buildings\BalotaOil.sqf";
[] execVM "\z\addons\dayz_server\Buildings\Excbridge.sqf";
[] execVM "\z\addons\dayz_server\Buildings\BridgeTown.sqf";
[] execVM "\z\addons\dayz_server\Buildings\DevilsCastle.sqf";
[] execVM "\z\addons\dayz_server\Buildings\NWAF.sqf";
[] execVM "\z\addons\dayz_server\Buildings\Stary.sqf";
[] execVM "\z\addons\dayz_server\Buildings\CrashTrain.sqf";
[] execVM "\z\addons\dayz_server\Buildings\CampFort.sqf";
[] execVM "\z\addons\dayz_server\Buildings\SkullCastle.sqf";
[] execVM "\z\addons\dayz_server\Buildings\Taxis.sqf";
[] execVM "\z\addons\dayz_server\Buildings\PlayerBases.sqf";
// ------------------------Buildings-------------------------------------------------

The "buildings" section is inserted right after the server_spawnCrashSite call. This way I can add and remove items at will without forcing the clients to "re-download" the game's assests, I simply wait for a server restart (Every 3 hours on mine) and quickly upload the updated server.pbo, hit the restart button and poof, next login players can have new structures, items, temp vehicles, etc....as needed or remove items as your server experience changes.

As far as "creating" places for players to craft and laying out new "chests" or whatever item you desire as a crafting object, you can simply utilize the 3D Editor to place them object around the map, save it out and simply follow the many guides in these forums on simply making a copy of the "mission.sqf" file, renaming it whatever it represents in your server (ie taxi's, crates, buildings, bases, forts, etc...)

Simple Example (original mission.sqf) as it saved out from 3D Editor:
Code:
activateAddons [
];

activateAddons [];
initAmbientLife;

_this = createCenter west;
_center_0 = _this;

_group_0 = createGroup _center_0;

_unit_0 = objNull;
if (true) then
{
  _this = _group_0 createUnit ["Bandit1_DZ", [752.33008, 1901.2999], [], 0, "CAN_COLLIDE"];
  _unit_0 = _this;
  _this setDir -33.591431;
  _this setUnitAbility 0.60000002;
  if (true) then {_group_0 selectLeader _this;};
  if (true) then {selectPlayer _this;};
};

_vehicle_20 = objNull;
if (true) then
{
  _this = createVehicle ["Land_Chest_EP1", [748.99194, 1906.1322, 9.5367432e-007], [], 0, "CAN_COLLIDE"];
  _vehicle_20 = _this;
  _this setDir 234.80344;
  _this setPos [748.99194, 1906.1322, 9.5367432e-007];
};

processInitCommands;
runInitScript;
finishMissionInit;

Now at the top replace:
Code:
activateAddons [
];

activateAddons [];
initAmbientLife;

_this = createCenter west;
_center_0 = _this;

_group_0 = createGroup _center_0;

_unit_0 = objNull;
if (true) then
{
  _this = _group_0 createUnit ["Bandit1_DZ", [752.33008, 1901.2999], [], 0, "CAN_COLLIDE"];
  _unit_0 = _this;
  _this setDir -33.591431;
  _this setUnitAbility 0.60000002;
  if (true) then {_group_0 selectLeader _this;};
  if (true) then {selectPlayer _this;};
};

With this single line:
Code:
if (isServer) then {

And at the Bottom of the file replace:
Code:
processInitCommands;
runInitScript;
finishMissionInit;

With an additional closing bracket so it looks like this:
Code:
_vehicle_20 = objNull;
if (true) then
{
  _this = createVehicle ["Land_Chest_EP1", [748.99194, 1906.1322, 9.5367432e-007], [], 0, "CAN_COLLIDE"];
  _vehicle_20 = _this;
  _this setDir 234.80344;
  _this setPos [748.99194, 1906.1322, 9.5367432e-007];
};
};  <======== (Notice the extra bracket)

Rename the "mission.sqf" to your desired name like "crafting.sqf" and place it like mentioned above in your "server_functions.sqf" repack your server.pbo and upload.

Hope this helps out some :)
 
Thank you both so much! I'm a bit paranoid about completely messing up the server which is why I have copies.
What I wasn't sure of was if the script would turn all desks into crafting benches or just new ones I added (As in natural ones in the map). I'm thinking this will be similar to the dog script and adding the dog houses? I hate going through and setting everything up only to find I messed up along the way. I've been admining our server for about 6 months now and most scripts I've gotten down pretty well. Adding buildings this way is relatively new to me and I've had a few incidents with scripts crashing us. I appreciate the super quick responses so much! I'll let you guys know how it comes out, I plan on doing a lot of work tonight!
 
No problem Diesel Weasel,

I understand your desire not to "muck" things up server side and I totally agree on backup copies of your pbo's. I just went the extra step and actually bought a second server, locked it out with a password, and it's my test and developement sololy server. Once I've tested and tweaked a new addition and it's solid I move it over to my actual public server.

As for the "desk" objects, any object that you select as your "crafting enity" by name will be global to the server, so if said "desk" is also the same object you place in your map then I would say yes all the desks will register as "crafting stations". Hense find a unique item you want to use and only place that item.
:)

Also as a side note, "merging" into your client side sqm works but God I would hate to see the length and size of it with the amount of "custom" things I've added or built. I have 40+ player bases with protection bubbles that they claimed and use and adding in all my other building additions would make that file a monster. By simply loading them server side, it's less for your player to download and much much more direct and managable for you to place and remove addition "ie buildings, bases, etc..." without forcing your players to re_download the client pbo for 2 cents worth of changes.
 
I installed the script last night, followed the instructions everyone has given me. I applied the chests just like I did all other buildings previously. When I started the server up and tried to get in I would get to about the Server Authentication point with our splash screen and after 15-20 minutes we would get an error that would completely crash and close Arma entirely. "Include file mpmissions\_CUR_MP.chernarus\Fixes\sbb_fnc1.sqf not found" is what popped up every time. Firstly, yes I am aware of the capitol F in fixes. I already had the folder with far more files than the crafting one and was afraid that two folders with the same name, just one capitol, would conflict greatly. I went through each file in the craft folder and changed every lower case f to F. I reverted my init back to what it was so Selfactions and compiles would point back to where I had them and deleted the craft folder and the server cranked back up as normal. I don't have a file named sbb_fnc1.sqf in my Fixes folder which confused me. I've never heard of that file before and the server started right up immediately as soon as I reverted back. :confused:
 
Sounds like you had either a major typo in that file "sbb_fnc1.sqf" is an unknown to me and has no place in the crafting system. As for having "two" fixes folders not sure why, when the original crafting system was simply a sub-folder inside of fixes... i.e. "Fixes\Crafting" or what ever name you picked. You Can relocate the "crafting" as a whole to anywhere you want just need to change the pathing statements inside the menu defines.

Did you "merge" the crafting call inside "fn_selfActions.sqf" or did you create a second one? Just curious by reading your statement above.
 
Back
Top