Grafzahl's Breakable Melee Weapons on Buildables

RRP47

New Member
http://opendayz.net/threads/release-epoch-breakable-melee-weapons-on-buildables.18178/

Couldn't find a help thread, and I'm having an issue, so figured I'd open the door, lol.

I tried this script out on my Panthera server, and it was successful, to a point. It would only work on the hatchet. Hatchet gave the warning message, and even broke. Crowbar, sledge, machete wouldn't give the message, and after hacking away with each of these, 3 guys, for 45 minutes a piece, no message, no weapon breakage.

I have pulled it off the server for the time being, in hopes to add it back. Any ideas?

code added to player_harvest.sqf

Code:
private ["_item","_iPos","_weapon","_primaryWeapon","_iItem","_removed","_radius","_dropPrimary","_buildableNearby","_breakChance"];
_buildableNearby = false;
_breakChance = 1;
if (_ammo isKindOf "Sledge_Swing_Ammo") then {
    _breakChance = 0.1;
};
if (_ammo isKindOf "Crowbar_Swing_Ammo") then {
    _breakChance = 0.5;
};
if (_ammo isKindOf "Hatchet_Swing_Ammo" or _ammo isKindOf "Machete_Swing_Ammo" or _ammo isKindOf "Sledge_Swing_Ammo" or _ammo isKindOf "Crowbar_Swing_Ammo" or _ammo isKindOf "Fishing_Swing_Ammo") then {
    {
        if ((_x isKindOf "ModularItems") or (_x isKindOf "Land_DZE_WoodDoor_Base") or (_x isKindOf "CinderWallDoor_DZ_Base")) then {
            if (alive _x) then {
                _buildableNearby = true;
            };
        };
    } foreach nearestObjects [getPosATL player, [], 6];
    if(_buildableNearby) then {
        if(random 100 <= _breakChance) then {
            _primaryWeapon = primaryWeapon player;
            cutText ["\n\nYour Melee-Weapon broke while you was trying to destroy this buildable!", "PLAIN DOWN"];
            player removeWeapon _primaryWeapon;
        } else {
            cutText [format["\n\nYour Melee-Weapon has a %1%2 chance to break while using it near buildables!",_breakChance,"%"], "PLAIN DOWN"];
        };
    };
};

I followed directions to the letter, and obviously had it working, but only for the hatchet. If I can get this working for all weapons as intended, I have 3 servers this will go on. lol

Thanks in advance!
 
I'm having issues too. At present my hatchet gives no wood. Perhaps it would be better to apply a chance to break the melee weapons regardless of their distance to any buildables, kinda skyrim style. So overtime melee weapons will eventually break...instead of hitting 999999 times.

If I get this working properly I'll let you know here.
 
Back
Top