Jump to content

[1.6 Harvestable hemp, smoking weed, pot farms]


juandayz

Recommended Posts

DRUGS

Before star... you should add this items into your traders menus.

Spoiler

equip_comfreyleafs  (used to craft drugs plants)

ItemFertilizer (used to craft drugs plants)

ItemHempPlant (the hemp plant who comes by default with epoch)

ItemKiloHemp (the thing we gonna use to set as drug)

1.Create this path: mpmissions\your instance\scripts\drugs\

2-Create the sqfs into the new path.

Spoiler

craftplant.sqf

Spoiler


//by juandayz
private ["_seeds","_ItemFertilizer"];
_seeds = {_x == "equip_comfreyleafs"} count magazines player;
if (_seeds < 2) exitWith {systemchat"you need  2 leafs";};

_ItemFertilizer = {_x == "ItemFertilizer"} count magazines player;
if (_ItemFertilizer == 0) exitWith {systemchat"you need  fertilezer";};

player playActionNow "Medic";
player removeMagazine "ItemFertilizer";
player removeMagazine "equip_comfreyleafs";
player removeMagazine "equip_comfreyleafs";
sleep 1;
player addMagazine "ItemHempPlant";

systemchat "you got a weed plant";

 

cutehemp.sqf

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 ["_weed2","_vehicle","_inVehicle","_countplayers","_gearmenu","_playerPos","_nearWeed","_weed","_objectID","_objectUID","_hempqty"];
_playerPos = getPosATL player;
_hempqty = {_x == "ItemKiloHemp"} count magazines player;
_nearWeed = count nearestObjects [_playerPos, ["fiberplant","MAP_c_fern"], 4] > 0;
_weed = nearestObject [player,"fiberplant"];

_weed2 = nearestObject [player,"MAP_c_fern"];

if !(_nearWeed) exitWith {
 systemChat("Needs be near of a plant");
};
if (_hempqty > 12) exitWith {
    systemChat("Youre Full of Drugs");
};

_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;
    deleteVehicle _weed2;
    player addMagazine "ItemKiloHemp";
    sleep 2;
     systemChat("NICE LETS SMOKE IT");

 

smoke.sqf

Spoiler


/*
 rewrited by juandayz for epoch 1.6
   credits to ZeroK00L...
*/
    [] spawn {
    systemChat("Drugs my only love");
    player removeMagazine 'ItemKiloHemp';
    Remove_Drug_effects =
    {
    {
    ppEffectDestroy _x;
    } forEach (_this select 0);
    ppEffectDestroy ppe2;
    ppEffectDestroy ppe3;
    setaperture 0;
    };
    _time = time;
    _effects = [];
	player playMoveNow "ActsPercMstpSnonWpstDnon_sceneBardak01";
    while {true} do
    {
    ppe2 = ppEffectCreate ["chromAberration", 1555];
    _effects = _effects + [ppe2];
    ppe2 ppEffectAdjust [random 0.25,random 0.25,true];
    ppe2 ppEffectCommit 1;
    ppe2 ppEffectEnable true;
    ppe3 = ppEffectCreate ["radialBlur", 1555];
    _effects = _effects + [ppe3];
    ppe3 ppEffectEnable true;
    ppe3 ppEffectAdjust [random 0.02,random 0.02,0.15,0.15];
    ppe3 ppEffectCommit 1;
    sleep random(1);
    if (_time + 10 < time) exitWith {[_effects] call Remove_Drug_effects;};
    };
    };

 

 

3.Now you need extra_rc.hpp or deploy anything mod.

Spoiler

if your using extra_rc.hpp paste:

Spoiler


class ExtraRc {
 /////////////////////////////DRUGS
 class ItemKnife {
        class farmhemp {
            text = "HARVEST PLANT";
            script = "execVM 'scripts\drugs\cuthemp.sqf'";
        };
		
    };
    class ItemKiloHemp {
        class smokeweed {
            text = "SMOKE ME!!!";
            script = "execVM 'scripts\drugs\smoke.sqf'";
        };
    };
    class ItemMachete {
        class farmhemp2 {
            text = "HARVEST PLANT";
            script = "execVM 'scripts\drugs\cuthemp.sqf'";
        };
    };	
	class equip_comfreyleafs {
        class create {
            text = "WeedPlant";
            script = "execVM 'scripts\drugs\craftplant.sqf'";
        };
    };
///////////////END DRUGS
};

 

 

if ure using deploy anything


DZE_CLICK_ACTIONS = [
///DRUGS
["ItemKnife","Harvest the weed","execVM 'scripts\drugs\cuthemp.sqf';","true"],
["ItemMachete","Harvest the weed","execVM 'scripts\drugs\cuthemp.sqf';","true"],
["equip_comfreyleafs","CraftPlant","execVM 'scripts\drugs\craftplant.sqf';","true"],
["ItemKiloHemp","Smoke that shit","execVM 'scripts\drugs\smoke.sqf';","true"]
//DRUGS ENDS
];

 

 

4.Now we gonna create an epoch event to spawn weed fields.

Spoiler

A-Open init.sqf

this line must be true:


EpochUseEvents = true;

and add lines in blue:

EpochEvents = [["any","any","any","any",10,"server_weed"],["any","any","any","any",13,"default epoch events"]];

B-into dayz_server\modules\ create server_weed.sqf

Spoiler


//taked from nova
private ["_hintmsg","_spawnChance", "_spawnMarker", "_spawnRadius", "_markerRadius", "_item", "_debug", "_start_time", "_loot", "_loot_amount", "_loot_box", "_wait_time", "_spawnRoll", "_position", "_event_marker", "_loot_pos", "_debug_marker","_loot_box", "_hint"];
_hintmsg = false; //change by true if ure using remotemessages provided by coins mod
_spawnChance =  1; // Percentage chance of event happening 0.30
_markerRadius = 300; // Radius the loot can spawn and used for the marker
_debug = true; // Puts a marker exactly were the loot spawns

_wait_time = 800; 

// Dont mess with theses unless u know what yours doing
_start_time = time;
_spawnRadius = 5000;
_spawnMarker = 'center';

// Random chance of event happening
_spawnRoll = random 1;
if (_spawnRoll > _spawnChance and !_debug) exitWith {};

// Random location [[x,y,z],0,1000,10,0,25,0] call BIS_fnc_findSafePos;
_position = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,4000,0] call BIS_fnc_findSafePos;

diag_log(format["Spawning loot event at %1", _position]);

_event_marker = createMarker [ format ["loot_event_marker_%1", _start_time], _position];
_event_marker setMarkerShape "Ellipse";
_event_marker setMarkerColor "ColorGreen";
_event_marker setMarkerAlpha 0.5;
_event_marker setMarkerBrush "GRID";
_event_marker setMarkerSize [_markerRadius, _markerRadius];
//
_event_markerLabel = createMarker [ format ["loot_event_marker_%1", _start_time], _position];
_event_markerLabel setMarkerColor "ColorBlack";
_event_markerLabel setMarkerText "Hemp Field";




_loot_pos = [_position,0,(_markerRadius - 100),10,0,2000,0] call BIS_fnc_findSafePos;

if (_debug) then {
	_debug_marker = createMarker [ format ["loot_event_debug_marker_%1", _start_time], _loot_pos];
	_debug_marker setMarkerType "Join";
	_debug_marker setMarkerColor "ColorGreen";
	_debug_marker setMarkerAlpha 1;
};

diag_log(format["Creating ammo box at %1", _loot_pos]);

_buildPlant = random 30;
_offset = 120;

for "_i" from 0 to _buildPlant do {

    _distance1 = random _offset;
    _distance2 = random _offset;

    _plant = createVehicle ["Fiberplant", [(_loot_pos select 0)+_distance1,(_loot_pos select 1)+_distance2, 0], [], 0, "CAN_COLLIDE"];
    _plant setPos [(_loot_pos select 0)+_distance1,(_loot_pos select 1)+_distance2, 0];
    _uID = str(round(random 999999));
    _plant setVariable ["ObjectID", _uID, true];
    _plant setVariable ["ObjectUID", _uID, true];
    _plant setVariable ["lastUpdate",time,true];

};

if (_hintmsg) then {
// Send message to users
_hint = parseText format["<t align='center' color='#31db3c' shadow='2' size='1.55'>NEW EVENT</t><br/><t align='center' color='#ffffff'>!WEED FIELD!.Take your Knife or Machete and harvest some drugs.</t>"];
RemoteMessage = ['hint', _hint];
publicVariable "RemoteMessage";
}else{
[nil,nil,rTitleText,"A WEED FIELD!","PLAIN",7.5] call RE;    
};


diag_log(format["Loot event setup, waiting for %1 seconds", _wait_time]);

// Wait
sleep _wait_time;

// Clean up
// deleteVehicle _loot_box;
deleteMarker _event_marker;
deleteMarker _event_markerLabel;

if (_debug) then {
	deleteMarker _debug_marker;
};

 

 

Now this is optional... since i do not use road blocks for anything... i just change it by weed plants.. so if u wanna do the same:

1-Open spawn_roadblocks.sqf located in dayz_server\compile\

then change this line:

_spawnveh = DZE_isWreck call BIS_fnc_selectRandom;

by:

_spawnveh = "Fiberplant";

2-open your init.sqf find this line to manage the amount of fiber plants spawned.

MaxDynamicDebris = 20; // was changed by juandayz to spawn fiberplants

 

Optional too. Create a police Drugs check point. (if player cross that check point with drugs police gonna remove it)

You will need create the map addon.. i just give you the code for remove drugs.

Spoiler

police.sqf


[format["<t size='1.2' color='#D01000'>WARNING %1</t><br/><t size='0.9'>POLICE GONNA REMOVE ALL YOUR DRUGS FROM YOUR INVENTORY</t>",(name player)],0,0,5,5] spawn BIS_fnc_dynamicText;
while {true} do {
		private["_vehicle", "_curspeed", "_vel", "_dir", "_speed","_hempqty"];
        //waitUntil {vehicle player != player and!((vehicle player) isKindOf 'Air')};
		
		if (vehicle player != player and!((vehicle player) isKindOf 'Air')) then {
        _vehicle = vehicle player;
        _curspeed = speed _vehicle;
        if (_curspeed > 30) then {
            _vel = velocity _vehicle;
            _dir = direction _vehicle;
            _speed = _curspeed - 30;
            _vehicle setVelocity[(_vel select 0) - ((sin _dir) * _speed), (_vel select 1) - ((cos _dir) * _speed), (_vel select 2)];
        };
		_hempqty = {_x == "ItemKiloHemp"} count magazines player;
		if (_hempqty > 0) exitWith{
		{player removeMagazine "ItemKiloHemp"} count (magazines player);
		systemchat "POLICE CATCH YOU WITH DRUGS AND REMOVE IT FROM YOUR POKETS";
		}; 
       
		}else{
		 _hempqty = {_x == "ItemKiloHemp"} count magazines player;
		if (_hempqty > 0) exitWith{
		{player removeMagazine "ItemKiloHemp"} count (magazines player);
		systemchat "POLICE CATCH YOU WITH DRUGS AND REMOVE IT FROM YOUR POKETS";
		}; 
		};
		 sleep 0.1;
    };

in mission.sqm (into class sensor)


class Item Your item Value Here
        {
            position[]={Your Own coords here};
            a=30;
            b=30;
            activationBy="ANY";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            name="policezone";
            expCond="(vehicle player) in thislist;";
            expActiv="titleText [""Warning Police Check Control"", ""PLAIN DOWN""];policezone = [] execVM ""scripts\police.sqf"";";
            expDesactiv="terminate policezone; titleText [""Leaving Police Check Control"", ""PLAIN DOWN""];";
            class Effects
            {
            };
        };

 

 

Link to comment
Share on other sites

Error in expression <icle _weed;
[_objectID,_objectUID] call server_deleteObj;
deleteVehicle _weed;
P>
  Error position: <server_deleteObj;
deleteVehicle _weed;
P>
  Error Nicht definierte Variable in Ausdruck: server_deleteobj
File mpmissions\__CUR_MP.Chernarus\Scripts\drugs\cuthemp.sqf, line 36

:-(

Link to comment
Share on other sites

17 minutes ago, oldmatechoc said:

@oldmatechoc

where i add this ? so?

 

if !(_nearWeed) exitWith {
 systemChat("Needs be near of a FiberPlant");
};
if (_hempqty > 2) exitWith { 
    systemChat("Youre Full of Drugs");
};

	disableSerialization;
	_gearmenu = FindDisplay 106;
	_gearmenu CloseDisplay 106;
	player playActionNow "Medic";
	r_interrupt = false;
	sleep 6;
	if (isServer) then {
		PVDZE_obj_Delete call server_deleteObj;
	} else {
		PVDZE_obj_Delete = [_objectID,_objectUID,_activatingPlayer];
		publicVariableServer "PVDZE_obj_Delete";
	};
	player addMagazine "ItemKiloHemp";
	sleep 2;
	 systemChat("NICE LETS SMOKE OR SELL");
     
    

 

Link to comment
Share on other sites

1 minute ago, coresync said:

Error in expression <icle _weed;
[_objectID,_objectUID] call server_deleteObj;
deleteVehicle _weed;
P>
  Error position: <server_deleteObj;
deleteVehicle _weed;
P>
  Error Nicht definierte Variable in Ausdruck: server_deleteobj <- clientsite RPT

do you spawn the fiberplants as event?

Link to comment
Share on other sites

1 minute ago, coresync said:

yes

try replace the whole cuthemp.sqf with this:

Spoiler

private ["_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 {
	cutText [format["Needs be near of a FiberPlant."], "PLAIN DOWN"];
};
if (_hempqty > 2) exitWith { 
    cutText [format["WARNING: %1, YOure Full of Drugs survivor", name player], "PLAIN DOWN"];
};

	disableSerialization;
	_gearmenu = FindDisplay 106;
	_gearmenu CloseDisplay 106;
	player playActionNow "Medic";
	r_interrupt = false;
	sleep 6;
	_objectID = _weed getVariable["ObjectID","0"];
	_objectUID = _weed getVariable["ObjectUID","0"];
	deleteVehicle _weed;
	//PVDZ_obj_Destroy = [_objectID,_objectUID,_weed];
    //publicVariableServer "PVDZ_obj_Destroy";
	player addMagazine "ItemKiloHemp";
	sleep 2;
	cutText [format["NICE LETS SMOKE AND SELL"], "PLAIN DOWN"];	

 

if still not work, uncoment the two lines

Link to comment
Share on other sites

@juandayz so it is working, without server_deleteobj

/*
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 ["_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");
};


	disableSerialization;
	_gearmenu = FindDisplay 106;
	_gearmenu CloseDisplay 106;
	player playActionNow "Medic";
	r_interrupt = false;
	sleep 6;
	_objectID = _weed getVariable["ObjectID","0"];
	_objectUID = _weed getVariable["ObjectUID","0"];
	deleteVehicle _weed;
//	[_objectID,_objectUID] call server_deleteObj;
	deleteVehicle _weed;
	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

  • 2 weeks later...
4 hours ago, kingpapawawa said:

looking for a way to spawn a few ai at these locations... wai or dzai or??

Go download those admin events, look at the rubble town mission, there are ai in there that you could use as an example to add ai to the hemp mission. If you can't figure it out from that, I can help you more, but it's pretty easy. Make sure you copy the private variables for the enemyai and each variable used for the ai. If you read through the rubble mission you should understand...

Link to comment
Share on other sites

  • 1 month later...

In case anyone else uses knife blunting, you would need to add the following extra code to your extra_rc.hpp:

	class ItemKnife5 {
        class farmhemp {
            text = "Harvest the weed";
            script = "execVM 'custom\drugs\cuthemp.sqf'";
        };
    };
	class ItemKnife4 {
        class farmhemp {
            text = "Harvest the weed";
            script = "execVM 'custom\drugs\cuthemp.sqf'";
        };
    };
	class ItemKnife3 {
        class farmhemp {
            text = "Harvest the weed";
            script = "execVM 'custom\drugs\cuthemp.sqf'";
        };
    };
	class ItemKnife2 {
        class farmhemp {
            text = "Harvest the weed";
            script = "execVM 'custom\drugs\cuthemp.sqf'";
        };
    };
	class ItemKnife1 {
        class farmhemp {
            text = "Harvest the weed";
            script = "execVM 'custom\drugs\cuthemp.sqf'";
        };
    };

 

Link to comment
Share on other sites

  • 2 weeks later...

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
×
×
  • Create New...