Item Crafting and Weapon Accessories

SmokeyMeadow

Well-Known Member
Help and discussion for Item crafting & weapon accessories takes place here...

That's nice. I've not seen that. Seems a bit more complicated than what I'm trying to provide for the people on my server. I'll stick with the system I'm using now, since I would have to modify that other script to make it work how I want. Thanks for sharing.
 
Why you´re not adding a random chance to break some of the stuff during the building / destruction process ?

E.g. if someone is building a shotgun, there is a 5% chance to break the toolbox, a 10% chance to break the knife and a 50% chance to break one of the ingredients so it results in a failure. Same during the destruction of a shotgun. And even if none of the items breaks during the process, there should be a overall chance to fail.
 

SmokeyMeadow

Well-Known Member
I like that idea. There's already a built in failure mechanic for the arrows, so there is a decent chance the arrow you make could break when you try to pick it up. I wonder if this could be adapted to the other build items.
 

Rossymond

Moderator
Staff member
Yup, I use this a bunch for different things

_chance = random floor 100

If (chance < 20) then {
Blah blah

Obviously no syntax as I'm on the iPad. But google it or search here for samples
 
If it is possible to use it with a single line of code, then it is worth a try.

Otherwise you could try it like i have on my server :

Code:
_chance = floor(random 100);
 
if (_chance > 5) then {success} else {failure};
 

Rossymond

Moderator
Staff member
Lol always the way.

I generally use _chance for multiple things in one script. Or you could just use bis_fnc_selectrandom if that fits the bill.
 

SmokeyMeadow

Well-Known Member
This is good stuff. Thank you, both of you.

If it is possible to use it with a single line of code, then it is worth a try.

Otherwise you could try it like i have on my server :

Code:
_chance = floor(random 100);
 
if (_chance > 5) then {success} else {failure};
Where do I put this line? Does it go in the fn_selfactions or do I put it inside the crafting sqf?
 

Rossymond

Moderator
Staff member
Use it through the crafting SQF, add it as a variable at the top then use the if blah blah BEFORE the script does anything, or it's abit pointless
 
;) As i had a good start in the day(z), i´ll give you an example :
Code:
private["_chance"];
 
_chance = floor(random 100);
 
player playActionNow "Medic";
sleep 1;
titleText ["You are crafting a baseball bat.","PLAIN DOWN"]; titleFadeOut 5;
 
if (_chance > 45) then
    {
        _mypos = getposATL player;
        _dir = getdir player;
        _mypos = [(_mypos select 0)+2*sin(_dir),(_mypos select 1)+2*cos(_dir), (_mypos select 2)];
        _createBat = createVehicle ["WeaponHolder_MeleeBaseBallBat", _mypos, [], 0, "CAN_COLLIDE"];
        _createShield setDir _dir;
        _createShield setposATL _mypos;
        sleep 1;
       
        player removeMagazine "PartWoodPile";
        sleep 0.01;
       
        titleText ["Baseball Bat created.","PLAIN DOWN"]; titleFadeOut 5;
    }
else
    {
        player removeMagazine "PartWoodPile";
        player removeWeapon "ItemKnife";
        sleep 0.01;
       
        titleText ["You failed to craft the bat. The Knife is broken.","PLAIN DOWN"]; titleFadeOut 5;
    };
 

SmokeyMeadow

Well-Known Member
Oh wow, that works perfectly. I've updated the OP with the new bat script, and my rewrite of makearrow.sqf. The wood now is occasionally too rotten to carve, and you will cut your hand. I borrowed a line of code from the gut humans script:

Code:
        player setVariable["USEC_inPain",true,true];
        r_player_blood = r_player_blood - 1000;
So now there's a decent chance of injury from crafting the makeshift arrows. Now for the fun part, I can redo the bow and gun scripts accordingly. Thanks again for all the help.
 
Thanks! I have also tried that TGW script and it's a shame it doesn't work on DayZ. But is it possible to but a thermal scope on an FN FAL?
 

SmokeyMeadow

Well-Known Member
Opening up the TGW pbo, I see it's basically an updated config.bin with the changed weapons and their new optics modes listed. Very small file size. Incorporating this into the mission file would not force players to download some huge new set of files not currently in the game. This is just tweaking the configuration file for the existing guns, which is apparently where their optics modes are defined. So the question is, how do we edit our mission to call the updated config.bin? Because I'm looking through the day z code and I do not see any reference to anything like this.
 

SmokeyMeadow

Well-Known Member
No prob. I have located the config.bin inside dayz.pbo. Not sure if changing it server side would require everyone to download the modified version though. I'll play around with it and report back.
 
Top