Jump to content

[1.6 Harvestable hemp, smoking weed, pot farms]


juandayz

Recommended Posts

Update for deploy anything if you don´t like macca or just not using the extra_rc script:

// be sure to have a komma on the lines that come before  
	["ItemKnife","Harvest the weed","execVM 'drugs\cuthemp.sqf';","true"],
    ["ItemKiloHemp","Smoke that shit","execVM 'drugs\smoke.sqf';","true"],
	["ItemMachete","Harvest the weed","execVM 'drugs\cuthemp.sqf';","true"] // no komma after last line

@juandayz it should work, have yet to have tested it though

Link to comment
Share on other sites

20 minutes ago, Jestertriks said:

What would cause when I try to harvest the plant. no matter where I stand it keeps saying you need to be close to a plant to harvest. I used click options, all my file paths are correct. smoke weed is working, I just can not harvest the plants

 

thanks guys

 

hers the part where the nearest restriction is defined

_playerPos = getPosATL player;//get player pos
_nearWeed = count nearestObjects [_playerPos, ["fiberplant"], 4] > 0;//set player pos from fiberplant almost 4mts of distance

//if is not close exit from the script
if !(_nearWeed) exitWith {
 systemChat("Needs be near of a FiberPlant");
};

i cannot see nothing wrong

Link to comment
Share on other sites

what I downloaded from your link looks different. would that make a difference?

 

private ["_vehicle","_inVehicle","_countplayers","_gearmenu","_playerPos","_nearWeed","_weed","_objectID","_objectUID"];
_playerPos = getPosATL player;
_hempqty = {_x == "ItemKiloHemp"} count magazines player;
_nearWeed = count nearestObjects [_playerPos, ["fiberplant"], 4] > 0;
_weed = nearestObject [player, "fiberplant"];

if !(_nearWeed) exitWith {
 systemChat("Needs be near of a FiberPlant");

Link to comment
Share on other sites

58 minutes ago, Jestertriks said:

what I downloaded from your link looks different. would that make a difference?

 

private ["_vehicle","_inVehicle","_countplayers","_gearmenu","_playerPos","_nearWeed","_weed","_objectID","_objectUID"];
_playerPos = getPosATL player;
_hempqty = {_x == "ItemKiloHemp"} count magazines player;
_nearWeed = count nearestObjects [_playerPos, ["fiberplant"], 4] > 0;
_weed = nearestObject [player, "fiberplant"];

if !(_nearWeed) exitWith {
 systemChat("Needs be near of a FiberPlant");

nop its the same.. i just remove the lines in the post to show you exactly.. see lines in black

Spoiler

private ["_vehicle","_inVehicle","_countplayers","_gearmenu","_playerPos","_nearWeed","_weed","_objectID","_objectUID"];
_playerPos = getPosATL player;
_hempqty = {_x == "ItemKiloHemp"} count magazines player;
_nearWeed = count nearestObjects [_playerPos, ["fiberplant"], 4] > 0;
_weed = nearestObject [player, "fiberplant"];

if !(_nearWeed) exitWith {
 systemChat("Needs be near of a FiberPlant");

};

 

Link to comment
Share on other sites

@Jestertriks  anywy try this without all restrictions

private ["_playerPos","_nearWeed","_weed"];
_playerPos = getPosATL player;
_nearWeed = count nearestObjects [_playerPos, ["fiberplant"], 4] > 0;
_weed = nearestObject [player, "fiberplant"];


CloseDisplay 106;

if !(_nearWeed) exitWith {
 systemChat("Needs be near of a FiberPlant");
}else{

	player playActionNow "Medic";
	sleep 1;

	deleteVehicle _weed;

	player addMagazine "ItemKiloHemp";
	sleep 1;
	 systemChat("NICE LETS SMOKE OR SELL");
};

 

Link to comment
Share on other sites

45 minutes ago, Jestertriks said:

http://steamcommunity.com/sharedfiles/filedetails/?id=889219278

 

yea idk. its weird. I'm sure its working for you guys but I installed it exactly like instructed

this is what i have and it works great

Spoiler

/*
rewrited by juandayz for epoch 1.6
put together for DayZ Epoch
Credits to Shogun338 from Insurrection gaming
modified for separate "gather weed" script
*/

private ["_vehicle","_inVehicle","_countplayers","_gearmenu","_playerPos","_nearWeed","_weed","_objectID","_objectUID"];
_playerPos = getPosATL player;
_hempqty = {_x == "ItemKiloHemp"} count magazines player;
_nearWeed = count nearestObjects [_playerPos, ["fiberplant"], 4] > 0;
_weed = nearestObject [player, "fiberplant"];

if !(_nearWeed) exitWith {
 systemChat("Needs be near of a FiberPlant");
};
if (_hempqty > 2) exitWith { 
    systemChat("YOure Full of Drugs");
};
if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {
dayz_actionInProgress = false; 
systemChat("Not in combat mode");
};
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
_countplayers = count nearestObjects [player, ["CAManBase"], 7];
if (_inVehicle) exitWith {
 systemChat("you cannot do it in a vehicle");
 };
if (_countplayers > 1) exitWith {

  systemChat("Nearest player action cancelled");
 };

    disableSerialization;
    _gearmenu = FindDisplay 106;
    _gearmenu CloseDisplay 106;
    player playActionNow "Medic";
    r_interrupt = false;
    sleep 6;
    //uncoment all comented lines if u have somekind of issue
    _objectID = _weed getVariable["ObjectID","0"];
    _objectUID = _weed getVariable["ObjectUID","0"];
    deleteVehicle _weed;
    [_objectID,_objectUID] call server_deleteObj;
    PVDZ_obj_Destroy = [_objectID,_objectUID,_weed];
    publicVariableServer "PVDZ_obj_Destroy";
    player addMagazine "ItemKiloHemp";
    sleep 2;
     systemChat("NICE LETS SMOKE OR SELL");

 

Link to comment
Share on other sites

8 minutes ago, Jestertriks said:

would you mind sharing your dayz_server/modules/weedfarm.sqf? Maybe the one I downloaded is bad

Spoiler

/*
        Script by HALV
        Create Weed fields (or other objects) in random locations, amount and "random preset" amount of objects,
        objects are placed "Labyrinth Style" around the middle object
*/
 
_useLocalMarkers = false;
 
if (isServer)then{
        private["_blacklistedAreas"];
        diag_log "[Random_Weed_Farm]: waiting for BIS_fnc_findSafePos";
        waitUntil {(!isNil "BIS_fnc_findSafePos")};
        if(isNil "dayz_MapArea")then{dayz_MapArea = 7000};
        _WorldName = toLower format ["%1", worldName];
 
//settings
        //how many will spawn farms, note that farms can spawn "on top" of eachother (min 1, default 6)
        _farms = 6;
        //min farms (min 1, default 2)
        _farmsmin = 2;
        //how many plants per farm (min 1, default 9)
        _plants = 9;
        //min plants (min 1, default 4)
        _plantsmin = 4;
        //min dist (in meters) from roads to build farms (default 200m)
        _mindist2roads = 200;
        //the object to spawn, default "Fiberplant"
        _fiberplant = "Fiberplant";
        _spawnarea = (dayz_MapArea/2);
        switch(_WorldName)do{
                case "napf":{
                _blacklistedAreas = [
                [[8246.3184,15485.867,0],       500],
                [[15506.952,13229.368,0],       500],
                [[12399.751,5074.5273,0],       500],
                [[10398.626,8279.4619,0],       500],
                [[5149.9814,4864.1191,0],       500],
                [[6633.1538,7254.916,0],        500],
                [[13288.313,19590.338,0],       800]
                ];
                };
                case "chernarus":{
                _blacklistedAreas = [
                [[23999.742,2.4571743,0],       500],
                [[6325.6772,7807.7412,0],       500],
                [[4063.4226,11664.19,0],        500],
                [[11447.472,11364.504,0],       500],
                [[1606.6443,7803.5156,0],       500],
                [[12944.227,12766.889,0],       500],
                [[8122.35,13464.5,0],           500] // <-- no comma for last entry
                ];
                };
                default{
                _blacklistedAreas = [
                        [[0,0,0],       0]
                ];
                };
        };
//function to find x amount of positions around a position (on ground, z axis not included) in a size you define - "labyrinth style"
//[start position, amount of positions to return (ex start pos), distance between positions,include startposition (optional, default true)] call _fnc_positions_array
        _fnc_positions_array = {
                private ["_posi"];
                _pos = _this select 0;
                _amnt = _this select 1;
                _adjust = _this select 2;
                _include = if(count _this > 3)then{_this select 3}else{true};
                _positions = [];
                _buildDir = 0;
                _buildRow = 0;
                _Row = 0;
                _build = 0;
                if(_include)then{_positions set [count _positions,[_pos select 0,_pos select 1,0]];_amnt = _amnt - 1;};
                for "_i" from 0 to (_amnt-1) do {
                        if(_Row > 1)then{_buildRow = _buildRow + 1;_Row = 0;};
                        if(_buildDir > 3)then{_buildDir = 0;};
                        for "_i" from 0 to _buildRow do {
                                switch (_buildDir) do{
                                        case 0:{
                                                _posi = [(_pos select 0),(_pos select 1) + _adjust]; //up
                                                _positions set [count _positions,[_posi select 0,_posi select 1,0]];
                                        };
                                        case 1:{
                                                _posi = [(_pos select 0) + _adjust,(_pos select 1)]; //left
                                                _positions set [count _positions,[_posi select 0,_posi select 1,0]];
                                        };
                                        case 2:{
                                                _posi = [(_pos select 0),(_pos select 1) - _adjust]; //down
                                                _positions set [count _positions,[_posi select 0,_posi select 1,0]];
                                        };
                                        case 3:{
                                                _posi = [(_pos select 0) - _adjust,(_pos select 1)]; //right
                                                _positions set [count _positions,[_posi select 0,_posi select 1,0]];
                                        };
                                };
                                _pos = _posi;
                                _build = _build + 1;
                                if(_build >= _amnt)exitWith{};
                        };
                        _buildDir = _buildDir + 1;
                        _Row = _Row + 1;
                        if(_build >= _amnt)exitWith{};
                };
//              diag_log format["[Random_Weed_Farm]: Debug - _build: '%1' _amnt: '%2' _positions: '%3' %4",_build,_amnt,(count _positions),_positions];
                _positions
        };
 
        _amnt = round(random _farms);
        if(_amnt < _farmsmin)then{_amnt = _farmsmin};
        if(_amnt < 1)then{_amnt = 1};
 
        diag_log format["[Random_Weed_Farm]: Function loaded ... Server Building %1 Weed Farm(s)",_amnt];
 
        _locations = [];
        for "_i" from 0 to (_amnt-1) do {
                private ["_coords"];
                while{true}do{
                        scopeName "posiscope";
                        _coords = [getMarkerPos 'Center',0,_spawnarea,25,0,2000,0] call BIS_fnc_findSafePos;
                        _roadlist = _coords nearRoads _mindist2roads;
                        _IsBlacklisted = false;
                        {if(_coords distance (_x select 0) < (_x select 1))exitWith{_IsBlacklisted = true};}forEach _blacklistedAreas;
                        if((count _roadlist < 1) and !_IsBlacklisted)then{breakOut "posiscope"};
                };
                _locations set [count _locations,[_coords select 0,_coords select 1,0]];
                _amnt = round(random _plants);
                if(_amnt < _plantsmin)then{_amnt = _plantsmin};
                if(_amnt < 1)then{_amnt = 1};
                diag_log format["[Random_Weed_Farm]: Found Location for a farm (%1) %2 with %3 plants",mapGridPosition _coords,_coords,_amnt];
                //aparently sizeOf has problems sometimes, so we iput this manually - else perhaps use [position, amount, sizeOf "object"]
                _plantpositions = [[(_coords select 0),(_coords select 1),0],_amnt,5] call _fnc_positions_array;
                {
                        _plant = createVehicle [_fiberplant, _x, [], 0, "CAN_COLLIDE"];
                        _plant setPos _x;
                        _uID = str(round(random 999999));
                        _plant setVariable ["ObjectID", _uID, true];
                        _plant setVariable ["ObjectUID", _uID, true];
                        _plant setVariable ["lastUpdate",time,true];
                }forEach _plantpositions;
        };
        diag_log "[Random_Weed_Farm]: Weed Farm(s) Done ... Broadcasting locations for clients";
        PV_HALV_Broadcast_weedlocations = _locations;
        publicVariable "PV_HALV_Broadcast_weedlocations";
};
 
//comment out for no markers
if(!isDedicated)then{
        diag_log "[Random_Weed_Farm]: Client awaiting markers ...";
        waitUntil{(!isNil "PV_HALV_Broadcast_weedlocations")};
        //create markers
        _nr = 1;
        for "_i" from 0 to ((count PV_HALV_Broadcast_weedlocations)-1) do {
                _markername = format["WeedFarm_%1",_nr];
                _markertext = format["Weed Farm %1",_nr];
                if(_useLocalMarkers)then{
                        _marker = createMarkerLocal [_markername, (PV_HALV_Broadcast_weedlocations select _i)];
                        _marker setMarkerTypeLocal "Warning";
                        _marker setMarkerTextLocal _markertext;
                        _marker setMarkerColorLocal "ColorGreen";
                }else{
                        if (getMarkerColor _markername == "") then {
                                _marker = createMarker [_markername, (PV_HALV_Broadcast_weedlocations select _i)];
                                _marker setMarkerType "Warning";
                                _marker setMarkerText _markertext;
                                _marker setMarkerColor "ColorGreen";
                        };
                };
                diag_log format["[Random_Weed_Farm]: Client created marker %1 ...",_nr];
                _nr = _nr + 1;
        };
        PV_HALV_Broadcast_weedlocations = nil;
};

 I also have mine mission sided, called from the init. not sure if that makes a difference

Link to comment
Share on other sites

@Jestertriks a lil test to see if your problem is the event.

we gonna plant manually the fiberplant ok?

if u have deploy anything use step 1.

if u use extra_Rc.hpp use step 2.

if u doont have any right click mod.. the n use step 3

STEP 1 (DEPLOY ANYTHING)-add this line in \MPMissions\DayZ_Epoch_11.Chernarus\addons\bike\config.sqf

Spoiler

    ["ItemEtool",[0,2,1],5,1,false,false,false,false,false,true,true,["fiberplant"],[],[""],"true"]

STEP 2 (EXTRA_RC)-create plantmanually.sqf (mpmissions\your instance\drugs\)

Spoiler

private ["_playerPos","_nearRestr","_hastool","_hasitem","_removed","_abort","_reason","_distance","_isNear","_lockable","_isAllowedUnderGround","_offset","_classname","_zheightdirection","_zheightchanged","_rotate","_objectHelperPos","_objectHelperDir","_objHDiff","_position","_isOk","_dir","_vector","_cancel","_location2","_buildOffset","_location","_limit","_started","_finished","_animState","_isMedic","_proceed","_counter","_dis","_sfx","_combination_1_Display","_combination_1","_combination_2","_combination_3","_combination","_combinationDisplay","_combination_4","_num_removed","_tmpbuilt","_vUp","_classnametmp","_text","_ghost","_objectHelper","_location1","_object","_helperColor","_canDo","_pos","_onLadder","_vehicle","_inVehicle","_needNear","_canBuild"];

//Check if building already in progress, exit if so.
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;};
dayz_actionInProgress = true;

_pos = [player] call FNC_GetPos;

_onLadder =    (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;

_vehicle = vehicle player;
_inVehicle = (_vehicle != player);

 

 


/////////////////////////////RESTRICT IF ANOTHER OBJET IS NEAR
_playerPos = getPosATL player;
_nearRestr = count nearestObjects [_playerPos, ["MAP_kulna"], 45] > 0;
 

if (_nearRestr) exitWith {
cutText [format["You cannot build another MAP_kulna in this plot area"], "PLAIN DOWN"];  
    dayz_actionInProgress = false;
    };

 


DZE_Q = false;
DZE_Z = false;

DZE_Q_alt = false;
DZE_Z_alt = false;

DZE_Q_ctrl = false;
DZE_Z_ctrl = false;

DZE_5 = false;
DZE_4 = false;
DZE_6 = false;

DZE_F = false;

DZE_cancelBuilding = false;

DZE_updateVec = false;
DZE_memDir = 0;
DZE_memForBack = 0;
DZE_memLeftRight = 0;

call gear_ui_init;
closeDialog 1;

if (dayz_isSwimming) exitWith {dayz_actionInProgress = false; localize "str_player_26" call dayz_rollingMessages;};
if (_inVehicle) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_42" call dayz_rollingMessages;};
if (_onLadder) exitWith {dayz_actionInProgress = false; localize "str_player_21" call dayz_rollingMessages;};
if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_43" call dayz_rollingMessages;};

 

//////////////////////////////PUT YOUR OBJET ID BELLOW
_classname =  "fiberplant";
///////////////////////////////////////////////    
_classnametmp = _classname;
_text =         getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
    

    _lockable = 0; //default define if lockable not found in config file below
    if(isNumber (configFile >> "CfgVehicles" >> _classname >> "lockable")) then { //find out if item is lockable object
        _lockable = getNumber(configFile >> "CfgVehicles" >> _classname >> "lockable"); // 2=lockbox, 3=combolock, 4=safe
    };

    _isAllowedUnderGround = 1; //check if allowed to build under terrain
    if(isNumber (configFile >> "CfgVehicles" >> _classname >> "nounderground")) then {
        _isAllowedUnderGround = getNumber(configFile >> "CfgVehicles" >> _classname >> "nounderground");
    };

_offset =     getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
if((count _offset) <= 0) then {
    _offset = [0,5,1];
};    

    _objectHelper = objNull;
    _isOk = true;
    _location1 = [player] call FNC_GetPos; // get inital players position
    _dir = getDir player; //required to pass direction when building

    // if ghost preview available use that instead
    if (_ghost != "") then {
        _classname = _ghost;
    };

    _object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"]; //object preview, not an actual object that will be built

    

    _objectHelper = "Sign_sphere10cm_EP1" createVehicle [0,0,0];
    _helperColor = "#(argb,8,8,3)color(0,0,0,0,ca)";
    _objectHelper setobjecttexture [0,_helperColor];
    _objectHelper attachTo [player,_offset];
    _object attachTo [_objectHelper,[0,0,0]];

    if (isClass (configFile >> "SnapBuilding" >> _classname)) then {    
        ["","","",["Init",_object,_classname,_objectHelper]] spawn snap_build;
    };

    
        ["","","",["Init","Init",0]] spawn build_vectors;
    

    _objHDiff = 0;    
    _cancel = false;
    _reason = "";
    
    helperDetach = false;
    _canDo = (!r_drag_sqf and !r_player_unconscious);
    _position = [_objectHelper] call FNC_GetPos;

    while {_isOk} do {

        _zheightchanged = false;
        _zheightdirection = "";
        _rotate = false;

        if (DZE_Q) then {
            DZE_Q = false;
            _zheightdirection = "up";
            _zheightchanged = true;
        };
        if (DZE_Z) then {
            DZE_Z = false;
            _zheightdirection = "down";
            _zheightchanged = true;
        };
        if (DZE_Q_alt) then {
            DZE_Q_alt = false;
            _zheightdirection = "up_alt";
            _zheightchanged = true;
        };
        if (DZE_Z_alt) then {
            DZE_Z_alt = false;
            _zheightdirection = "down_alt";
            _zheightchanged = true;
        };
        if (DZE_Q_ctrl) then {
            DZE_Q_ctrl = false;
            _zheightdirection = "up_ctrl";
            _zheightchanged = true;
        };
        if (DZE_Z_ctrl) then {
            DZE_Z_ctrl = false;
            _zheightdirection = "down_ctrl";
            _zheightchanged = true;
        };
        if (DZE_4) then {
            _rotate = true;
            DZE_4 = false;
            if(DZE_dirWithDegrees) then{
                DZE_memDir = DZE_memDir - DZE_curDegree;
            }else{
                DZE_memDir = DZE_memDir - 45;
            };
        };
        if (DZE_6) then {
            _rotate = true;
            DZE_6 = false;
            if(DZE_dirWithDegrees) then{
                DZE_memDir = DZE_memDir + DZE_curDegree;
            }else{
                DZE_memDir = DZE_memDir + 45;
            };
        };
        
        if(DZE_updateVec) then{
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
            DZE_updateVec = false;
        };
        
        if (DZE_F and _canDo) then {
            if (helperDetach) then {
                _objectHelper attachTo [player];
                DZE_memDir = DZE_memDir-(getDir player);
                helperDetach = false;
                [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
            } else {        
                _objectHelperPos = getPosATL _objectHelper;
                detach _objectHelper;            
                DZE_memDir = getDir _objectHelper;
                [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
                _objectHelper setPosATL _objectHelperPos;
                _objectHelper setVelocity [0,0,0]; //fix sliding glitch
                helperDetach = true;
            };
            DZE_F = false;
        };

        if(_rotate) then {
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
        };

        if(_zheightchanged) then {
            if (!helperDetach) then {
            detach _objectHelper;
            _objectHelperDir = getDir _objectHelper;
            };

            _position = [_objectHelper] call FNC_GetPos;

            if(_zheightdirection == "up") then {
                _position set [2,((_position select 2)+0.1)];
                _objHDiff = _objHDiff + 0.1;
            };
            if(_zheightdirection == "down") then {
                _position set [2,((_position select 2)-0.1)];
                _objHDiff = _objHDiff - 0.1;
            };

            if(_zheightdirection == "up_alt") then {
                _position set [2,((_position select 2)+1)];
                _objHDiff = _objHDiff + 1;
            };
            if(_zheightdirection == "down_alt") then {
                _position set [2,((_position select 2)-1)];
                _objHDiff = _objHDiff - 1;
            };

            if(_zheightdirection == "up_ctrl") then {
                _position set [2,((_position select 2)+0.01)];
                _objHDiff = _objHDiff + 0.01;
            };
            if(_zheightdirection == "down_ctrl") then {
                _position set [2,((_position select 2)-0.01)];
                _objHDiff = _objHDiff - 0.01;
            };

            if((_isAllowedUnderGround == 0) && ((_position select 2) < 0)) then {
                _position set [2,0];
            };

            if (surfaceIsWater _position) then {
                _objectHelper setPosASL _position;
            } else {
                _objectHelper setPosATL _position;
            };

            if (!helperDetach) then {
            _objectHelper attachTo [player];
            };
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
        };

        uiSleep 0.5;

        _location2 = [player] call FNC_GetPos;
        _objectHelperPos = [_objectHelper] call FNC_GetPos;
        
        if(DZE_5) exitWith {
            _isOk = false;
            _position = [_object] call FNC_GetPos;
            detach _object;
            _dir = getDir _object;
            _vector = [(vectorDir _object),(vectorUp _object)];    
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if(_location1 distance _location2 > DZE_buildMaxMoveDistance) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = format[localize "STR_EPOCH_BUILD_FAIL_MOVED",DZE_buildMaxMoveDistance];
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };
        
        if(_location1 distance _objectHelperPos > DZE_buildMaxMoveDistance) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = format[localize "STR_EPOCH_BUILD_FAIL_TOO_FAR",DZE_buildMaxMoveDistance];
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if(abs(_objHDiff) > DZE_buildMaxHeightDistance) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = format[localize "STR_EPOCH_BUILD_FAIL_HEIGHT",DZE_buildMaxHeightDistance];
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = localize "str_epoch_player_43";
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if (DZE_cancelBuilding) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = localize "STR_EPOCH_PLAYER_46";
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };
    };
    
    _isOk = true;
    _proceed = false;
    _counter = 0;
    _location = [0,0,0];

    //No building on roads unless toggled
    if (!DZE_BuildOnRoads) then {
        if (isOnRoad _position) then { _cancel = true; _reason = localize "STR_EPOCH_BUILD_FAIL_ROAD"; };
    };

    // No building in trader zones
    if(!canbuild) then { _cancel = true; _reason = format[localize "STR_EPOCH_PLAYER_136",localize "STR_EPOCH_TRADER"]; };

    if(!_cancel) then {

        _classname = _classnametmp;

        // Start Build
        _tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"]; //create actual object that will be published to database

        _tmpbuilt setdir _dir; //set direction inherited from passed args from control
        _tmpbuilt setVariable["memDir",_dir,true];

        // Get position based on object
        _location = _position;

        if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then { //check Z axis if not allowed to build underground
            _location set [2,0]; //reset Z axis to zero (above terrain)
        };
        
        _tmpbuilt setVectorDirAndUp _vector;
        
        _buildOffset = [0,0,0];
        _vUp = _vector select 1;
        switch (_classname) do {
            case "MetalFloor_DZ": { _buildOffset = [(_vUp select 0) * .148, (_vUp select 1) * .148,0]; };
        };
        
        _location = [
            (_location select 0) - (_buildOffset select 0),
            (_location select 1) - (_buildOffset select 1),
            (_location select 2) - (_buildOffset select 2)
        ];
    
        if (surfaceIsWater _location) then {
            _tmpbuilt setPosASL _location;
            _location = ASLtoATL _location; //Database uses ATL
        } else {
            _tmpbuilt setPosATL _location;
        };

        format[localize "str_epoch_player_138",_text] call dayz_rollingMessages;

        //////////////////////////////////////////////////##########START TO BUILD AND REMOVE OBJETS
player playActionNow "Medic";
[player,"repair",0,false,10] call dayz_zombieSpeak;
[player,10,true,(getPosATL player)] spawn player_alertZombies;
sleep 3;

//////////Change items bellow by your owns in _hasitems variable
    
cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
////////////////////////////////////////////////////////////////////////////////        
        _limit = 3; //times it takes to build by default

        if (DZE_StaticConstructionCount > 0) then { //if count is manually overridden inside init.sqf, use that instead, else use limits configured in config files
            _limit = DZE_StaticConstructionCount;
        }
        else {
            if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
                _limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
            };
        };


        
                

                _tmpbuilt setVariable ["OEMPos",_location,true]; //store original location as a variable

                 //if not lockable item
                    
                    _tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
                    
                        if (DZE_permanentPlot) then {
                            _tmpbuilt setVariable ["ownerPUID",dayz_playerUID,true];
                            
                                _friendsArr = [[dayz_playerUID,toArray (name player)]];
                                _tmpbuilt setVariable ["plotfriends", _friendsArr, true];
                                PVDZ_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,dayz_playerUID,_vector],_friendsArr];
                                publicVariableServer "PVDZ_obj_Publish";
                        //customize msg bellow
                        cutText [format["NICE!"], "PLAIN DOWN",3];    
                    };
                
            } else { //if magazine was not removed, cancel publish
                deleteVehicle _tmpbuilt;
                localize "str_epoch_player_46" call dayz_rollingMessages;
            };

     

//by juandayz writed with base on modular_build.sqf

dayz_actionInProgress = false;

open your extra_rc.hpp and paste:

Spoiler

class ItemEtool {
        class planthemp {
            text = "plant the weed";
            script = "execVM 'drugs\plantmanually.sqf'";
        };
    };

 

 

STEP 3 (launch the event throug init.sqf)

create weed.sqf (mpmissions\your instance\)

Spoiler

private ["_spawnRadius","_spawnMarker","_position","_positionarray","_mainpos","_markerRadius","_marker","_plant01",
"_plant02","_plant03","_plant04","_plant05","_plant06","_plant07","_spawnChance","_spawnRoll"];

_despawn_timer = 500;
_spawnRadius = 5000;
_spawnMarker = 'center';
_position = [getMarkerPos "center",0,5500,10,0,2000,0] call BIS_fnc_findSafePos;
_positionarray = [
[(_position select 0) - 14.5, (_position select 1) - 21,-0.012],
[(_position select 0) - 20, (_position select 1) - 20,-0.012],
[(_position select 0) + 25, (_position select 1) + 5,-0.012],
[(_position select 0) + 16, (_position select 1) - 14,-0.012],
[(_position select 0) + 49, (_position select 1) + 17.5,-0.012],
[(_position select 0) + 38.5, (_position select 1) - 16,-0.012]
];
_mainpos = _positionarray call BIS_fnc_selectRandom;


 

 

 

 


_markerRadius = 100; // Radius the camp can spawn and used for the marker

_marker_on_radius = createMarker ["bodycorpse",_position];
_marker_on_radius setMarkerShape "ELLIPSE";
_marker_on_radius setMarkerType "Cricle01";
_marker_on_radius setMarkerColor "ColorBlack";
_marker_on_radius setMarkerAlpha 0.8;
_marker_on_radius setMarkerBrush "Solid";
_marker_on_radius setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];

_marker = createMarker ["WeedFarm", _mainpos];
_marker setMarkerText "WeedFarm";
_marker setMarkerType "mil_circle";
_marker setMarkerColor "ColorGreen";
_marker setMarkerBrush "Solid";
_marker setMarkerSize [0.1, 0.1];

 

_plant01 = createVehicle ["Fiberplant", [(_position select 0) + 1, (_position select 1) - 13,-0.12],[], 0, "CAN_COLLIDE"];
_plant01 setDir 0;
_plant01 setVectorUp surfaceNormal position _plant01;
_plant02 = createVehicle ["Fiberplant", [(_position select 0) - 13, (_position select 1) - 3,-0.12],[], 0, "CAN_COLLIDE"];
_plant02 setDir 0;
_plant02 setVectorUp surfaceNormal position _plant02;
_plant03 = createVehicle ["Fiberplant", [(_position select 0) + 14, (_position select 1) - 8,-0.12],[], 0, "CAN_COLLIDE"];
_plant03 setDir 0;
_plant03 setVectorUp surfaceNormal position _plant03;
_plant04 = createVehicle ["Fiberplant", [(_position select 0) - 1, (_position select 1) - 11,-0.12],[], 0, "CAN_COLLIDE"];
_plant04 setDir 0;
_plant04 setVectorUp surfaceNormal position _plant04;
_plant05 = createVehicle ["Fiberplant", [(_position select 0) - 10, (_position select 1) - 5,-0.12],[], 0, "CAN_COLLIDE"];
_plant05 setDir 0;
_plant05 setVectorUp surfaceNormal position _plant05;
_plant06 = createVehicle ["Fiberplant", [(_position select 0) - 11, (_position select 1) - 7,-0.12],[], 0, "CAN_COLLIDE"];
_plant06 setDir 0;
_plant06 setVectorUp surfaceNormal position _plant06;
_plant07 = createVehicle ["Fiberplant", [(_position select 0) - 20, (_position select 1) - 9,-0.12],[], 0, "CAN_COLLIDE"];
_plant07 setDir 0;
_plant07 setVectorUp surfaceNormal position _plant07;

 

 


[nil,nil,rTitleText,"THERS A WEED FARM! COLLECT THE DRUGS","PLAIN",7.5] call RE;    

 


sleep _despawn_timer;

deleteVehicle _plant01;
deleteVehicle _plant02;
deleteVehicle _plant03;
deleteVehicle _plant04;
deleteVehicle _plant05;
deleteVehicle _plant06;
deleteVehicle _plant07;
deleteMarker _marker_on_radius;
deleteMarker _marker;

 

 

Open init.sqf and find:

call compile preprocessFileLineNumbers "\z\addons\dayz_server\system\server_monitor.sqf";

bellow paste:

//weed
_weed = [] execVM "weed.sqf";
//

 

 

now go in game , right click on etool , plant  and try to cut the hemp with the knife or machete

Link to comment
Share on other sites

26 minutes ago, Jestertriks said:

Ok so its not the event. got the same response from planting my self.

 

I also deleted the deploy way and installed the extra_rc way and still got the same response wtf lol

ok gonna try something diferent

forgot the right click actions.. gona use and translate the nearest restriction to fn_selfactions.  to try the script with scroll menu option.. ok?

replace the cuthemp.sqf by this:   (drop it into mpmissions\instance_11.chernarus\drugs\ )

Spoiler

/*
rewrited by juandayz for epoch 1.6
put together for DayZ Epoch
Credits to Shogun338 from Insurrection gaming
modified for separate "gather weed" script
*/

private ["_vehicle","_inVehicle","_countplayers","_gearmenu","_playerPos","_nearWeed","_weed","_objectID","_objectUID"];


_weed = nearestObject [player, "fiberplant"];


if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {
dayz_actionInProgress = false; 
systemChat("Not in combat mode");
};
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
_countplayers = count nearestObjects [player, ["CAManBase"], 7];
if (_inVehicle) exitWith {
 systemChat("you cannot do it in a vehicle");
 };
if (_countplayers > 1) exitWith {

  systemChat("Nearest player action cancelled");
 };

	player playActionNow "Medic";
	sleep 1;
	deleteVehicle _weed;
	player addMagazine "ItemKiloHemp";
	sleep 2;
	 systemChat("NICE LETS SMOKE OR SELL");

 

open your CUSTOM fn_Selfactions.sqf

at very botom paste:

Spoiler

private["_playerPos","_nearplant"];

_playerPos = getPosATL player;
_nearplant = count nearestObjects [_playerPos, ["fiberplant"], 3] > 0;
 
if (_nearplant) then {
        if (s_player_cuth < 0) then {
            s_player_cuth = player addaction[("<t color=""#F7D708"">" + ("cut flowers") +"</t>"),"drugs\cutehemp.sqf"];
        };
    } else {
        player removeAction s_player_cuth;
        s_player_cuth = -1;
    };		

 

 

Link to comment
Share on other sites

8 hours ago, Hooty said:

Just notice when I harvest 3 plus weed it will not let me access any trader or anything in selfactions? When I re log it seems to work again any ideas?

do you have any king of cute text saying "action already in progres" in your game?

Link to comment
Share on other sites

2 hours ago, Hooty said:

no but i get that if say i already have the limit in my inventory when i re try to havest

try replace the cutehemp.sqf with this

Spoiler

/*
rewrited by juandayz for epoch 1.6
put together for DayZ Epoch
Credits to Shogun338 from Insurrection gaming
modified for separate "gather weed" script
*/

private ["_vehicle","_inVehicle","_countplayers","_gearmenu","_playerPos","_nearWeed","_weed","_objectID","_objectUID"];
_playerPos = getPosATL player;

_nearWeed = count nearestObjects [_playerPos, ["fiberplant"], 4] > 0;
_weed = nearestObject [player, "fiberplant"];

if !(_nearWeed) exitWith {
 systemChat("Needs be near of a FiberPlant");
};

if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {
dayz_actionInProgress = false; 
systemChat("Not in combat mode");
};
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
_countplayers = count nearestObjects [player, ["CAManBase"], 7];
if (_inVehicle) exitWith {
 systemChat("you cannot do it in a vehicle");
 };
if (_countplayers > 1) exitWith {

  systemChat("Nearest player action cancelled");
 };





	disableSerialization;
	_gearmenu = FindDisplay 106;
	_gearmenu CloseDisplay 106;
	player playActionNow "Medic";
	r_interrupt = false;
	sleep 6;

	deleteVehicle _weed;

	player addMagazine "ItemKiloHemp";
	sleep 2;
	 systemChat("NICE LETS SMOKE OR SELL");

 

 

Link to comment
Share on other sites

1 hour ago, Jestertriks said:

@juandayz Yes sir, the fn_selfactions worked. when at the plants it said "cut plant" and it worked.

non spawned in plants. used your adminevents and started a weedfarm

right click knife still did not work

well if u see in the code of fn_Selfactions.sqf and in the cuthemp  the restrictions lines are the sames... cannot understand why it dsnt work ...

but try it... again back to use right clicks.

and replace cutehemp by this

Spoiler

/*
rewrited by juandayz for epoch 1.6
put together for DayZ Epoch
Credits to Shogun338 from Insurrection gaming
modified for separate "gather weed" script
*/

private ["_vehicle","_inVehicle","_countplayers","_gearmenu","_playerPos","_nearWeed","_weed","_objectID","_objectUID"];
_playerPos = getPosATL player;
_hempqty = {_x == "ItemKiloHemp"} count magazines player;
_nearWeed = count nearestObjects [_playerPos, ["fiberplant"], 4] > 0;
_weed = nearestObject [player, "fiberplant"];

if !(_nearWeed) exitWith {
dayz_actionInProgress = false; 
 systemChat("Needs be near of a FiberPlant");
};
if (_hempqty > 2) exitWith { 
dayz_actionInProgress = false; 
    systemChat("YOure Full of Drugs");
};
if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {
dayz_actionInProgress = false; 
systemChat("Not in combat mode");
};
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
_countplayers = count nearestObjects [player, ["CAManBase"], 7];
if (_inVehicle) exitWith {
dayz_actionInProgress = false; 
 systemChat("you cannot do it in a vehicle");
 };
if (_countplayers > 1) exitWith {
dayz_actionInProgress = false; 
  systemChat("Nearest player action cancelled");
 };





	disableSerialization;
	_gearmenu = FindDisplay 106;
	_gearmenu CloseDisplay 106;
	player playActionNow "Medic";
	r_interrupt = false;
	sleep 1;

	deleteVehicle _weed;

	player addMagazine "ItemKiloHemp";
	sleep 2;
	 systemChat("NICE LETS SMOKE OR SELL");
dayz_actionInProgress = false; 

 

 

 

Link to comment
Share on other sites

4 hours ago, Jestertriks said:

ok it is working now, I'm guessing that cuthemp script? IDK but thank you for taking the time to help

lines in black to see the changes

if !(_nearWeed) exitWith {
dayz_actionInProgress = false;
 systemChat("Needs be near of a FiberPlant");
};

seems like your old cutehemp do not get out of the first action in progress... i guess

Link to comment
Share on other sites

Fixed mine i replaced cuthemp.sqf with this

Spoiler

private ["_inventory","_hastool","_inVehicle","_vehicle","_gearmenu","_playerPos","_nearWeed","_weed","_countplayers","_objectID","_objectUID"];
dayz_actionInProgress = true;
_playerPos = getPosATL player;
_hempqty = {_x == "ItemKiloHemp"} count magazines player;
_nearWeed = count nearestObjects [_playerPos, ["fiberplant"], 4] > 0;
_weed = nearestObject [player, "fiberplant"];
_countplayers = count nearestObjects [player, ["CAManBase"], 7];
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
_inventory  = items player;
_hastool    =     "ItemKnife" in _inventory;

if (!_hastool) exitWith {cutText
[format["Im not getting all those trichomes on my hands! You need a knife!"], "PLAIN DOWN"];
};

if (_inVehicle) exitWith {
 cutText [format["Nah dude, get out and harvest..."], "PLAIN DOWN"]; 
 };
 
if (_countplayers > 1) exitWith {
 cutText [format["No way dude! Someone is watching your ass! Player within 5m HIDE THE DEAD and ZEDS"], "PLAIN DOWN"];
 };
 
if !(_nearWeed) exitWith {
 systemChat("Dude are you tripping balls? There are no plants here?");
};
if (_hempqty > 0) exitWith { 
    systemChat("Oi dude do you smell loud? put it in your bag ay!");
};

    disableSerialization;
    _gearmenu = FindDisplay 106;
    _gearmenu CloseDisplay 106;
    r_interrupt = false;
    _objectID = _weed getVariable["ObjectID","0"];
    _objectUID = _weed getVariable["ObjectUID","0"];
    deleteVehicle _weed;
    PVDZ_obj_Destroy = [_objectID,_objectUID,_weed];
     publicVariableServer "PVDZ_obj_Delete";
    player addMagazine "ItemKiloHemp";

    player addMagazine "ItemKiloHemp";
    sleep 2;
    systemChat("Yiew! Right Click it! LETS SMOKE! I hear the Hustler & Gem trader buys this stuff too!");
     
    dayz_actionInProgress = false;

I removed the waiting for harvest to finish , made it cut instant "no medic action", set hempqty<0, and made it give 2 kilos since you have to store after each harvest. This also prevented all dupes on 1.0.5.1 and seems to on 1.0.6.1 including auto clickers.

***I use click actions method***

Link to comment
Share on other sites

  • 5 weeks later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...